pub struct AuthSession {
pub token_hash: String,
pub user_id: String,
pub panel: String,
pub tenant: Option<Uuid>,
pub expires_at: Timestamp,
pub created_at: Timestamp,
}Expand description
Shipped server-side session record: the SHA-256 hash of the client token, the user it authenticates, the panel that signed the user in, and its expiry. The raw token is never stored.
Fields§
§token_hash: StringHex-encoded SHA-256 of the session token.
user_id: StringPanelUser::user_id of the authenticated user.
panel: StringThe prefix of the panel that signed the user in (e.g. /admin): the
only panel the session authenticates.
tenant: Option<Uuid>The tenant the user selected; None acts for the first.
expires_at: TimestampIndexed for the login sweep’s range scan on this column.
created_at: TimestampImplementations§
Source§impl AuthSession
impl AuthSession
Sourcepub fn fields() -> AuthSessionFields<AuthSession>
pub fn fields() -> AuthSessionFields<AuthSession>
Returns a handle used to reference AuthSession’s fields when building query expressions.
Sourcepub async fn get_by_token_hash(
executor: &mut dyn Executor,
token_hash: impl IntoExpr<FieldExprTarget<String>>,
) -> Result<AuthSession>
pub async fn get_by_token_hash( executor: &mut dyn Executor, token_hash: impl IntoExpr<FieldExprTarget<String>>, ) -> Result<AuthSession>
Fetches the single AuthSession where token_hash matches, erroring if none exists.
Sourcepub fn update_by_token_hash(
token_hash: impl IntoExpr<FieldExprTarget<String>>,
) -> AuthSessionUpdate
pub fn update_by_token_hash( token_hash: impl IntoExpr<FieldExprTarget<String>>, ) -> AuthSessionUpdate
Returns a builder that updates the AuthSession where token_hash matches.
Sourcepub async fn delete_by_token_hash(
executor: &mut dyn Executor,
token_hash: impl IntoExpr<FieldExprTarget<String>>,
) -> Result<()>
pub async fn delete_by_token_hash( executor: &mut dyn Executor, token_hash: impl IntoExpr<FieldExprTarget<String>>, ) -> Result<()>
Deletes the AuthSession where token_hash matches.
Sourcepub fn filter_by_token_hash(
token_hash: impl IntoExpr<FieldExprTarget<String>>,
) -> AuthSessionQuery
pub fn filter_by_token_hash( token_hash: impl IntoExpr<FieldExprTarget<String>>, ) -> AuthSessionQuery
Returns a query selecting the AuthSession records where token_hash matches.
Sourcepub async fn get_by_user_id(
executor: &mut dyn Executor,
user_id: impl IntoExpr<FieldExprTarget<String>>,
) -> Result<AuthSession>
pub async fn get_by_user_id( executor: &mut dyn Executor, user_id: impl IntoExpr<FieldExprTarget<String>>, ) -> Result<AuthSession>
Fetches the single AuthSession where user_id matches, erroring if none exists.
Sourcepub fn update_by_user_id(
user_id: impl IntoExpr<FieldExprTarget<String>>,
) -> AuthSessionUpdate
pub fn update_by_user_id( user_id: impl IntoExpr<FieldExprTarget<String>>, ) -> AuthSessionUpdate
Returns a builder that updates the AuthSession where user_id matches.
Sourcepub async fn delete_by_user_id(
executor: &mut dyn Executor,
user_id: impl IntoExpr<FieldExprTarget<String>>,
) -> Result<()>
pub async fn delete_by_user_id( executor: &mut dyn Executor, user_id: impl IntoExpr<FieldExprTarget<String>>, ) -> Result<()>
Deletes the AuthSession where user_id matches.
Sourcepub fn filter_by_user_id(
user_id: impl IntoExpr<FieldExprTarget<String>>,
) -> AuthSessionQuery
pub fn filter_by_user_id( user_id: impl IntoExpr<FieldExprTarget<String>>, ) -> AuthSessionQuery
Returns a query selecting the AuthSession records where user_id matches.
Sourcepub async fn get_by_expires_at(
executor: &mut dyn Executor,
expires_at: impl IntoExpr<FieldExprTarget<Timestamp>>,
) -> Result<AuthSession>
pub async fn get_by_expires_at( executor: &mut dyn Executor, expires_at: impl IntoExpr<FieldExprTarget<Timestamp>>, ) -> Result<AuthSession>
Fetches the single AuthSession where expires_at matches, erroring if none exists.
Sourcepub fn update_by_expires_at(
expires_at: impl IntoExpr<FieldExprTarget<Timestamp>>,
) -> AuthSessionUpdate
pub fn update_by_expires_at( expires_at: impl IntoExpr<FieldExprTarget<Timestamp>>, ) -> AuthSessionUpdate
Returns a builder that updates the AuthSession where expires_at matches.
Sourcepub async fn delete_by_expires_at(
executor: &mut dyn Executor,
expires_at: impl IntoExpr<FieldExprTarget<Timestamp>>,
) -> Result<()>
pub async fn delete_by_expires_at( executor: &mut dyn Executor, expires_at: impl IntoExpr<FieldExprTarget<Timestamp>>, ) -> Result<()>
Deletes the AuthSession where expires_at matches.
Sourcepub fn filter_by_expires_at(
expires_at: impl IntoExpr<FieldExprTarget<Timestamp>>,
) -> AuthSessionQuery
pub fn filter_by_expires_at( expires_at: impl IntoExpr<FieldExprTarget<Timestamp>>, ) -> AuthSessionQuery
Returns a query selecting the AuthSession records where expires_at matches.
Sourcepub fn create() -> AuthSessionCreate
pub fn create() -> AuthSessionCreate
Returns a builder that inserts a new AuthSession record.
Typically constructed through the toasty::create! macro.
Sourcepub fn create_many() -> CreateMany<AuthSession>
pub fn create_many() -> CreateMany<AuthSession>
Returns a builder that inserts multiple AuthSession records at once.
Sourcepub fn update(&mut self) -> AuthSessionUpdate<&mut Self>
pub fn update(&mut self) -> AuthSessionUpdate<&mut Self>
Returns a builder that updates this AuthSession record in place.
Source§impl AuthSession
impl AuthSession
Sourcepub fn upsert_by_token_hash(
token_hash: impl IntoExpr<FieldExprTarget<String>>,
) -> AuthSessionUpsertByTokenHash
pub fn upsert_by_token_hash( token_hash: impl IntoExpr<FieldExprTarget<String>>, ) -> AuthSessionUpsertByTokenHash
Returns a builder that creates AuthSession or updates the record whose token_hash constraint matches.
The target arguments initialize a new record and remain unchanged when an existing record is updated.
Trait Implementations§
Source§impl Assign<AuthSession> for AuthSession
impl Assign<AuthSession> for AuthSession
Source§fn into_assignment(self) -> Assignment<AuthSession>
fn into_assignment(self) -> Assignment<AuthSession>
Assignment<T> value.Source§fn assign(self, assignments: &mut Assignments, projection: Projection)where
Self: Sized,
fn assign(self, assignments: &mut Assignments, projection: Projection)where
Self: Sized,
Assignments] map at
the specified projection.Source§impl Clone for AuthSession
impl Clone for AuthSession
Source§impl Debug for AuthSession
impl Debug for AuthSession
Source§impl IntoExpr<AuthSession> for AuthSession
impl IntoExpr<AuthSession> for AuthSession
Source§impl IntoStatement for &AuthSession
impl IntoStatement for &AuthSession
Source§type Returning = AuthSession
type Returning = AuthSession
Source§fn into_statement(self) -> Statement<AuthSession>
fn into_statement(self) -> Statement<AuthSession>
self and produce the Statement.Source§impl IntoStatement for &mut AuthSession
impl IntoStatement for &mut AuthSession
Source§type Returning = AuthSession
type Returning = AuthSession
Source§fn into_statement(self) -> Statement<AuthSession>
fn into_statement(self) -> Statement<AuthSession>
self and produce the Statement.Source§impl IntoStatement for AuthSession
impl IntoStatement for AuthSession
Source§type Returning = AuthSession
type Returning = AuthSession
Source§fn into_statement(self) -> Statement<AuthSession>
fn into_statement(self) -> Statement<AuthSession>
self and produce the Statement.Source§impl Load for AuthSession
impl Load for AuthSession
Source§fn ty() -> Type
fn ty() -> Type
stmt::Type that describes values of this type.Source§fn reload(target: &mut Self, value: Value) -> Result<()>
fn reload(target: &mut Self, value: Value) -> Result<()>
Source§fn ty_relation() -> Type
fn ty_relation() -> Type
stmt::Type used when this type appears as a relation
target. The default delegates to ty().Source§impl Model for AuthSession
impl Model for AuthSession
Source§type Query<__T> = AuthSessionQuery<__T>
type Query<__T> = AuthSessionQuery<__T>
Source§type Update<'a> = AuthSessionUpdate<&'a mut AuthSession>
type Update<'a> = AuthSessionUpdate<&'a mut AuthSession>
Source§type UpdateQuery = AuthSessionUpdate
type UpdateQuery = AuthSessionUpdate
Source§type PrimaryKey = String
type PrimaryKey = String
Source§type ManyField<__Origin> = AuthSessionListFields<__Origin>
type ManyField<__Origin> = AuthSessionListFields<__Origin>
Source§type OneField<__Origin, __Target> = AuthSessionFields<__Origin, __Target>
type OneField<__Origin, __Target> = AuthSessionFields<__Origin, __Target>
Source§fn new_path<__Origin>(path: Path<__Origin, Self>) -> Self::Path<__Origin>
fn new_path<__Origin>(path: Path<__Origin, Self>) -> Self::Path<__Origin>
Path targeting this model.Source§fn new_many_field<__Origin>(
path: Path<__Origin, List<Self>>,
) -> AuthSessionListFields<__Origin>
fn new_many_field<__Origin>( path: Path<__Origin, List<Self>>, ) -> AuthSessionListFields<__Origin>
ManyField from a path targeting a list
of this model.Source§fn find_by_primary_key(id: Expr<Self::PrimaryKey>) -> Self::Query<List<Self>>
fn find_by_primary_key(id: Expr<Self::PrimaryKey>) -> Self::Query<List<Self>>
Source§fn wrap_query<__T>(stmt: Query<__T>) -> Self::Query<__T>
fn wrap_query<__T>(stmt: Query<__T>) -> Self::Query<__T>
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>
fn query_one(query: Self::Query<List<Self>>) -> Self::Query<Self>
Source§fn query_first(query: Self::Query<List<Self>>) -> Self::Query<Option<Self>>
fn query_first(query: Self::Query<List<Self>>) -> Self::Query<Option<Self>>
Source§fn new_root_path() -> Self::Path<Self>
fn new_root_path() -> Self::Path<Self>
Source§fn path_model_list() -> Path<List<Self>, List<Self>>
fn path_model_list() -> Path<List<Self>, List<Self>>
Path rooted at a list of this model, used as the root of
has-many relation scopes.Source§fn new_create() -> Self::Create
fn new_create() -> Self::Create
Source§impl ModelCodegen for AuthSession
impl ModelCodegen for AuthSession
Source§fn to_relation_expr(&self, fields: &[&str]) -> Expr
fn to_relation_expr(&self, fields: &[&str]) -> Expr
Source§fn new_one_field<__Origin, __Target>(
path: Path<__Origin, __Target>,
) -> Self::OneField<__Origin, __Target>
fn new_one_field<__Origin, __Target>( path: Path<__Origin, __Target>, ) -> Self::OneField<__Origin, __Target>
Source§impl UpdateTarget for &mut AuthSession
impl UpdateTarget for &mut AuthSession
Source§type Returning = AuthSession
type Returning = AuthSession
Update<R> statement.Source§fn to_update_stmt(&mut self, assignments: Assignments) -> Update<AuthSession>
fn to_update_stmt(&mut self, assignments: Assignments) -> Update<AuthSession>
Source§impl ViaTarget for AuthSession
impl ViaTarget for AuthSession
Source§type Query = AuthSessionQuery
type Query = AuthSessionQuery
Source§type Path<__Origin> = <AuthSession as Model>::ManyField<__Origin>
type Path<__Origin> = <AuthSession as Model>::ManyField<__Origin>
#[has_many(via = …)] field’s accessor returns,
parameterized by the origin model. Mirrors Model::Path for the
via-many case. Read moreSource§fn new_path<__Origin>(
path: Path<__Origin, List<AuthSession>>,
) -> Self::Path<__Origin>
fn new_path<__Origin>( path: Path<__Origin, List<AuthSession>>, ) -> Self::Path<__Origin>
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
fn via_field_ty(singular: Name, path: Path) -> FieldTy
FieldTy::Via for a #[has_many(via = …)] field whose
terminal element type is Self. Read moreSource§fn make_via_query(assoc: Association<List<AuthSession>>) -> Self::Query
fn make_via_query(assoc: Association<List<AuthSession>>) -> Self::Query
Auto Trait Implementations§
impl Freeze for AuthSession
impl RefUnwindSafe for AuthSession
impl Send for AuthSession
impl Sync for AuthSession
impl Unpin for AuthSession
impl UnsafeUnpin for AuthSession
impl UnwindSafe for AuthSession
Blanket Implementations§
Source§impl<T> Assign<Arc<T>> for Twhere
T: IntoExpr<T>,
impl<T> Assign<Arc<T>> for Twhere
T: IntoExpr<T>,
Source§fn into_assignment(self) -> Assignment<Arc<T>>
fn into_assignment(self) -> Assignment<Arc<T>>
Assignment<T> value.Source§fn assign(self, assignments: &mut Assignments, projection: Projection)where
Self: Sized,
fn assign(self, assignments: &mut Assignments, projection: Projection)where
Self: Sized,
Assignments] map at
the specified projection.Source§impl<T> Assign<Box<T>> for Twhere
T: IntoExpr<T>,
impl<T> Assign<Box<T>> for Twhere
T: IntoExpr<T>,
Source§fn into_assignment(self) -> Assignment<Box<T>>
fn into_assignment(self) -> Assignment<Box<T>>
Assignment<T> value.Source§fn assign(self, assignments: &mut Assignments, projection: Projection)where
Self: Sized,
fn assign(self, assignments: &mut Assignments, projection: Projection)where
Self: Sized,
Assignments] map at
the specified projection.Source§impl<T> Assign<Option<T>> for Twhere
T: IntoExpr<T>,
impl<T> Assign<Option<T>> for Twhere
T: IntoExpr<T>,
Source§fn into_assignment(self) -> Assignment<Option<T>>
fn into_assignment(self) -> Assignment<Option<T>>
Assignment<T> value.Source§fn assign(self, assignments: &mut Assignments, projection: Projection)where
Self: Sized,
fn assign(self, assignments: &mut Assignments, projection: Projection)where
Self: Sized,
Assignments] map at
the specified projection.Source§impl<T> Assign<Rc<T>> for Twhere
T: IntoExpr<T>,
impl<T> Assign<Rc<T>> for Twhere
T: IntoExpr<T>,
Source§fn into_assignment(self) -> Assignment<Rc<T>>
fn into_assignment(self) -> Assignment<Rc<T>>
Assignment<T> value.Source§fn assign(self, assignments: &mut Assignments, projection: Projection)where
Self: Sized,
fn assign(self, assignments: &mut Assignments, projection: Projection)where
Self: Sized,
Assignments] map at
the specified projection.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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> CloneAny for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<M> RelationOneField for Mwhere
M: Model,
impl<M> RelationOneField for Mwhere
M: Model,
Source§type One = <M as Model>::Query<M>
type One = <M as Model>::Query<M>
<Target as Model>::Query<Target>; for nullable impls it is
<Target as Model>::Query<Option<Target>>.Source§type Expr = M
type Expr = M
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
fn make_one( query: <<M as RelationOneField>::Target as Model>::Query<List<<M as RelationOneField>::Target>>, ) -> <M as RelationOneField>::One
Query<Model> for non-nullable impls and
Query<Option<Model>> for nullable impls. Read moreSource§fn reload(target: &mut Self, value: Value) -> Result<(), Error>
fn reload(target: &mut Self, value: Value) -> Result<(), Error>
Source§fn belongs_to_relation_field_ty(foreign_key: ForeignKey) -> FieldTy
fn belongs_to_relation_field_ty(foreign_key: ForeignKey) -> FieldTy
FieldTy for a BelongsTo relation field, given the
foreign key resolved from the field’s #[belongs_to(...)] attribute.