initial commit
This commit is contained in:
commit
912d00f2d3
12 changed files with 2635 additions and 0 deletions
14
lib/sandbox/Cargo.toml
Normal file
14
lib/sandbox/Cargo.toml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
[package]
|
||||
name = "sandbox"
|
||||
edition = "2021"
|
||||
|
||||
[[bin]]
|
||||
name = "sandbox"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
chrono = "0.4.39"
|
||||
fully_pub = "0.1.4"
|
||||
serde = "1.0.216"
|
||||
sqlx = { version = "0.8.2", features = ["chrono", "uuid", "sqlite"] }
|
||||
generator_attr = { path = "../generator_attr" }
|
||||
5
lib/sandbox/src/main.rs
Normal file
5
lib/sandbox/src/main.rs
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
pub mod models;
|
||||
|
||||
fn main() {
|
||||
println!("Sandbox")
|
||||
}
|
||||
33
lib/sandbox/src/models.rs
Normal file
33
lib/sandbox/src/models.rs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
use chrono::{DateTime, Utc};
|
||||
use sqlx::types::Json;
|
||||
use fully_pub::fully_pub;
|
||||
|
||||
use generator_attr::{sql_generator_model, SqlGeneratorDerive};
|
||||
|
||||
#[derive(sqlx::Type, Clone, Debug, PartialEq)]
|
||||
enum UserStatus {
|
||||
Disabled,
|
||||
Invited,
|
||||
Active,
|
||||
Archived
|
||||
}
|
||||
|
||||
struct RandomStruct {
|
||||
}
|
||||
|
||||
#[derive(SqlGeneratorDerive, sqlx::FromRow, Debug, Clone)]
|
||||
#[sql_generator_model(table_name="usersss")]
|
||||
#[fully_pub]
|
||||
struct User {
|
||||
#[sql_generator_field(is_primary=true)]
|
||||
id: String,
|
||||
#[sql_generator_field(is_unique=true)]
|
||||
handle: String,
|
||||
full_name: Option<String>,
|
||||
prefered_color: Option<i64>,
|
||||
last_login_at: Option<DateTime<Utc>>,
|
||||
status: UserStatus,
|
||||
groups: Json<Vec<String>>,
|
||||
avatar_bytes: Vec<u8>
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue