Skip to main content

AdminUser

Struct AdminUser 

Source
pub struct AdminUser {
    pub id: Uuid,
    pub email: String,
    pub password_hash: String,
    pub display_name: String,
    pub active: bool,
    pub created_at: Timestamp,
}
Expand description

Shipped credential model with unique email, Argon2id PHC hash, display name, and active flag; belongs to no tenant.

Fields§

§id: Uuid§email: String§password_hash: String

Argon2id hash in PHC string format; never stores the plaintext.

§display_name: String§active: bool

false denies login and panel access immediately.

§created_at: Timestamp

Implementations§

Source§

impl AdminUser

Source

pub fn fields() -> AdminUserFields<AdminUser>

Returns a handle used to reference AdminUser’s fields when building query expressions.

Source

pub async fn get_by_id( executor: &mut dyn Executor, id: impl IntoExpr<FieldExprTarget<Uuid>>, ) -> Result<AdminUser>

Fetches the single AdminUser where id matches, erroring if none exists.

Source

pub fn update_by_id(id: impl IntoExpr<FieldExprTarget<Uuid>>) -> AdminUserUpdate

Returns a builder that updates the AdminUser where id matches.

Source

pub async fn delete_by_id( executor: &mut dyn Executor, id: impl IntoExpr<FieldExprTarget<Uuid>>, ) -> Result<()>

Deletes the AdminUser where id matches.

Source

pub fn filter_by_id(id: impl IntoExpr<FieldExprTarget<Uuid>>) -> AdminUserQuery

Returns a query selecting the AdminUser records where id matches.

Source

pub async fn get_by_email( executor: &mut dyn Executor, email: impl IntoExpr<FieldExprTarget<String>>, ) -> Result<AdminUser>

Fetches the single AdminUser where email matches, erroring if none exists.

Source

pub fn update_by_email( email: impl IntoExpr<FieldExprTarget<String>>, ) -> AdminUserUpdate

Returns a builder that updates the AdminUser where email matches.

Source

pub async fn delete_by_email( executor: &mut dyn Executor, email: impl IntoExpr<FieldExprTarget<String>>, ) -> Result<()>

Deletes the AdminUser where email matches.

Source

pub fn filter_by_email( email: impl IntoExpr<FieldExprTarget<String>>, ) -> AdminUserQuery

Returns a query selecting the AdminUser records where email matches.

Source

pub fn create() -> AdminUserCreate

Returns a builder that inserts a new AdminUser record.

Typically constructed through the toasty::create! macro.

Source

pub fn create_many() -> CreateMany<AdminUser>

Returns a builder that inserts multiple AdminUser records at once.

Source

pub fn update(&mut self) -> AdminUserUpdate<&mut Self>

Returns a builder that updates this AdminUser record in place.

Source

pub fn all() -> AdminUserQuery

Returns a query that selects every AdminUser record.

Source

pub fn filter(expr: Expr<bool>) -> AdminUserQuery

Returns a query selecting the AdminUser records matching expr.

Source

pub fn delete(self) -> Delete<()>

Consumes this AdminUser and returns a statement that deletes its record.

Source§

impl AdminUser

Source

pub fn upsert_by_id( id: impl IntoExpr<FieldExprTarget<Uuid>>, ) -> AdminUserUpsertById

Returns a builder that creates AdminUser or updates the record whose id constraint matches.

The target arguments initialize a new record and remain unchanged when an existing record is updated.

Source§

impl AdminUser

Source

pub fn upsert_by_email( email: impl IntoExpr<FieldExprTarget<String>>, ) -> AdminUserUpsertByEmail

Returns a builder that creates AdminUser or updates the record whose email constraint matches.

The target arguments initialize a new record and remain unchanged when an existing record is updated.

Trait Implementations§

Source§

impl Assign<AdminUser> for AdminUser

Source§

fn into_assignment(self) -> Assignment<AdminUser>

Convert into an Assignment<T> value.
Source§

fn assign(self, assignments: &mut Assignments, projection: Projection)
where Self: Sized,

Record one or more assignments into the given [Assignments] map at the specified projection.
Source§

impl Clone for AdminUser

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AdminUser

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl IntoExpr<AdminUser> for AdminUser

Source§

fn into_expr(self) -> Expr<AdminUser>

Consume self and produce an Expr<T>. Read more
Source§

fn by_ref(&self) -> Expr<AdminUser>

Produce an Expr<T> from a reference without consuming self. Read more
Source§

impl IntoStatement for &AdminUser

Source§

type Returning = AdminUser

The type this statement produces when executed.
Source§

fn into_statement(self) -> Statement<AdminUser>

Consume self and produce the Statement.
Source§

impl IntoStatement for &mut AdminUser

Source§

type Returning = AdminUser

The type this statement produces when executed.
Source§

fn into_statement(self) -> Statement<AdminUser>

Consume self and produce the Statement.
Source§

impl IntoStatement for AdminUser

Source§

type Returning = AdminUser

The type this statement produces when executed.
Source§

fn into_statement(self) -> Statement<AdminUser>

Consume self and produce the Statement.
Source§

impl Load for AdminUser

Source§

type Output = AdminUser

The concrete type produced by load. Read more
Source§

fn ty() -> Type

Returns the stmt::Type that describes values of this type.
Source§

fn load(value: Value) -> Result<Self>

Deserialize a database Value into Self::Output. Read more
Source§

fn reload(target: &mut Self, value: Value) -> Result<()>

Reload the value in-place from a value returned by the database. Read more
Source§

fn ty_relation() -> Type

Returns the stmt::Type used when this type appears as a relation target. The default delegates to ty().
Source§

fn load_relation(value: Value) -> Result<Self::Output, Error>

Deserialize a value that was loaded as a relation target. Read more
Source§

impl Model for AdminUser

Source§

type Query<__T> = AdminUserQuery<__T>

Query builder for this model, parameterized by what it executes to. Read more
Source§

type Create = AdminUserCreate

Create builder type for this model
Source§

type Update<'a> = AdminUserUpdate<&'a mut AdminUser>

Update builder type for this model
Source§

type UpdateQuery = AdminUserUpdate

Update by query builder type for this model
Source§

type Path<__Origin> = AdminUserFields<__Origin>

A typed path from Origin into this model.
Source§

type PrimaryKey = Uuid

The model’s primary key type. Read more
Source§

type ManyField<__Origin> = AdminUserListFields<__Origin>

The field accessor type used when this model appears as the “many” side of a has-many relation, parameterized by the origin model.
Source§

type OneField<__Origin, __Target> = AdminUserFields<__Origin, __Target>

The field accessor for a singular relation to this model, parameterized by the origin and path target. Read more
Source§

fn id() -> ModelId

Unique identifier for this model within the schema. Read more
Source§

fn schema() -> Model

Returns the schema definition for this model.
Source§

fn register(model_set: &mut ModelSet)

Register this model and all models reachable through its fields into the given ModelSet. Read more
Source§

fn new_path<__Origin>(path: Path<__Origin, Self>) -> Self::Path<__Origin>

Construct a model path from a Path targeting this model.
Source§

fn new_many_field<__Origin>( path: Path<__Origin, List<Self>>, ) -> AdminUserListFields<__Origin>

Construct a ManyField from a path targeting a list of this model.
Source§

fn find_by_primary_key(id: Expr<Self::PrimaryKey>) -> Self::Query<List<Self>>

Build a query that filters this model by its primary key. Read more
Source§

fn wrap_query<__T>(stmt: Query<__T>) -> Self::Query<__T>

Wrap a raw statement-level Query in this model’s query builder, preserving the result shape T. This is the single constructor generic code uses to build any query shape; callers narrow at the statement level (.one(), .first()) before wrapping.
Source§

fn query_one(query: Self::Query<List<Self>>) -> Self::Query<Self>

Narrow a list query to a single-row query (errors at exec time if no row matches). Used by the codegen for non-nullable relation accessors.
Source§

fn query_first(query: Self::Query<List<Self>>) -> Self::Query<Option<Self>>

Narrow a list query to an optional single-row query. Used by the codegen for nullable relation accessors.
Source§

fn field_name_to_id(name: &str) -> FieldId

Map a field name string to its FieldId. Read more
Source§

fn new_root_path() -> Self::Path<Self>

Construct a path rooted at this model.
Source§

fn path_root() -> Path<Self, Self>

An identity Path rooted at this model. Read more
Source§

fn path_field<U>(index: usize) -> Path<Self, U>

A Path from this model to the field at index.
Source§

fn path_model_list() -> Path<List<Self>, List<Self>>

An identity Path rooted at a list of this model, used as the root of has-many relation scopes.
Source§

fn new_create() -> Self::Create

Return a fresh, default-initialized create builder.
Source§

impl ModelCodegen for AdminUser

Source§

fn to_relation_expr(&self, fields: &[&str]) -> Expr

Encode referenced fields so the engine can resolve a relation key.
Source§

fn new_one_field<__Origin, __Target>( path: Path<__Origin, __Target>, ) -> Self::OneField<__Origin, __Target>

Construct the field accessor for a singular relation to this model.
Source§

impl PanelUser for AdminUser

Source§

fn user_id(&self) -> String

The stable key the session stores and Authenticator::find_by_id receives. Any string fits.
Source§

fn display_name(&self) -> &str

The name the panel’s top bar shows.
Source§

fn can_access_panel(&self) -> bool

Whether the user may enter the panel. A user who may not answers 403, indistinguishable from bad credentials at login. Defaults to true.
Source§

fn tenants(&self) -> &[Membership]

The tenants the user may act for, in the order the tenant switcher lists them. The first is the default tenant until the user selects another. Defaults to none: the user has no tenant.
Source§

impl UpdateTarget for &mut AdminUser

Source§

type Returning = AdminUser

The type parameter for the typed Update<R> statement.
Source§

fn to_update_stmt(&mut self, assignments: Assignments) -> Update<AdminUser>

Build the update statement by combining this target’s selection with the provided assignments. Read more
Source§

fn apply_result(self, value: Value) -> Result<()>

Apply the result of an update operation. Read more
Source§

impl ViaTarget for AdminUser

Source§

type Query = AdminUserQuery

The query builder returned by the generated has-many-via navigation method.
Source§

type Path<__Origin> = <AdminUser as Model>::ManyField<__Origin>

The typed path handle a #[has_many(via = …)] field’s accessor returns, parameterized by the origin model. Mirrors Model::Path for the via-many case. Read more
Source§

fn new_path<__Origin>( path: Path<__Origin, List<AdminUser>>, ) -> Self::Path<__Origin>

Build the Path handle from the typed path reaching this terminal. A model terminal wraps the path in its chainable ManyField; a scalar terminal is a leaf, so the path is the handle.
Source§

fn via_field_ty(singular: Name, path: Path) -> FieldTy

Build the FieldTy::Via for a #[has_many(via = …)] field whose terminal element type is Self. Read more
Source§

fn make_via_query(assoc: Association<List<AdminUser>>) -> Self::Query

Wrap a via-field association into the navigation query. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Assign<Arc<T>> for T
where T: IntoExpr<T>,

Source§

fn into_assignment(self) -> Assignment<Arc<T>>

Convert into an Assignment<T> value.
Source§

fn assign(self, assignments: &mut Assignments, projection: Projection)
where Self: Sized,

Record one or more assignments into the given [Assignments] map at the specified projection.
Source§

impl<T> Assign<Box<T>> for T
where T: IntoExpr<T>,

Source§

fn into_assignment(self) -> Assignment<Box<T>>

Convert into an Assignment<T> value.
Source§

fn assign(self, assignments: &mut Assignments, projection: Projection)
where Self: Sized,

Record one or more assignments into the given [Assignments] map at the specified projection.
Source§

impl<T> Assign<Option<T>> for T
where T: IntoExpr<T>,

Source§

fn into_assignment(self) -> Assignment<Option<T>>

Convert into an Assignment<T> value.
Source§

fn assign(self, assignments: &mut Assignments, projection: Projection)
where Self: Sized,

Record one or more assignments into the given [Assignments] map at the specified projection.
Source§

impl<T> Assign<Rc<T>> for T
where T: IntoExpr<T>,

Source§

fn into_assignment(self) -> Assignment<Rc<T>>

Convert into an Assignment<T> value.
Source§

fn assign(self, assignments: &mut Assignments, projection: Projection)
where Self: Sized,

Record one or more assignments into the given [Assignments] map at the specified projection.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneAny for T
where T: Any + Clone,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoExpr<Arc<T>> for T
where T: IntoExpr<T>,

Source§

fn into_expr(self) -> Expr<Arc<T>>

Consume self and produce an Expr<T>. Read more
Source§

fn by_ref(&self) -> Expr<Arc<T>>

Produce an Expr<T> from a reference without consuming self. Read more
Source§

impl<T> IntoExpr<Box<T>> for T
where T: IntoExpr<T>,

Source§

fn into_expr(self) -> Expr<Box<T>>

Consume self and produce an Expr<T>. Read more
Source§

fn by_ref(&self) -> Expr<Box<T>>

Produce an Expr<T> from a reference without consuming self. Read more
Source§

impl<T> IntoExpr<Option<T>> for T
where T: IntoExpr<T>,

Source§

fn into_expr(self) -> Expr<Option<T>>

Consume self and produce an Expr<T>. Read more
Source§

fn by_ref(&self) -> Expr<Option<T>>

Produce an Expr<T> from a reference without consuming self. Read more
Source§

impl<T> IntoExpr<Rc<T>> for T
where T: IntoExpr<T>,

Source§

fn into_expr(self) -> Expr<Rc<T>>

Consume self and produce an Expr<T>. Read more
Source§

fn by_ref(&self) -> Expr<Rc<T>>

Produce an Expr<T> from a reference without consuming self. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<M> RelationOneField for M
where M: Model,

Source§

const DEFERRED: bool = false

Whether the field stores its value in a deferred load slot.
Source§

const NULLABLE: bool = false

Whether the field is nullable (i.e. wrapped in Option).
Source§

type Target = M

The target model that this field references.
Source§

type One = <M as Model>::Query<M>

The query type produced by the relation accessor. For non-nullable impls this is <Target as Model>::Query<Target>; for nullable impls it is <Target as Model>::Query<Option<Target>>.
Source§

type Expr = M

The path target and expression type used in create/update setters. Resolves to Self::Target for non-nullable impls and Option<Self::Target> for nullable impls.
Source§

fn make_one( query: <<M as RelationOneField>::Target as Model>::Query<List<<M as RelationOneField>::Target>>, ) -> <M as RelationOneField>::One

Narrow a list query targeting the related model into the appropriate “one” query — Query<Model> for non-nullable impls and Query<Option<Model>> for nullable impls. Read more
Source§

fn reload(target: &mut Self, value: Value) -> Result<(), Error>

Reloads this relation field from a returned value.
Source§

fn has_one_relation_field_ty( pair: Option<FieldId>, via: Option<Path>, ) -> FieldTy

Build the FieldTy for a HasOne relation field, given an optional paired BelongsTo field on the target model resolved from #[has_one(pair = <field>)]. When None, the linker selects the pair by searching the target for a unique BelongsTo back to the source. Read more
Source§

fn belongs_to_relation_field_ty(foreign_key: ForeignKey) -> FieldTy

Build the FieldTy for a BelongsTo relation field, given the foreign key resolved from the field’s #[belongs_to(...)] attribute.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more