Skip to main content

AuthFactor

Struct AuthFactor 

Source
pub struct AuthFactor {
    pub id: Uuid,
    pub user_id: String,
    pub panel: String,
    pub kind: FactorKind,
    pub secret: String,
    pub confirmed_at: Option<Timestamp>,
    pub last_step: Option<i64>,
    pub failures: i64,
    pub retry_at: Option<Timestamp>,
    pub created_at: Timestamp,
}
Expand description

Shipped second-factor record: an account’s authenticator secret, sealed, or the hash of one of its recovery codes. It signs in to the panel that enrolled it and to every panel whose authenticator loads the same user type.

Fields§

§id: Uuid§user_id: String

PanelUser::user_id of the account the factor signs in.

§panel: String

The prefix of the panel that enrolled the factor, which its secret is sealed for.

§kind: FactorKind§secret: String

The authenticator secret, sealed under the router’s cookie key, or the hash of a recovery code, keyed under it.

§confirmed_at: Option<Timestamp>

When a code proved the authenticator app holds the secret; None while it is being set up. A recovery code is confirmed when issued.

§last_step: Option<i64>

The last 30-second step an authenticator code signed in with: a code works once.

§failures: i64

The wrong codes in a row signing in since the last right one, on the confirmed factor.

§retry_at: Option<Timestamp>

Until when signing in refuses the confirmed factor’s codes after failures wrong ones; a recovery code still works.

§created_at: Timestamp

Implementations§

Source§

impl AuthFactor

Source

pub fn fields() -> AuthFactorFields<AuthFactor>

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

Source

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

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

Source

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

Returns a builder that updates the AuthFactor where id matches.

Source

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

Deletes the AuthFactor where id matches.

Source

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

Returns a query selecting the AuthFactor records where id matches.

Source

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

Fetches the single AuthFactor where user_id matches, erroring if none exists.

Source

pub fn update_by_user_id( user_id: impl IntoExpr<FieldExprTarget<String>>, ) -> AuthFactorUpdate

Returns a builder that updates the AuthFactor where user_id matches.

Source

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

Deletes the AuthFactor where user_id matches.

Source

pub fn filter_by_user_id( user_id: impl IntoExpr<FieldExprTarget<String>>, ) -> AuthFactorQuery

Returns a query selecting the AuthFactor records where user_id matches.

Source

pub fn create() -> AuthFactorCreate

Returns a builder that inserts a new AuthFactor record.

Typically constructed through the toasty::create! macro.

Source

pub fn create_many() -> CreateMany<AuthFactor>

Returns a builder that inserts multiple AuthFactor records at once.

Source

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

Returns a builder that updates this AuthFactor record in place.

Source

pub fn all() -> AuthFactorQuery

Returns a query that selects every AuthFactor record.

Source

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

Returns a query selecting the AuthFactor records matching expr.

Source

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

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

Source§

impl AuthFactor

Source

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

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

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

Trait Implementations§

Source§

impl Assign<AuthFactor> for AuthFactor

Source§

fn into_assignment(self) -> Assignment<AuthFactor>

Convert into an [Assignment<T>] value.
§

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 AuthFactor

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 AuthFactor

Source§

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

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

impl IntoExpr<AuthFactor> for AuthFactor

Source§

fn into_expr(self) -> Expr<AuthFactor>

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

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

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

impl IntoStatement for &AuthFactor

Source§

type Returning = AuthFactor

The type this statement produces when executed.
Source§

fn into_statement(self) -> Statement<AuthFactor>

Consume self and produce the [Statement].
Source§

impl IntoStatement for &mut AuthFactor

Source§

type Returning = AuthFactor

The type this statement produces when executed.
Source§

fn into_statement(self) -> Statement<AuthFactor>

Consume self and produce the [Statement].
Source§

impl IntoStatement for AuthFactor

Source§

type Returning = AuthFactor

The type this statement produces when executed.
Source§

fn into_statement(self) -> Statement<AuthFactor>

Consume self and produce the [Statement].
Source§

impl Load for AuthFactor

Source§

type Output = AuthFactor

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
§

fn ty_relation() -> Type

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

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 AuthFactor

Source§

type Query<__T> = AuthFactorQuery<__T>

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

type Create = AuthFactorCreate

Create builder type for this model
Source§

type Update<'a> = AuthFactorUpdate<&'a mut AuthFactor>

Update builder type for this model
Source§

type UpdateQuery = AuthFactorUpdate

Update by query builder type for this model
Source§

type Path<__Origin> = AuthFactorFields<__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> = AuthFactorListFields<__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> = AuthFactorFields<__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>>, ) -> AuthFactorListFields<__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
§

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

Construct a path rooted at this model.
§

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

An identity [Path] rooted at this model. Read more
§

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

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

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.
§

fn new_create() -> Self::Create

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

impl ModelCodegen for AuthFactor

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 UpdateTarget for &mut AuthFactor

Source§

type Returning = AuthFactor

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

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

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 AuthFactor

Source§

type Query = AuthFactorQuery

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

type Path<__Origin> = <AuthFactor 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<AuthFactor>>, ) -> 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<AuthFactor>>) -> 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
§

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

§

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

Convert into an [Assignment<T>] value.
§

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.
§

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

§

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

Convert into an [Assignment<T>] value.
§

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.
§

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

§

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

Convert into an [Assignment<T>] value.
§

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.
§

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

§

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

Convert into an [Assignment<T>] value.
§

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
§

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

§

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

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
§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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.

§

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

§

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

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

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

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

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

§

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

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

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

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

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

§

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

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

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

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

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

§

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

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

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

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

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

§

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

§

const DEFERRED: bool = false

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

const NULLABLE: bool = false

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

type Target = M

The target model that this field references.
§

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>>.
§

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.
§

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
§

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

Reloads this relation field from a returned value.
§

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
§

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.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

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

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