pub struct Task { /* private fields */ }
Expand description
The task
model.
Trait Implementations§
Source§impl DecodeRow<SqliteRow> for Task
impl DecodeRow<SqliteRow> for Task
Source§fn decode_row(row: &DatabaseRow) -> Result<Self, Self::Error>
fn decode_row(row: &DatabaseRow) -> Result<Self, Self::Error>
Decodes a row and attempts to create an instance of
Self
.Source§impl<'de> Deserialize<'de> for Task
impl<'de> Deserialize<'de> for Task
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Entity for Task
impl Entity for Task
Source§const PRIMARY_KEY: Self::Column = {transmute(0x00): <task::Task as zino_orm::Entity>::Column}
const PRIMARY_KEY: Self::Column = {transmute(0x00): <task::Task as zino_orm::Entity>::Column}
The primary key column.
Source§type Column = TaskColumn
type Column = TaskColumn
The column type.
Source§fn format_column(col: &Self::Column) -> String
fn format_column(col: &Self::Column) -> String
Formats the column name.
Source§impl Model for Task
impl Model for Task
Source§const MODEL_NAME: &'static str = "task"
const MODEL_NAME: &'static str = "task"
Model name.
Source§fn read_map(&mut self, data: &Map) -> Validation
fn read_map(&mut self, data: &Map) -> Validation
Updates the model using the json object and returns the validation result.
Source§fn model_name() -> &'static str
fn model_name() -> &'static str
Returns the model name.
Source§fn try_from_map(data: Map<String, Value>) -> Result<Self, Error>
fn try_from_map(data: Map<String, Value>) -> Result<Self, Error>
Attempts to construct a model from a json object.
Source§fn try_from_avro_record(data: Vec<(String, Value)>) -> Result<Self, Error>
fn try_from_avro_record(data: Vec<(String, Value)>) -> Result<Self, Error>
Attempts to construct a model from an Avro record.
Source§fn into_map(self) -> Map<String, Value>
fn into_map(self) -> Map<String, Value>
Consumes the model and returns as a json object. Read more
Source§fn into_avro_record(self) -> Vec<(String, Value)>
fn into_avro_record(self) -> Vec<(String, Value)>
Consumes the model and returns as an Avro record. Read more
Source§impl ModelAccessor<Uuid> for Task
impl ModelAccessor<Uuid> for Task
Source§fn visibility(&self) -> &str
fn visibility(&self) -> &str
Returns the
visibility
field.Source§fn description(&self) -> &str
fn description(&self) -> &str
Returns the
description
field.Source§fn created_at(&self) -> DateTime
fn created_at(&self) -> DateTime
Returns the
created_at
field.Source§fn updated_at(&self) -> DateTime
fn updated_at(&self) -> DateTime
Returns the
updated_at
field.Source§fn soft_delete_mutation(&self) -> Mutation
fn soft_delete_mutation(&self) -> Mutation
Constructs a
Mutation
for logically deleting the model.Source§fn lock_mutation(&self) -> Mutation
fn lock_mutation(&self) -> Mutation
Constructs a
Mutation
for locking the model.Source§fn archive_mutation(&self) -> Mutation
fn archive_mutation(&self) -> Mutation
Constructs a
Mutation
for archiving the model.Source§fn default_snapshot_query() -> Query
fn default_snapshot_query() -> Query
Constructs a default snapshot
Query
for the model.Source§fn default_list_query() -> Query
fn default_list_query() -> Query
Constructs a default list
Query
for the model.Source§async fn check_constraints(&self) -> Result<ZinoValidation, ZinoError>
async fn check_constraints(&self) -> Result<ZinoValidation, ZinoError>
Checks the constraints for the model.
Source§async fn fetch(query: &Query) -> Result<Vec<ZinoMap>, ZinoError>
async fn fetch(query: &Query) -> Result<Vec<ZinoMap>, ZinoError>
Fetches the data of models seleted by the
Query
.Source§async fn fetch_by_id(id: &Uuid) -> Result<ZinoMap, ZinoError>
async fn fetch_by_id(id: &Uuid) -> Result<ZinoMap, ZinoError>
Fetches the data of a model seleted by the primary key.
Source§async fn random_associations() -> Result<ZinoMap, ZinoError>
async fn random_associations() -> Result<ZinoMap, ZinoError>
Generates random associations for the model.
Source§fn deleted_at(&self) -> Option<DateTime>
fn deleted_at(&self) -> Option<DateTime>
Returns the
deleted_at
field.Source§fn has_namespace_prefix(&self, namespace: &str) -> bool
fn has_namespace_prefix(&self, namespace: &str) -> bool
Returns
true
if self
has the namespace prefix.Source§fn has_namespace_suffix(&self, namespace: &str) -> bool
fn has_namespace_suffix(&self, namespace: &str) -> bool
Returns
true
if self
has the namespace suffix.Source§fn has_visibility(&self, visibility: &str) -> bool
fn has_visibility(&self, visibility: &str) -> bool
Returns
true
if the model has the specific visibility.Source§fn is_internal(&self) -> bool
fn is_internal(&self) -> bool
Returns
true
if the visibility
is Internal
.Source§fn is_protected(&self) -> bool
fn is_protected(&self) -> bool
Returns
true
if the visibility
is Protected
.Source§fn is_private(&self) -> bool
fn is_private(&self) -> bool
Returns
true
if the visibility
is Private
.Source§fn has_status(&self, status: &str) -> bool
fn has_status(&self, status: &str) -> bool
Returns
true
if the model has the specific status.Source§fn is_inactive(&self) -> bool
fn is_inactive(&self) -> bool
Returns
true
if the status
is Inactive
.Source§fn is_deleted(&self) -> bool
fn is_deleted(&self) -> bool
Returns
true
if the status
is Deleted
.Source§fn is_archived(&self) -> bool
fn is_archived(&self) -> bool
Returns
true
if the status
is Archived
.Source§fn has_description(&self) -> bool
fn has_description(&self) -> bool
Returns
true
if the description
is nonempty.Source§fn get_extra_value(&self, key: &str) -> Option<&Value>
fn get_extra_value(&self, key: &str) -> Option<&Value>
Returns a reference to the value corresponding to the key in
extra
.Source§fn next_version(&self) -> u64
fn next_version(&self) -> u64
Returns the next version for the model.
Source§fn current_version_filters(&self) -> Map<String, Value>
fn current_version_filters(&self) -> Map<String, Value>
Constructs the query filters for the model of the current version.
Source§fn current_version_query(&self) -> Query
fn current_version_query(&self) -> Query
Constructs the
Query
for the model of the current version.Source§fn next_version_filters(&self) -> Map<String, Value>
fn next_version_filters(&self) -> Map<String, Value>
Constructs the query filters for the model of the next version.
Source§fn next_version_updates(&self) -> Map<String, Value>
fn next_version_updates(&self) -> Map<String, Value>
Constructs the mutation updates for the model of the next version.
Source§fn next_version_mutation(&self, updates: &mut Map<String, Value>) -> Mutation
fn next_version_mutation(&self, updates: &mut Map<String, Value>) -> Mutation
Constructs the
Mutation
for the model of the next version.Source§fn next_edition(&self) -> u32
fn next_edition(&self) -> u32
Returns the next edition for the model.
Source§fn current_edition_filters(&self) -> Map<String, Value>
fn current_edition_filters(&self) -> Map<String, Value>
Constructs the query filters for the model of the current edition.
Source§fn current_edition_query(&self) -> Query
fn current_edition_query(&self) -> Query
Constructs the
Query
for the model of the current edition.Source§fn next_edition_filters(&self) -> Map<String, Value>
fn next_edition_filters(&self) -> Map<String, Value>
Constructs the query filters for the model of the next edition.
Source§fn next_edition_updates(&self) -> Map<String, Value>
fn next_edition_updates(&self) -> Map<String, Value>
Constructs the mutation updates for the model of the next edition.
Source§fn next_edition_mutation(&self, updates: &mut Map<String, Value>) -> Mutation
fn next_edition_mutation(&self, updates: &mut Map<String, Value>) -> Mutation
Constructs the
Mutation
for the model of the next edition.Source§async fn soft_delete_by_id(id: &K) -> Result<(), Error>
async fn soft_delete_by_id(id: &K) -> Result<(), Error>
Deletes a model of the primary key by setting the status as
Deleted
.Source§async fn lock_by_id(id: &K) -> Result<(), Error>
async fn lock_by_id(id: &K) -> Result<(), Error>
Locks a model of the primary key by setting the status as
Locked
.Source§async fn archive_by_id(id: &K) -> Result<(), Error>
async fn archive_by_id(id: &K) -> Result<(), Error>
Archives a model of the primary key by setting the status as
Archived
.Source§impl ModelHooks for Task
impl ModelHooks for Task
Source§type Extension = UserSession<Uuid>
type Extension = UserSession<Uuid>
Extension data.
Source§async fn after_extract(&mut self, session: Self::Extension) -> Result<(), Error>
async fn after_extract(&mut self, session: Self::Extension) -> Result<(), Error>
A hook running after extracting the model data.
Source§async fn before_validation(
data: &mut Map,
extension: Option<&Self::Extension>,
) -> Result<(), Error>
async fn before_validation( data: &mut Map, extension: Option<&Self::Extension>, ) -> Result<(), Error>
A hook running before validating the model data.
Source§async fn before_extract() -> Result<(), Error>
async fn before_extract() -> Result<(), Error>
A hook running before extracting the model data.
Source§async fn after_validation(
&mut self,
_model: &mut Map<String, Value>,
) -> Result<(), Error>
async fn after_validation( &mut self, _model: &mut Map<String, Value>, ) -> Result<(), Error>
A hook running after validating the model data.
Source§async fn before_scan(query: &str) -> Result<QueryContext, Error>
async fn before_scan(query: &str) -> Result<QueryContext, Error>
A hook running before scanning the table.
Source§async fn after_scan(ctx: &QueryContext) -> Result<(), Error>
async fn after_scan(ctx: &QueryContext) -> Result<(), Error>
A hook running after scanning the table.
Source§async fn before_insert_check(
&mut self,
_extension: Option<&Self::Extension>,
) -> Result<(), Error>
async fn before_insert_check( &mut self, _extension: Option<&Self::Extension>, ) -> Result<(), Error>
A hook running before checking the constraints when inserting a model into the table.
Source§async fn before_insert(&mut self) -> Result<Self::Data, Error>
async fn before_insert(&mut self) -> Result<Self::Data, Error>
A hook running before inserting a model into the table.
Source§async fn after_insert(ctx: &QueryContext, data: Self::Data) -> Result<(), Error>
async fn after_insert(ctx: &QueryContext, data: Self::Data) -> Result<(), Error>
A hook running after inserting a model into the table.
Source§async fn before_soft_delete(&mut self) -> Result<Self::Data, Error>
async fn before_soft_delete(&mut self) -> Result<Self::Data, Error>
A hook running before logically deleting a model from the table.
Source§async fn after_soft_delete(
ctx: &QueryContext,
data: Self::Data,
) -> Result<(), Error>
async fn after_soft_delete( ctx: &QueryContext, data: Self::Data, ) -> Result<(), Error>
A hook running after logically deleting a model from the table.
Source§async fn before_lock(&mut self) -> Result<Self::Data, Error>
async fn before_lock(&mut self) -> Result<Self::Data, Error>
A hook running before locking a model in the table.
Source§async fn after_lock(ctx: &QueryContext, data: Self::Data) -> Result<(), Error>
async fn after_lock(ctx: &QueryContext, data: Self::Data) -> Result<(), Error>
A hook running after locking a model in the table.
Source§async fn before_archive(&mut self) -> Result<Self::Data, Error>
async fn before_archive(&mut self) -> Result<Self::Data, Error>
A hook running before archiving a model in the table.
Source§async fn after_archive(
ctx: &QueryContext,
data: Self::Data,
) -> Result<(), Error>
async fn after_archive( ctx: &QueryContext, data: Self::Data, ) -> Result<(), Error>
A hook running after archiving a model in the table.
Source§async fn before_update(&mut self) -> Result<Self::Data, Error>
async fn before_update(&mut self) -> Result<Self::Data, Error>
A hook running before updating a model in the table.
Source§async fn after_update(ctx: &QueryContext, data: Self::Data) -> Result<(), Error>
async fn after_update(ctx: &QueryContext, data: Self::Data) -> Result<(), Error>
A hook running after updating a model in the table.
Source§async fn before_upsert(&mut self) -> Result<Self::Data, Error>
async fn before_upsert(&mut self) -> Result<Self::Data, Error>
A hook running before updating or inserting a model into the table.
Source§async fn after_upsert(ctx: &QueryContext, data: Self::Data) -> Result<(), Error>
async fn after_upsert(ctx: &QueryContext, data: Self::Data) -> Result<(), Error>
A hook running after updating or inserting a model into the table.
Source§async fn before_save(&mut self) -> Result<Self::Data, Error>
async fn before_save(&mut self) -> Result<Self::Data, Error>
A hook running before saving a model into the table.
Source§async fn after_save(ctx: &QueryContext, _data: Self::Data) -> Result<(), Error>
async fn after_save(ctx: &QueryContext, _data: Self::Data) -> Result<(), Error>
A hook running after saving a model into the table.
Source§async fn before_delete(&mut self) -> Result<Self::Data, Error>
async fn before_delete(&mut self) -> Result<Self::Data, Error>
A hook running before deleting a model from the table.
Source§async fn after_delete(
self,
ctx: &QueryContext,
_data: Self::Data,
) -> Result<(), Error>
async fn after_delete( self, ctx: &QueryContext, _data: Self::Data, ) -> Result<(), Error>
A hook running after deleting a model from the table.
Source§async fn before_count(_query: &Query) -> Result<(), Error>
async fn before_count(_query: &Query) -> Result<(), Error>
A hook running before counting the models in the table.
Source§async fn after_count(ctx: &QueryContext) -> Result<(), Error>
async fn after_count(ctx: &QueryContext) -> Result<(), Error>
A hook running after counting the models in the table.
Source§async fn before_aggregate(_query: &Query) -> Result<(), Error>
async fn before_aggregate(_query: &Query) -> Result<(), Error>
A hook running before aggregating the models in the table.
Source§async fn after_aggregate(ctx: &QueryContext) -> Result<(), Error>
async fn after_aggregate(ctx: &QueryContext) -> Result<(), Error>
A hook running after aggregating the models in the table.
Source§async fn before_query(_query: &Query) -> Result<(), Error>
async fn before_query(_query: &Query) -> Result<(), Error>
A hook running before selecting the models with a
Query
from the table.Source§async fn after_query(ctx: &QueryContext) -> Result<(), Error>
async fn after_query(ctx: &QueryContext) -> Result<(), Error>
A hook running after selecting the models with a
Query
from the table.Source§async fn before_mutation(
_query: &Query,
_mutation: &mut Mutation,
) -> Result<(), Error>
async fn before_mutation( _query: &Query, _mutation: &mut Mutation, ) -> Result<(), Error>
A hook running before updating the models with a
Mutation
in the table.Source§async fn after_mutation(ctx: &QueryContext) -> Result<(), Error>
async fn after_mutation(ctx: &QueryContext) -> Result<(), Error>
A hook running after updating the models with a
Mutation
in the table.Source§async fn before_list(
_query: &mut Query,
_extension: Option<&Self::Extension>,
) -> Result<(), Error>
async fn before_list( _query: &mut Query, _extension: Option<&Self::Extension>, ) -> Result<(), Error>
A hook running before listing the models with a
Query
from the table.Source§async fn before_batch_delete(
_query: &mut Query,
_extension: Option<&Self::Extension>,
) -> Result<(), Error>
async fn before_batch_delete( _query: &mut Query, _extension: Option<&Self::Extension>, ) -> Result<(), Error>
A hook running before batch deleting the models with a
Query
from the table.Source§async fn after_decode(_model: &mut Map<String, Value>) -> Result<(), Error>
async fn after_decode(_model: &mut Map<String, Value>) -> Result<(), Error>
A hook running after decoding the model as a
Map
.Source§async fn before_respond(
_model: &mut Map<String, Value>,
_extension: Option<&Self::Extension>,
) -> Result<(), Error>
async fn before_respond( _model: &mut Map<String, Value>, _extension: Option<&Self::Extension>, ) -> Result<(), Error>
A hook running before returning the model data as a HTTP response.
Source§impl Schema for Task
impl Schema for Task
Source§const PRIMARY_KEY_NAME: &'static str = "id"
const PRIMARY_KEY_NAME: &'static str = "id"
Primary key name.
Source§const READER_NAME: &'static str = "main"
const READER_NAME: &'static str = "main"
Reader name.
Source§const WRITER_NAME: &'static str = "main"
const WRITER_NAME: &'static str = "main"
Writer name.
Source§const TABLE_NAME: Option<&'static str> = None
const TABLE_NAME: Option<&'static str> = None
Optional custom table name.
Source§type PrimaryKey = Uuid
type PrimaryKey = Uuid
Primary key.
Source§fn primary_key(&self) -> &Self::PrimaryKey
fn primary_key(&self) -> &Self::PrimaryKey
Returns the primary key.
Source§fn primary_key_value(&self) -> JsonValue
fn primary_key_value(&self) -> JsonValue
Returns the primary key as a JSON value.
Source§fn primary_key_column() -> &'static Column<'static>
fn primary_key_column() -> &'static Column<'static>
Returns the primary key column.
Source§fn read_only_fields() -> &'static [&'static str]
fn read_only_fields() -> &'static [&'static str]
Returns a reference to the read-only column fields.
Source§fn write_only_fields() -> &'static [&'static str]
fn write_only_fields() -> &'static [&'static str]
Returns a reference to the write-only column fields.
Source§async fn acquire_reader() -> Result<&'static ConnectionPool, ZinoError>
async fn acquire_reader() -> Result<&'static ConnectionPool, ZinoError>
Retrieves a connection pool for the model reader.
Source§async fn acquire_writer() -> Result<&'static ConnectionPool, ZinoError>
async fn acquire_writer() -> Result<&'static ConnectionPool, ZinoError>
Retrieves a connection pool for the model writer.
Source§fn table_name() -> &'static str
fn table_name() -> &'static str
Returns the table name.
Source§fn model_namespace() -> &'static str
fn model_namespace() -> &'static str
Returns the model namespace.
Source§fn driver_name() -> &'static str
fn driver_name() -> &'static str
Returns the driver name. Read more
Source§fn table_prefix() -> &'static str
fn table_prefix() -> &'static str
Returns the prefix for the table name.
Source§fn namespace_prefix() -> &'static str
fn namespace_prefix() -> &'static str
Returns the prefix for the model namespace.
Source§fn get_writable_column(key: &str) -> Option<&Column<'static>>
fn get_writable_column(key: &str) -> Option<&Column<'static>>
Gets a column for the field if it is writable.
Source§fn has_column(key: &str) -> bool
fn has_column(key: &str) -> bool
Returns
true
if the model has a column for the specific field.Source§fn default_query() -> Query
fn default_query() -> Query
Constructs a default
Query
for the model.Source§fn default_mutation() -> Mutation
fn default_mutation() -> Mutation
Constructs a default
Mutation
for the model.Source§fn init_reader() -> Result<&'static ConnectionPool, Error>
fn init_reader() -> Result<&'static ConnectionPool, Error>
Initializes the model reader.
Source§fn init_writer() -> Result<&'static ConnectionPool, Error>
fn init_writer() -> Result<&'static ConnectionPool, Error>
Initializes the model writer.
Source§async fn synchronize_schema() -> Result<(), Error>
async fn synchronize_schema() -> Result<(), Error>
Synchronizes the table schema for the model.
Source§async fn prepare_insert(self) -> Result<QueryContext, Error>
async fn prepare_insert(self) -> Result<QueryContext, Error>
Prepares the SQL to insert the model into the table.
Source§async fn prepare_insert_many(models: Vec<Self>) -> Result<QueryContext, Error>
async fn prepare_insert_many(models: Vec<Self>) -> Result<QueryContext, Error>
Prepares the SQL to insert many models into the table.
Source§async fn insert_many(models: Vec<Self>) -> Result<QueryContext, Error>
async fn insert_many(models: Vec<Self>) -> Result<QueryContext, Error>
Inserts many models into the table.
Source§async fn prepare_insert_from_subquery<C, E>(
columns: &[C],
subquery: QueryBuilder<E>,
) -> Result<QueryContext, Error>
async fn prepare_insert_from_subquery<C, E>( columns: &[C], subquery: QueryBuilder<E>, ) -> Result<QueryContext, Error>
Prepares the SQL to insert models selected by a subquery.
Source§async fn insert_from_subquery<C, E>(
columns: &[C],
subquery: QueryBuilder<E>,
) -> Result<QueryContext, Error>
async fn insert_from_subquery<C, E>( columns: &[C], subquery: QueryBuilder<E>, ) -> Result<QueryContext, Error>
Inserts the models selected by a subquery.
Source§async fn prepare_update(self) -> Result<QueryContext, Error>
async fn prepare_update(self) -> Result<QueryContext, Error>
Prepares the SQL to update the model in the table.
Source§async fn prepare_update_partial<C>(
self,
columns: &[C],
) -> Result<QueryContext, Error>
async fn prepare_update_partial<C>( self, columns: &[C], ) -> Result<QueryContext, Error>
Prepares the SQL to update the model for partial columns in the table.
Source§async fn update_partial<C>(self, columns: &[C]) -> Result<QueryContext, Error>
async fn update_partial<C>(self, columns: &[C]) -> Result<QueryContext, Error>
Updates the model for partial columns in the table.
Source§async fn prepare_update_one(
query: &Query,
mutation: &mut Mutation,
) -> Result<QueryContext, Error>
async fn prepare_update_one( query: &Query, mutation: &mut Mutation, ) -> Result<QueryContext, Error>
Prepares the SQL to update at most one model selected by the query in the table.
Source§async fn update_one(
query: &Query,
mutation: &mut Mutation,
) -> Result<QueryContext, Error>
async fn update_one( query: &Query, mutation: &mut Mutation, ) -> Result<QueryContext, Error>
Updates at most one model selected by the query in the table.
Source§async fn prepare_update_many(
query: &Query,
mutation: &mut Mutation,
) -> Result<QueryContext, Error>
async fn prepare_update_many( query: &Query, mutation: &mut Mutation, ) -> Result<QueryContext, Error>
Prepares the SQL to update many models selected by the query in the table.
Source§async fn update_many(
query: &Query,
mutation: &mut Mutation,
) -> Result<QueryContext, Error>
async fn update_many( query: &Query, mutation: &mut Mutation, ) -> Result<QueryContext, Error>
Updates many models selected by the query in the table.
Source§async fn prepare_upsert(self) -> Result<QueryContext, Error>
async fn prepare_upsert(self) -> Result<QueryContext, Error>
Prepares the SQL to update or insert the model into the table.
Source§async fn upsert(self) -> Result<QueryContext, Error>
async fn upsert(self) -> Result<QueryContext, Error>
Updates or inserts the model into the table.
Source§async fn prepare_delete() -> Result<QueryContext, Error>
async fn prepare_delete() -> Result<QueryContext, Error>
Prepares the SQL to delete the model in the table.
Source§async fn prepare_delete_one(query: &Query) -> Result<QueryContext, Error>
async fn prepare_delete_one(query: &Query) -> Result<QueryContext, Error>
Prepares the SQL to delete at most one model selected by the query in the table.
Source§async fn delete_one(query: &Query) -> Result<QueryContext, Error>
async fn delete_one(query: &Query) -> Result<QueryContext, Error>
Deletes at most one model selected by the query in the table.
Source§async fn prepare_delete_many(query: &Query) -> Result<QueryContext, Error>
async fn prepare_delete_many(query: &Query) -> Result<QueryContext, Error>
Prepares the SQL to delete many models selected by the query in the table.
Source§async fn delete_many(query: &Query) -> Result<QueryContext, Error>
async fn delete_many(query: &Query) -> Result<QueryContext, Error>
Deletes many models selected by the query in the table.
Source§async fn prepare_delete_by_subquery<C, E>(
columns: &[C],
subquery: QueryBuilder<E>,
) -> Result<QueryContext, Error>
async fn prepare_delete_by_subquery<C, E>( columns: &[C], subquery: QueryBuilder<E>, ) -> Result<QueryContext, Error>
Prepares the SQL to delete models selected by a subquery.
Source§async fn delete_by_subquery<C, E>(
columns: &[C],
subquery: QueryBuilder<E>,
) -> Result<QueryContext, Error>
async fn delete_by_subquery<C, E>( columns: &[C], subquery: QueryBuilder<E>, ) -> Result<QueryContext, Error>
Deletes the models selected by a subquery.
Source§async fn find<T>(query: &Query) -> Result<Vec<T>, Error>
async fn find<T>(query: &Query) -> Result<Vec<T>, Error>
Finds a list of models selected by the query in the table,
and decodes it as
Vec<T>
.Source§async fn find_as<T>(query: &Query) -> Result<Vec<T>, Error>where
T: DeserializeOwned,
async fn find_as<T>(query: &Query) -> Result<Vec<T>, Error>where
T: DeserializeOwned,
Finds a list of models selected by the query in the table,
and parses it as
Vec<T>
.Source§async fn find_one<T>(query: &Query) -> Result<Option<T>, Error>
async fn find_one<T>(query: &Query) -> Result<Option<T>, Error>
Finds one model selected by the query in the table,
and decodes it as an instance of type
T
.Source§async fn find_one_as<T>(query: &Query) -> Result<Option<T>, Error>where
T: DeserializeOwned,
async fn find_one_as<T>(query: &Query) -> Result<Option<T>, Error>where
T: DeserializeOwned,
Finds one model selected by the query in the table,
and parses it as an instance of type
T
.Source§async fn populate<C>(
query: &mut Query,
data: &mut Vec<Map<String, Value>>,
columns: &[C],
) -> Result<u64, Error>
async fn populate<C>( query: &mut Query, data: &mut Vec<Map<String, Value>>, columns: &[C], ) -> Result<u64, Error>
Populates the related data in the corresponding
columns
for Vec<Map>
using
a merged select on the primary key, which solves the N+1
problem.Source§async fn populate_one<C>(
query: &mut Query,
data: &mut Map<String, Value>,
columns: &[C],
) -> Result<(), Error>
async fn populate_one<C>( query: &mut Query, data: &mut Map<String, Value>, columns: &[C], ) -> Result<(), Error>
Populates the related data in the corresponding
columns
for Map
using
a merged select on the primary key, which solves the N+1
problem.Source§async fn lookup<M, T>(
query: &Query,
join_on: &JoinOn<Self, M>,
) -> Result<Vec<T>, Error>
async fn lookup<M, T>( query: &Query, join_on: &JoinOn<Self, M>, ) -> Result<Vec<T>, Error>
Performs a join to another table to filter rows in the “joined” table,
and decodes it as
Vec<T>
.Source§async fn lookup_as<M, T>(
query: &Query,
join_on: &JoinOn<Self, M>,
) -> Result<Vec<T>, Error>where
M: Schema,
T: DeserializeOwned,
async fn lookup_as<M, T>(
query: &Query,
join_on: &JoinOn<Self, M>,
) -> Result<Vec<T>, Error>where
M: Schema,
T: DeserializeOwned,
Performs a join to another table to filter rows in the “joined” table,
and parses it as
Vec<T>
.Source§async fn exists(query: &Query) -> Result<bool, Error>
async fn exists(query: &Query) -> Result<bool, Error>
Checks whether there is a model selected by the query in the table.
Source§async fn count(query: &Query) -> Result<u64, Error>
async fn count(query: &Query) -> Result<u64, Error>
Counts the number of rows selected by the query in the table.
Source§async fn count_many<C, T>(
query: &Query,
columns: &[(C, bool)],
) -> Result<T, Error>
async fn count_many<C, T>( query: &Query, columns: &[(C, bool)], ) -> Result<T, Error>
Counts the number of rows selected by the query in the table.
The boolean value determines whether it only counts distinct values or not.
Source§async fn count_many_as<C, T>(
query: &Query,
columns: &[(C, bool)],
) -> Result<T, Error>
async fn count_many_as<C, T>( query: &Query, columns: &[(C, bool)], ) -> Result<T, Error>
Counts the number of rows selected by the query in the table,
and parses it as an instance of type
T
.Source§async fn aggregate<T>(query: &Query) -> Result<Vec<T>, Error>
async fn aggregate<T>(query: &Query) -> Result<Vec<T>, Error>
Aggregates the rows selected by the query in the table.
Source§async fn aggregate_as<T>(query: &Query) -> Result<Vec<T>, Error>where
T: DeserializeOwned,
async fn aggregate_as<T>(query: &Query) -> Result<Vec<T>, Error>where
T: DeserializeOwned,
Aggregates the rows selected by the query in the table,
and parses it as an instance of type
T
.Source§async fn execute(
query: &str,
params: Option<&Map<String, Value>>,
) -> Result<QueryContext, Error>
async fn execute( query: &str, params: Option<&Map<String, Value>>, ) -> Result<QueryContext, Error>
Executes the query in the table, and returns the total number of rows affected.
Source§async fn query<T>(
query: &str,
params: Option<&Map<String, Value>>,
) -> Result<Vec<T>, Error>
async fn query<T>( query: &str, params: Option<&Map<String, Value>>, ) -> Result<Vec<T>, Error>
Executes the query in the table, and decodes it as
Vec<T>
.Source§async fn query_as<T>(
query: &str,
params: Option<&Map<String, Value>>,
) -> Result<Vec<T>, Error>where
T: DeserializeOwned,
async fn query_as<T>(
query: &str,
params: Option<&Map<String, Value>>,
) -> Result<Vec<T>, Error>where
T: DeserializeOwned,
Executes the query in the table, and parses it as
Vec<T>
.Source§async fn query_one<T>(
query: &str,
params: Option<&Map<String, Value>>,
) -> Result<Option<T>, Error>
async fn query_one<T>( query: &str, params: Option<&Map<String, Value>>, ) -> Result<Option<T>, Error>
Executes the query in the table, and decodes it as an instance of type
T
.Source§async fn query_one_as<T>(
query: &str,
params: Option<&Map<String, Value>>,
) -> Result<Option<T>, Error>where
T: DeserializeOwned,
async fn query_one_as<T>(
query: &str,
params: Option<&Map<String, Value>>,
) -> Result<Option<T>, Error>where
T: DeserializeOwned,
Executes the query in the table, and parses it as an instance of type
T
.Source§async fn prepare_delete_by_id() -> Result<QueryContext, Error>
async fn prepare_delete_by_id() -> Result<QueryContext, Error>
Prepares the SQL to delete a model selected by the primary key in the table.
Source§async fn delete_by_id(
primary_key: &Self::PrimaryKey,
) -> Result<QueryContext, Error>
async fn delete_by_id( primary_key: &Self::PrimaryKey, ) -> Result<QueryContext, Error>
Deletes a model selected by the primary key in the table.
Source§async fn prepare_update_by_id(
mutation: &mut Mutation,
) -> Result<QueryContext, Error>
async fn prepare_update_by_id( mutation: &mut Mutation, ) -> Result<QueryContext, Error>
Prepares the SQL to update a model selected by the primary key in the table.
Source§async fn update_by_id<T>(
primary_key: &Self::PrimaryKey,
mutation: &mut Mutation,
) -> Result<Option<T>, Error>
async fn update_by_id<T>( primary_key: &Self::PrimaryKey, mutation: &mut Mutation, ) -> Result<Option<T>, Error>
Updates a model selected by the primary key in the table,
and decodes it as an instance of type
T
.Source§async fn find_by_id<T>(
primary_key: &Self::PrimaryKey,
) -> Result<Option<T>, Error>
async fn find_by_id<T>( primary_key: &Self::PrimaryKey, ) -> Result<Option<T>, Error>
Finds a model selected by the primary key in the table,
and decodes it as an instance of type
T
.Source§async fn try_get_model(primary_key: &Self::PrimaryKey) -> Result<Self, Error>
async fn try_get_model(primary_key: &Self::PrimaryKey) -> Result<Self, Error>
Finds a model selected by the primary key in the table, and parses it as
Self
.Source§async fn sample(size: usize) -> Result<Vec<Value>, Error>
async fn sample(size: usize) -> Result<Vec<Value>, Error>
Randomly selects the specified number of models from the table
and returns a list of the primary key values.
impl Eq for Task
Auto Trait Implementations§
impl Freeze for Task
impl RefUnwindSafe for Task
impl Send for Task
impl Sync for Task
impl Unpin for Task
impl UnwindSafe for Task
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<M, K> ModelHelper<K> for M
impl<M, K> ModelHelper<K> for M
Source§fn secret_key() -> &'static [u8] ⓘ
fn secret_key() -> &'static [u8] ⓘ
Returns the secret key for the model.
It should have at least 64 bytes. Read more
Source§fn encrypt_password(password: &str) -> Result<String, Error>
fn encrypt_password(password: &str) -> Result<String, Error>
Encrypts the password for the model.
Source§impl<M, K> ScalarQuery<K> for M
impl<M, K> ScalarQuery<K> for M
Source§async fn find_scalar<T>(query: &Query) -> Result<T, Error>
async fn find_scalar<T>(query: &Query) -> Result<T, Error>
Finds a value selected by the query in the table,
and decodes it as a single concrete type
T
.Source§async fn find_scalars<T>(query: &Query) -> Result<Vec<T>, Error>
async fn find_scalars<T>(query: &Query) -> Result<Vec<T>, Error>
Finds a list of scalar values selected by the query in the table,
and decodes it as a
Vec<T>
.Source§async fn find_distinct_scalars<T>(query: &Query) -> Result<Vec<T>, Error>
async fn find_distinct_scalars<T>(query: &Query) -> Result<Vec<T>, Error>
Finds a list of distinct scalar values selected by the query in the table,
and decodes it as a
Vec<T>
.Source§async fn query_scalar<T>(
query: &str,
params: Option<&Map<String, Value>>,
) -> Result<T, Error>
async fn query_scalar<T>( query: &str, params: Option<&Map<String, Value>>, ) -> Result<T, Error>
Executes the query in the table, and decodes it as a single concrete type
T
.Source§async fn query_scalars<T>(
query: &str,
params: Option<&Map<String, Value>>,
) -> Result<Vec<T>, Error>
async fn query_scalars<T>( query: &str, params: Option<&Map<String, Value>>, ) -> Result<Vec<T>, Error>
Executes the query in the table, and decodes the scalar values as
Vec<T>
.Source§async fn find_scalar_by_id<C, T>(
primary_key: &Self::PrimaryKey,
column: C,
) -> Result<T, Error>
async fn find_scalar_by_id<C, T>( primary_key: &Self::PrimaryKey, column: C, ) -> Result<T, Error>
Finds a model selected by the primary key in the table,
and decodes the column value as a single concrete type
T
.Source§impl<'c, M, K> Transaction<K, Transaction<'c, Sqlite>> for M
impl<'c, M, K> Transaction<K, Transaction<'c, Sqlite>> for M
Source§async fn transaction<F, T>(tx: F) -> Result<T, Error>
async fn transaction<F, T>(tx: F) -> Result<T, Error>
Executes the specific operations inside of a transaction.
If the operations return an error, the transaction will be rolled back;
if not, the transaction will be committed.
Source§async fn transactional_execute(
queries: &[&str],
params: Option<&Map<String, Value>>,
) -> Result<u64, Error>
async fn transactional_execute( queries: &[&str], params: Option<&Map<String, Value>>, ) -> Result<u64, Error>
Executes the queries sequentially inside of a transaction.
If it returns an error, the transaction will be rolled back;
if not, the transaction will be committed.
Source§async fn transactional_insert<S>(
self,
associations: Vec<S>,
) -> Result<u64, Error>where
S: Schema,
async fn transactional_insert<S>(
self,
associations: Vec<S>,
) -> Result<u64, Error>where
S: Schema,
Inserts the model and its associations inside of a transaction.