You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
OneAuth/oab/src/models/mod.rs

31 lines
650 B
Rust

3 years ago
//
// mod.rs
// Copyright (C) 2022 veypi <veypi@qq.com>
// 2022-06-02 23:04
// Distributed under terms of the MIT license.
//
3 years ago
pub mod app;
mod role;
3 years ago
mod user;
use std::{fs::File, io::Read};
3 years ago
use tracing::info;
use crate::DB;
pub use app::{AUStatus, App, AppUser};
pub use role::{Access, Resource, Role};
pub use user::User;
3 years ago
pub async fn init() {
info!("init database");
let mut f = File::open("./sql/table.sql").unwrap();
let mut sql = String::new();
f.read_to_string(&mut sql).unwrap();
DB.exec(&sql, vec![]).await.unwrap();
}
pub fn new_id() -> rbatis::object_id::ObjectId {
rbatis::plugin::object_id::ObjectId::new()
3 years ago
}