Trait mango_orm::models::ToModel[][src]

pub trait ToModel: HtmlControls + AdditionalValidation + ValidationModel {
    fn key() -> String;
fn meta() -> Result<Meta, Box<dyn Error>>;
fn widgets() -> Result<HashMap<String, Widget>, Box<dyn Error>>;
fn get_hash(&self) -> Option<String>;
fn set_hash(&mut self, value: String);
fn self_to_json(&self) -> Result<Value, Box<dyn Error>>; fn hash_to_id(hash: &str) -> Result<ObjectId, Box<dyn Error>> { ... }
fn id_to_hash(id: ObjectId) -> String { ... }
fn vitaminize(
        project_name: &str,
        unique_project_key: &str,
        collection_name: &str,
        client: &Client,
        map_widgets: &mut HashMap<String, Widget>
    ) -> Result<(), Box<dyn Error>> { ... } }

Required methods

Get model key. (To access data in the cache)

Get metadata of Model.

Get map of widgets for model fields. Hint: <field name, Widget>

Serialize an instance of the Model to a hash-line.

Provided methods

Convert hash-line to MongoDB ID.

Convert MongoDB ID to hash-line.

Enrich the widget map with values for dynamic widgets.

Implementors