Expand description
Derive macro for reindeerโs ๐ฆ Entity trait.
To automatically derive Entity on a struct, you simply have to derive Entity (as Well as serdeโs Serialize and Deserialize traits) like so:
#[derive(Serialize,Deserialize,Entity)]
struct User {
    id : (u32,u32),
    email : String,
    username : String,
    last_login : i64,
    password_hash : String,
}โ๐ This will generate an Entity implementation with store name User, version 0, and id being the id field.
To specify other values, use the helper attribute entity like so :
#[derive(Serialize,Deserialize,Entity)]
#[entity(name = "user", version = 1,id = "email")]
struct User {
    email : String,
    username : String,
    last_login : i64,
    password_hash : String,
}To specify sibling entities and child entities, use the sibling and child helper attributes
respectively:
#[derive(Serialize,Deserialize,Entity)]
#[entity(name = "user", version = 1,id = "email")]
#[sibling(("user_data", Cascade))]
#[children(("doc",Cascade),("shared_doc",BreakLink))]
struct User {
    email : String,
    username : String,
    last_login : i64,
    password_hash : String,
}
 
//! #[derive(Serialize,Deserialize,Entity)]
#[entity(name = "user_data", version = 1,id = "email")]
#[sibling(("user", Error))]
struct UserData {
    email : String,
    username : String,
    last_login : i64,
    password_hash : String,
}The second part of each relation is a reindeer::DeletionBehaviour enum value : BreakLink,Cascade, or Error.
Derive Macrosยง
- Entity
 - Derive macro for 
reindeerโs ๐ฆEntitytrait.