#[derive(Table)]
{
// Attributes available to this derive:
#[geekorm]
#[gorm]
}
Expand description
Derive macro for Table
trait.
This macro will generate the implementation of Table
trait for the given struct.
The struct must have named fields.
ยงExample
This macro generates a number of methods for the struct, including table
and table_name
methods.
use geekorm::prelude::*;
#[derive(Table, Default, serde::Serialize, serde::Deserialize)]
struct Users {
id: PrimaryKeyInteger,
name: String,
age: i32,
occupation: String,
}
// This will get you the underlying table information.
let table = Users::table();
assert_eq!(Users::table_name(), "Users");