mirror of https://github.com/veypi/OneAuth.git
add oab
parent
f88ef1394e
commit
b4f3b67535
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,23 @@
|
||||
[package]
|
||||
name = "oab"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
include_dir = "*"
|
||||
lazy_static = "1"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "*"
|
||||
serde_yaml = "*"
|
||||
clap = { version = "3", features = ["derive"] }
|
||||
time = { version = "0.3", features = ["formatting", "macros"] }
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
tracing = "*"
|
||||
tracing-subscriber = "*"
|
||||
|
||||
rbson = "2"
|
||||
rbatis = { version = "*", default-features = false, features = ["runtime-tokio-rustls","mysql","debug_mode"] }
|
||||
|
||||
|
@ -0,0 +1,12 @@
|
||||
//
|
||||
// mod.rs
|
||||
// Copyright (C) 2022 veypi <veypi@qq.com>
|
||||
// 2022-05-29 18:39
|
||||
// Distributed under terms of the MIT license.
|
||||
//
|
||||
//
|
||||
|
||||
mod cfg;
|
||||
pub use cfg::init_log;
|
||||
pub use cfg::ApplicationConfig;
|
||||
pub use cfg::DB;
|
@ -0,0 +1,9 @@
|
||||
//
|
||||
// lib.rs
|
||||
// Copyright (C) 2022 veypi <veypi@qq.com>
|
||||
// 2022-05-29 18:48
|
||||
// Distributed under terms of the MIT license.
|
||||
//
|
||||
|
||||
pub mod cfg;
|
||||
pub mod models;
|
@ -0,0 +1,15 @@
|
||||
use oab::{cfg, models};
|
||||
use tracing::{info, warn};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
let mut cf = cfg::ApplicationConfig::new();
|
||||
cfg::init_log();
|
||||
cf.log_dir = "".to_string();
|
||||
cf.connect().await;
|
||||
info!("{}", cf.server_url);
|
||||
warn!("{}", cf.db_url);
|
||||
models::init().await;
|
||||
println!("Hello, world!");
|
||||
return std::io::Result::Ok(());
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
//
|
||||
// mod.rs
|
||||
// Copyright (C) 2022 veypi <veypi@qq.com>
|
||||
// 2022-06-02 23:04
|
||||
// Distributed under terms of the MIT license.
|
||||
//
|
||||
|
||||
mod user;
|
||||
use rbatis::crud::CRUD;
|
||||
use tracing::info;
|
||||
use user::User;
|
||||
|
||||
use crate::cfg;
|
||||
|
||||
pub async fn init() {
|
||||
let mut u = User::default();
|
||||
u.name = Some("asd".to_string());
|
||||
cfg::DB.save(&u, &[]).await.unwrap();
|
||||
info!("{:#?}", u);
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
//
|
||||
// user.rs
|
||||
// Copyright (C) 2022 veypi <veypi@qq.com>
|
||||
// 2022-06-02 23:03
|
||||
// Distributed under terms of the MIT license.
|
||||
//
|
||||
//
|
||||
|
||||
use rbatis::crud_table;
|
||||
|
||||
#[crud_table]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct User {
|
||||
pub id: String,
|
||||
pub name: Option<String>,
|
||||
}
|
||||
|
||||
impl Default for User {
|
||||
fn default() -> Self {
|
||||
User {
|
||||
id: rbatis::plugin::object_id::ObjectId::new().to_string(),
|
||||
name: None,
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue