status_manager

Crates.iostatus_manager
lib.rsstatus_manager
version0.0.1
sourcesrc
created_at2024-11-01 01:07:29.942563
updated_at2024-11-01 01:07:29.942563
descriptionKubernetes apiserver
homepage
repositoryhttps://gitee.com/iscas-system/apiserver
max_upload_size
id1431155
size56,884
Heng WU (syswu)

documentation

README

status-manager

介绍

提供。

使用说明

添加依赖

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)
}

效果验证

Commit count: 0

cargo fmt