started with ormx bot found a lack of documentation that made me stop
This commit is contained in:
parent
1a5003347c
commit
20a6d1e114
26
src/types.rs
Normal file
26
src/types.rs
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#[derive(ormx::Table)]
|
||||||
|
#[ormx(table = "users", id = user_id, insertable)]
|
||||||
|
struct User {
|
||||||
|
#[ormx(column = "id")]
|
||||||
|
user_id: u32,
|
||||||
|
name: String,
|
||||||
|
#[ormx(get_optional(&str))]
|
||||||
|
email: String,
|
||||||
|
#[ormx(default, set)]
|
||||||
|
last_login: Option<NaiveDateTime>,
|
||||||
|
password: String, // sure about the type?
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#[derive(ormx::Table)]
|
||||||
|
#[ormx(table = "trees", insertable)]
|
||||||
|
struct Tree {
|
||||||
|
id: u32,
|
||||||
|
lat: i32,
|
||||||
|
lon: i32,
|
||||||
|
#[ormx(get_optional(&str))]
|
||||||
|
species: String,
|
||||||
|
age: u32,
|
||||||
|
health: String,
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue