pub struct SchemaTable<'a> { /* private fields */ }Expand description
Validated logical table bound to the merged auth schema.
Use this handle to validate field names and map adapter records back to
logical keys. Execute queries with the normal adapter types
(FindOne, Create, …) using
SchemaTable::model.
Implementations§
Source§impl<'a> SchemaTable<'a>
impl<'a> SchemaTable<'a>
pub fn new( schema: &'a DbSchema, logical_name: &str, ) -> Result<Self, RustAuthError>
pub fn logical_name(&self) -> &str
pub fn physical_name(&self) -> Result<&str, RustAuthError>
pub fn create(&self) -> Create
Sourcepub fn where_eq(
&self,
field: &str,
value: DbValue,
) -> Result<Where, RustAuthError>
pub fn where_eq( &self, field: &str, value: DbValue, ) -> Result<Where, RustAuthError>
Build a predicate on a logical field name (defaults to equality).
Sourcepub fn where_op(
&self,
field: &str,
operator: WhereOperator,
value: DbValue,
) -> Result<Where, RustAuthError>
pub fn where_op( &self, field: &str, operator: WhereOperator, value: DbValue, ) -> Result<Where, RustAuthError>
Build a predicate on a logical field name with an explicit operator.
pub fn sort_by( &self, field: &str, direction: SortDirection, ) -> Result<Sort, RustAuthError>
Sourcepub fn ensure_field(&self, logical_field: &str) -> Result<(), RustAuthError>
pub fn ensure_field(&self, logical_field: &str) -> Result<(), RustAuthError>
Validate logical field names exist in the schema.
pub fn ensure_fields<const N: usize>( &self, fields: [&str; N], ) -> Result<(), RustAuthError>
Sourcepub fn with_data(
&self,
create: Create,
field: &str,
value: DbValue,
) -> Result<Create, RustAuthError>
pub fn with_data( &self, create: Create, field: &str, value: DbValue, ) -> Result<Create, RustAuthError>
Attach a column value to a create builder using a logical field name.
Sourcepub fn with_update_data(
&self,
update: Update,
field: &str,
value: DbValue,
) -> Result<Update, RustAuthError>
pub fn with_update_data( &self, update: Update, field: &str, value: DbValue, ) -> Result<Update, RustAuthError>
Attach a column value to an update builder using a logical field name.
Sourcepub fn map_record(&self, record: DbRecord) -> Result<DbRecord, RustAuthError>
pub fn map_record(&self, record: DbRecord) -> Result<DbRecord, RustAuthError>
Map a database record’s physical column keys to logical field names.
Trait Implementations§
Source§impl<'a> Clone for SchemaTable<'a>
impl<'a> Clone for SchemaTable<'a>
Source§fn clone(&self) -> SchemaTable<'a>
fn clone(&self) -> SchemaTable<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<'a> Freeze for SchemaTable<'a>
impl<'a> RefUnwindSafe for SchemaTable<'a>
impl<'a> Send for SchemaTable<'a>
impl<'a> Sync for SchemaTable<'a>
impl<'a> Unpin for SchemaTable<'a>
impl<'a> UnsafeUnpin for SchemaTable<'a>
impl<'a> UnwindSafe for SchemaTable<'a>
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