pub trait DeviceModel: Sync {
// Required methods
fn init<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn StdError>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn count<'life0, 'life1, 'async_trait>(
&'life0 self,
cond: &'life1 ListQueryCond<'_>,
) -> Pin<Box<dyn Future<Output = Result<u64, Box<dyn StdError>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
opts: &'life1 ListOptions<'_>,
cursor: Option<Box<dyn Cursor>>,
) -> Pin<Box<dyn Future<Output = Result<(Vec<Device>, Option<Box<dyn Cursor>>), Box<dyn StdError>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
cond: &'life1 QueryCond<'_>,
) -> Pin<Box<dyn Future<Output = Result<Option<Device>, Box<dyn StdError>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn add<'life0, 'life1, 'async_trait>(
&'life0 self,
device: &'life1 Device,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn StdError>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn add_bulk<'life0, 'life1, 'async_trait>(
&'life0 self,
devices: &'life1 Vec<Device>,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn StdError>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn del<'life0, 'life1, 'async_trait>(
&'life0 self,
cond: &'life1 QueryCond<'_>,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn StdError>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn update<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
cond: &'life1 UpdateQueryCond<'_>,
updates: &'life2 Updates<'_>,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn StdError>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}
Expand description
Model operations.
Required Methods§
Sourcefn init<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn StdError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn init<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn StdError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
To create and initialize the table/collection.
Sourcefn count<'life0, 'life1, 'async_trait>(
&'life0 self,
cond: &'life1 ListQueryCond<'_>,
) -> Pin<Box<dyn Future<Output = Result<u64, Box<dyn StdError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn count<'life0, 'life1, 'async_trait>(
&'life0 self,
cond: &'life1 ListQueryCond<'_>,
) -> Pin<Box<dyn Future<Output = Result<u64, Box<dyn StdError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
To get item count for the query condition.
Note: this may take a long time.
Sourcefn list<'life0, 'life1, 'async_trait>(
&'life0 self,
opts: &'life1 ListOptions<'_>,
cursor: Option<Box<dyn Cursor>>,
) -> Pin<Box<dyn Future<Output = Result<(Vec<Device>, Option<Box<dyn Cursor>>), Box<dyn StdError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
opts: &'life1 ListOptions<'_>,
cursor: Option<Box<dyn Cursor>>,
) -> Pin<Box<dyn Future<Output = Result<(Vec<Device>, Option<Box<dyn Cursor>>), Box<dyn StdError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
To get item list. The maximum number of returned items will be controlled by the
cursor_max
of the list option.
For the first time, cursor
MUST use None
. If one cursor is returned, it means that
there are more items to get. Use the returned cursor to get more data items.
Note: using cursors is recommended to prevent exhausting memory.
Sourcefn get<'life0, 'life1, 'async_trait>(
&'life0 self,
cond: &'life1 QueryCond<'_>,
) -> Pin<Box<dyn Future<Output = Result<Option<Device>, Box<dyn StdError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
cond: &'life1 QueryCond<'_>,
) -> Pin<Box<dyn Future<Output = Result<Option<Device>, Box<dyn StdError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
To get an item.
Sourcefn add<'life0, 'life1, 'async_trait>(
&'life0 self,
device: &'life1 Device,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn StdError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn add<'life0, 'life1, 'async_trait>(
&'life0 self,
device: &'life1 Device,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn StdError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
To add an item.
Sourcefn add_bulk<'life0, 'life1, 'async_trait>(
&'life0 self,
devices: &'life1 Vec<Device>,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn StdError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn add_bulk<'life0, 'life1, 'async_trait>(
&'life0 self,
devices: &'life1 Vec<Device>,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn StdError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
To add items in bulk. Duplicate items will be skipped without errors.
Sourcefn del<'life0, 'life1, 'async_trait>(
&'life0 self,
cond: &'life1 QueryCond<'_>,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn StdError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn del<'life0, 'life1, 'async_trait>(
&'life0 self,
cond: &'life1 QueryCond<'_>,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn StdError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
To delete one or more items.
Sourcefn update<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
cond: &'life1 UpdateQueryCond<'_>,
updates: &'life2 Updates<'_>,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn StdError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn update<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
cond: &'life1 UpdateQueryCond<'_>,
updates: &'life2 Updates<'_>,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn StdError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
To update one or more items.