Commit 36b7ba27 authored by xuwencheng's avatar xuwencheng

root

parent e26f7d0e
......@@ -14,6 +14,8 @@ pub enum Event {
#[strum(serialize = "初始化编译db")]
MakeDB,
#[strum(serialize = "初始化root")]
GrantRoot,
#[strum(serialize = "初始化表结构")]
SchemaSql,
#[strum(serialize = "升级sql")]
......
......@@ -16,15 +16,25 @@ pub mod tool;
mod tests {
use super::*;
#[test]
fn json() {
let v = serde_json::json!({"code": "1"});
let v = v
.pointer("/code")
.and_then(|v| v.as_i64().or_else(|| v.as_str()?.parse::<i64>().ok()))
.unwrap_or(25252);
println!("{v}");
}
#[test]
fn id() {
let id = crate::tool::id::id();
let time = crate::tool::time::hour_millisecond(0).unwrap_or_default();
let gid = crate::tool::id::generate_id(time);
println!("1. {id}, {}", id as u64);
println!("2. {gid}, {}", gid as i64);
println!("3. {}", id - (gid as i64));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment