zino_orm

Trait ModelHelper

Source
pub trait ModelHelper<K>: Schema<PrimaryKey = K>
where K: Default + Display + PartialEq,
{ // Provided methods fn secret_key() -> &'static [u8] { ... } fn encrypt_password(password: &str) -> Result<String, Error> { ... } fn verify_password( password: &str, encrypted_password: &str, ) -> Result<bool, Error> { ... } fn translate_model(model: &mut Map) { ... } }
Expand description

Helper utilities for models.

Provided Methods§

Source

fn secret_key() -> &'static [u8]

Returns the secret key for the model. It should have at least 64 bytes.

§Note

This should only be used for internal services. Do not expose it to external users.

Source

fn encrypt_password(password: &str) -> Result<String, Error>

Encrypts the password for the model.

Source

fn verify_password( password: &str, encrypted_password: &str, ) -> Result<bool, Error>

Verifies the password for the model.

Source

fn translate_model(model: &mut Map)

Translates the model data.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<M, K> ModelHelper<K> for M
where M: Schema<PrimaryKey = K>, K: Default + Display + PartialEq,