[][src]Trait gosh_database::prelude::Collection

pub trait Collection where
    Self: Serialize + DeserializeOwned
{ fn collection_name() -> String; fn put_into_collection(
        &self,
        db: &DbConnection,
        new_key: &str
    ) -> Result<()> { ... }
fn get_from_collection(db: &DbConnection, obj_key: &str) -> Result<Self> { ... }
fn del_from_collection(db: &DbConnection, obj_key: &str) -> Result<()> { ... }
fn remove_collection(db: &DbConnection) -> Result<()> { ... }
fn list_collection(db: &DbConnection) -> Result<Vec<Self>> { ... }
fn collection_size(db: &DbConnection) -> Result<i64> { ... } }

Required methods

fn collection_name() -> String

Return an unique name as the container for your data.

Loading content...

Provided methods

fn put_into_collection(&self, db: &DbConnection, new_key: &str) -> Result<()>

Put self into collection.

fn get_from_collection(db: &DbConnection, obj_key: &str) -> Result<Self>

Return the object in this collection by key.

fn del_from_collection(db: &DbConnection, obj_key: &str) -> Result<()>

Delete the object in this collection by key.

fn remove_collection(db: &DbConnection) -> Result<()>

Remove all objects in this collection.

fn list_collection(db: &DbConnection) -> Result<Vec<Self>>

List all items in the collection.

fn collection_size(db: &DbConnection) -> Result<i64>

Return the number of items in collection.

Loading content...

Implementors

Loading content...