27 lines
522 B
Rust
27 lines
522 B
Rust
#[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,
|
|
}
|
|
|