Trait green_barrel::models::Main
source · pub trait Main {
Show 13 methods
// Required methods
fn key() -> Result<String, Box<dyn Error>>;
fn custom_to_json_val() -> Result<Value, Box<dyn Error>>
where Self: DeserializeOwned + Sized;
fn generate_metadata() -> Result<Meta, Box<dyn Error>>
where Self: DeserializeOwned + Sized;
fn hash(&self) -> String;
fn set_hash(&mut self, value: String);
fn obj_id(&self) -> Result<Option<ObjectId>, Box<dyn Error>>;
fn set_obj_id(&mut self, object_id: ObjectId);
fn created_at(&self) -> String;
fn set_created_at(&mut self, value: String);
fn updated_at(&self) -> String;
fn set_updated_at(&mut self, value: String);
fn self_to_json_val(&self) -> Result<Value, Box<dyn Error>>;
// Provided method
fn injection<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
client: &'life0 Client,
app_name: &'life1 str,
unique_app_key: &'life2 str,
collection_name: &'life3 str,
model_json: &'life4 mut Value,
fields_name: &'life5 Vec<String>
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + 'async_trait>>
where Self: DeserializeOwned + Sized + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait { ... }
}
Expand description
Model options and field type map for Form.
Required Methods§
sourcefn key() -> Result<String, Box<dyn Error>>
fn key() -> Result<String, Box<dyn Error>>
Get model key ( to access model metadata in cache ).
sourcefn custom_to_json_val() -> Result<Value, Box<dyn Error>>where
Self: DeserializeOwned + Sized,
fn custom_to_json_val() -> Result<Value, Box<dyn Error>>where Self: DeserializeOwned + Sized,
Model instance from create
method, convert to intermediate state serde_json::value::Value
,
with the addition of Html-ID and data validation.
sourcefn generate_metadata() -> Result<Meta, Box<dyn Error>>where
Self: DeserializeOwned + Sized,
fn generate_metadata() -> Result<Meta, Box<dyn Error>>where Self: DeserializeOwned + Sized,
Generate metadata of Model.
fn set_hash(&mut self, value: String)
sourcefn set_obj_id(&mut self, object_id: ObjectId)
fn set_obj_id(&mut self, object_id: ObjectId)
ObjectId to hash field.
sourcefn created_at(&self) -> String
fn created_at(&self) -> String
Getter and Setter for field created_at
.
fn set_created_at(&mut self, value: String)
sourcefn updated_at(&self) -> String
fn updated_at(&self) -> String
Getter and Setter for field updated_at
.
fn set_updated_at(&mut self, value: String)
Provided Methods§
sourcefn injection<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
client: &'life0 Client,
app_name: &'life1 str,
unique_app_key: &'life2 str,
collection_name: &'life3 str,
model_json: &'life4 mut Value,
fields_name: &'life5 Vec<String>
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + 'async_trait>>where
Self: DeserializeOwned + Sized + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
fn injection<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( client: &'life0 Client, app_name: &'life1 str, unique_app_key: &'life2 str, collection_name: &'life3 str, model_json: &'life4 mut Value, fields_name: &'life5 Vec<String> ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + 'async_trait>>where Self: DeserializeOwned + Sized + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait,
Enrich field type map with values for dynamic fields type.