Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
model-entity
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rust common
model-entity
Commits
36b7ba27
Commit
36b7ba27
authored
Feb 11, 2025
by
xuwencheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
root
parent
e26f7d0e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
launch.rs
src/event/launch.rs
+2
-0
lib.rs
src/lib.rs
+12
-2
No files found.
src/event/launch.rs
View file @
36b7ba27
...
...
@@ -14,6 +14,8 @@ pub enum Event {
#[strum(serialize
=
"初始化编译db"
)]
MakeDB
,
#[strum(serialize
=
"初始化root"
)]
GrantRoot
,
#[strum(serialize
=
"初始化表结构"
)]
SchemaSql
,
#[strum(serialize
=
"升级sql"
)]
...
...
src/lib.rs
View file @
36b7ba27
...
...
@@ -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
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment