1 unstable release
0.0.1 | Nov 1, 2024 |
---|
#64 in #k8s
135 downloads per month
24KB
394 lines
status-manager
介绍
提供。
- k8s状态数据:kubernetes
使用说明
添加依赖
cargo add status_manager
示例代码
use std::env;
use diesel::pg::PgConnection;
use diesel::{update, Connection, ConnectionError};
use diesel::dsl::delete;
use status_manager::cores::create::create_posgres_table;
use crate::cores::create::{create_sqlite3_table, insert_postgres_object, insert_sqlite3_object};
use crate::cores::delete::{delete_postgres_object, delete_sqlite3_object, drop_postgres_table, drop_sqlite3_table};
use crate::cores::query::{list_postgres_object, list_sqlite3_object, query_postgres_table, query_sqlite3_table};
use serde_json::json;
use crate::cores::update::{update_postgres_object, update_sqlite3_object};
use std::collections::HashMap;
use diesel::SqliteConnection;
static SQLITE3_URL: &str = "/data/database.db";
fn main()
{
match establish_sqlite3_connection() {
Ok(mut conn) => {
println!("connecting successfully.");
},
Err(e) => {
eprintln!("Error connecting to the database: {}", e);
},
}
}
fn establish_sqlite3_connection() -> Result<SqliteConnection, ConnectionError> {
SqliteConnection::establish(SQLITE3_URL)
}
效果验证
Dependencies
~31MB
~513K SLoC