pub trait ScalarQuery<K>: Schema<PrimaryKey = K>{
// Provided methods
async fn find_scalar<T>(query: &Query) -> Result<T, Error>
where T: Send + Unpin + Type<DatabaseDriver> + for<'r> Decode<'r, DatabaseDriver> { ... }
async fn find_scalars<T>(query: &Query) -> Result<Vec<T>, Error>
where T: Send + Unpin + Type<DatabaseDriver> + for<'r> Decode<'r, DatabaseDriver> { ... }
async fn find_distinct_scalars<T>(query: &Query) -> Result<Vec<T>, Error>
where T: Send + Unpin + Type<DatabaseDriver> + for<'r> Decode<'r, DatabaseDriver> { ... }
async fn query_scalar<T>(
query: &str,
params: Option<&Map>,
) -> Result<T, Error>
where T: Send + Unpin + Type<DatabaseDriver> + for<'r> Decode<'r, DatabaseDriver> { ... }
async fn query_scalars<T>(
query: &str,
params: Option<&Map>,
) -> Result<Vec<T>, Error>
where T: Send + Unpin + Type<DatabaseDriver> + for<'r> Decode<'r, DatabaseDriver> { ... }
async fn find_scalar_by_id<C, T>(
primary_key: &Self::PrimaryKey,
column: C,
) -> Result<T, Error>
where C: AsRef<str>,
T: Send + Unpin + Type<DatabaseDriver> + for<'r> Decode<'r, DatabaseDriver> { ... }
async fn find_primary_key(query: &Query) -> Result<K, Error>
where K: Send + Unpin + Type<DatabaseDriver> + for<'r> Decode<'r, DatabaseDriver> { ... }
async fn find_primary_keys(query: &Query) -> Result<Vec<K>, Error>
where K: Send + Unpin + Type<DatabaseDriver> + for<'r> Decode<'r, DatabaseDriver> { ... }
}
orm-sqlx
only.Expand description
Query on scalar values.
Provided Methods§
Sourceasync 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
.
Sourceasync 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>
.
Sourceasync 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>
.
Sourceasync fn query_scalar<T>(query: &str, params: Option<&Map>) -> Result<T, Error>
async fn query_scalar<T>(query: &str, params: Option<&Map>) -> Result<T, Error>
Executes the query in the table, and decodes it as a single concrete type T
.
Sourceasync fn query_scalars<T>(
query: &str,
params: Option<&Map>,
) -> Result<Vec<T>, Error>
async fn query_scalars<T>( query: &str, params: Option<&Map>, ) -> Result<Vec<T>, Error>
Executes the query in the table, and decodes the scalar values as Vec<T>
.
Sourceasync 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
.
Sourceasync fn find_primary_key(query: &Query) -> Result<K, Error>
async fn find_primary_key(query: &Query) -> Result<K, Error>
Finds a primary key selected by the query in the table.
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.