Trait green_barrel::models::caching::Caching
source · pub trait Caching: Main + Converters {
// Provided methods
fn caching<'life0, 'async_trait>(
client: &'life0 Client
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + 'async_trait>>
where Self: Serialize + DeserializeOwned + Sized + 'async_trait,
'life0: 'async_trait { ... }
fn get_choice_maps(
model_json: &Value,
field_type_map: &HashMap<String, String>
) -> Result<(HashMap<String, Vec<String>>, HashMap<String, Vec<i32>>, HashMap<String, Vec<i64>>, HashMap<String, Vec<f64>>), Box<dyn Error>> { ... }
fn new<'async_trait>(
) -> Pin<Box<dyn Future<Output = Result<Self, Box<dyn Error>>> + 'async_trait>>
where Self: Serialize + DeserializeOwned + Sized + 'async_trait { ... }
fn json<'async_trait>(
) -> Pin<Box<dyn Future<Output = Result<String, Box<dyn Error>>> + 'async_trait>>
where Self: 'async_trait { ... }
fn update_dyn_field<'life0, 'async_trait>(
client: &'life0 Client,
dyn_data: Value
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + 'async_trait>>
where Self: Serialize + DeserializeOwned + Sized + 'async_trait,
'life0: 'async_trait { ... }
}
Expand description
Caching inmodelation about Models for speed up work.
Provided Methods§
sourcefn caching<'life0, 'async_trait>(
client: &'life0 Client
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + 'async_trait>>where
Self: Serialize + DeserializeOwned + Sized + 'async_trait,
'life0: 'async_trait,
fn caching<'life0, 'async_trait>( client: &'life0 Client ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + 'async_trait>>where Self: Serialize + DeserializeOwned + Sized + 'async_trait, 'life0: 'async_trait,
Add metadata to cache.
sourcefn get_choice_maps(
model_json: &Value,
field_type_map: &HashMap<String, String>
) -> Result<(HashMap<String, Vec<String>>, HashMap<String, Vec<i32>>, HashMap<String, Vec<i64>>, HashMap<String, Vec<f64>>), Box<dyn Error>>
fn get_choice_maps( model_json: &Value, field_type_map: &HashMap<String, String> ) -> Result<(HashMap<String, Vec<String>>, HashMap<String, Vec<i32>>, HashMap<String, Vec<i64>>, HashMap<String, Vec<f64>>), Box<dyn Error>>
Get choice maps for fields type choice
.
sourcefn new<'async_trait>(
) -> Pin<Box<dyn Future<Output = Result<Self, Box<dyn Error>>> + 'async_trait>>where
Self: Serialize + DeserializeOwned + Sized + 'async_trait,
fn new<'async_trait>( ) -> Pin<Box<dyn Future<Output = Result<Self, Box<dyn Error>>> + 'async_trait>>where Self: Serialize + DeserializeOwned + Sized + 'async_trait,
Get a new model instance with custom settings.
Example:
let user = User::new().await?;
user.username.set("user");
user.email.set("user_1_@noreply.net");
user.password.set("12345678");
user.confirm_password.set("12345678");
user.is_staff.set(true);
user.is_active.set(true);
println!("{:#?}", user);
sourcefn json<'async_trait>(
) -> Pin<Box<dyn Future<Output = Result<String, Box<dyn Error>>> + 'async_trait>>where
Self: 'async_trait,
fn json<'async_trait>( ) -> Pin<Box<dyn Future<Output = Result<String, Box<dyn Error>>> + 'async_trait>>where Self: 'async_trait,
Get field attributes in Json modelat for page templates.
Example:
let json_line = User::json().await?;
println!("{json_line}");
sourcefn update_dyn_field<'life0, 'async_trait>(
client: &'life0 Client,
dyn_data: Value
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + 'async_trait>>where
Self: Serialize + DeserializeOwned + Sized + 'async_trait,
'life0: 'async_trait,
fn update_dyn_field<'life0, 'async_trait>( client: &'life0 Client, dyn_data: Value ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + 'async_trait>>where Self: Serialize + DeserializeOwned + Sized + 'async_trait, 'life0: 'async_trait,
Update data for dynamic fields. A more convenient use of these types of fields is implemented in the Green Panel project: https://github.com/kebasyaty/green-panel
Example:
let dyn_data = json!({ “field_name”: “field_name”, “value”: 5, “title”: “Title”, “is_delete”: false }); assert!(User::update_dyn_field(&client, dyn_data).await.is_ok());