Crate ccntool_core
source ·Expand description
This library is a collection of functions to interact with a MySQL used for openDCIM.
The ccntool_core
crate provides a few functions to interact with a
MySQL database that is being used by an instance of the
openDCIM data center infrastructure management tool.
Example usage
use ccntool_core::*;
fn get_all_ports() {
let pool = connectdb().expect("Can't connect to database");
let all_ports = queryall(pool);
println!("All ports: {:?}", all_ports);
}
Functions
- Establishes a connection to a MySQL database using provided credentials and base URL, either passed along the function or via dotenvy.
- Executes a SQL query against the
dcim
database and returns a vector of strings containing the results. The query looks for the first port in thefac_Ports
table with a matchingNotes
field to thenotes
argument, and returns various details about the associated switch and port. If no matching row is found, an error is returned. - This function will query all available, valid wallsocket descriptions.