Struct create_rust_app::auth::UserSession
source · [−]pub struct UserSession {
pub id: i32,
pub user_id: i32,
pub refresh_token: String,
pub device: Option<String>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}Fields
id: i32user_id: i32refresh_token: Stringdevice: Option<String>created_at: DateTime<Utc>updated_at: DateTime<Utc>Implementations
sourceimpl UserSession
impl UserSession
pub fn create(db: &Connection, item: &UserSessionChangeset) -> QueryResult<Self>
pub fn read(db: &Connection, item_id: i32) -> QueryResult<Self>
pub fn find_by_refresh_token(
db: &Connection,
item_refresh_token: &str
) -> QueryResult<Self>
pub fn read_all(
db: &Connection,
pagination: &PaginationParams,
item_user_id: i32
) -> QueryResult<Vec<Self>>
pub fn count_all(db: &Connection, item_user_id: i32) -> QueryResult<i64>
pub fn update(
db: &Connection,
item_id: i32,
item: &UserSessionChangeset
) -> QueryResult<Self>
pub fn delete(db: &Connection, item_id: i32) -> QueryResult<usize>
pub fn delete_all_for_user(
db: &Connection,
item_user_id: i32
) -> QueryResult<usize>
Trait Implementations
sourceimpl<'update> AsChangeset for &'update UserSession
impl<'update> AsChangeset for &'update UserSession
type Target = table
type Target = table
The table which Self::Changeset will be updating
type Changeset = <(Eq<user_id, <&'update i32 as AsExpression<<user_id as Expression>::SqlType>>::Expression>, Eq<refresh_token, <&'update String as AsExpression<<refresh_token as Expression>::SqlType>>::Expression>, Option<Eq<device, <&'update String as AsExpression<<device as Expression>::SqlType>>::Expression>>, Eq<created_at, <&'update DateTime<Utc> as AsExpression<<created_at as Expression>::SqlType>>::Expression>, Eq<updated_at, <&'update DateTime<Utc> as AsExpression<<updated_at as Expression>::SqlType>>::Expression>) as AsChangeset>::Changeset
type Changeset = <(Eq<user_id, <&'update i32 as AsExpression<<user_id as Expression>::SqlType>>::Expression>, Eq<refresh_token, <&'update String as AsExpression<<refresh_token as Expression>::SqlType>>::Expression>, Option<Eq<device, <&'update String as AsExpression<<device as Expression>::SqlType>>::Expression>>, Eq<created_at, <&'update DateTime<Utc> as AsExpression<<created_at as Expression>::SqlType>>::Expression>, Eq<updated_at, <&'update DateTime<Utc> as AsExpression<<updated_at as Expression>::SqlType>>::Expression>) as AsChangeset>::Changeset
The update statement this type represents
sourcefn as_changeset(self) -> Self::Changeset
fn as_changeset(self) -> Self::Changeset
Convert self into the actual update statement being executed
sourceimpl<'update> AsChangeset for UserSession
impl<'update> AsChangeset for UserSession
type Target = table
type Target = table
The table which Self::Changeset will be updating
type Changeset = <(Eq<user_id, <i32 as AsExpression<<user_id as Expression>::SqlType>>::Expression>, Eq<refresh_token, <String as AsExpression<<refresh_token as Expression>::SqlType>>::Expression>, Option<Eq<device, <String as AsExpression<<device as Expression>::SqlType>>::Expression>>, Eq<created_at, <DateTime<Utc> as AsExpression<<created_at as Expression>::SqlType>>::Expression>, Eq<updated_at, <DateTime<Utc> as AsExpression<<updated_at as Expression>::SqlType>>::Expression>) as AsChangeset>::Changeset
type Changeset = <(Eq<user_id, <i32 as AsExpression<<user_id as Expression>::SqlType>>::Expression>, Eq<refresh_token, <String as AsExpression<<refresh_token as Expression>::SqlType>>::Expression>, Option<Eq<device, <String as AsExpression<<device as Expression>::SqlType>>::Expression>>, Eq<created_at, <DateTime<Utc> as AsExpression<<created_at as Expression>::SqlType>>::Expression>, Eq<updated_at, <DateTime<Utc> as AsExpression<<updated_at as Expression>::SqlType>>::Expression>) as AsChangeset>::Changeset
The update statement this type represents
sourcefn as_changeset(self) -> Self::Changeset
fn as_changeset(self) -> Self::Changeset
Convert self into the actual update statement being executed
sourceimpl<__FK> BelongsTo<User> for UserSession where
__FK: Hash + Eq,
for<'__a> &'__a i32: Into<Option<&'__a __FK>>,
for<'__a> &'__a User: Identifiable<Id = &'__a __FK>,
impl<__FK> BelongsTo<User> for UserSession where
__FK: Hash + Eq,
for<'__a> &'__a i32: Into<Option<&'__a __FK>>,
for<'__a> &'__a User: Identifiable<Id = &'__a __FK>,
type ForeignKey = __FK
type ForeignKey = __FK
The foreign key of this struct
type ForeignKeyColumn = user_id
type ForeignKeyColumn = user_id
The database column representing the foreign key of the table this struct represents Read more
sourcefn foreign_key(&self) -> Option<&Self::ForeignKey>
fn foreign_key(&self) -> Option<&Self::ForeignKey>
Returns the foreign key for self
sourcefn foreign_key_column() -> Self::ForeignKeyColumn
fn foreign_key_column() -> Self::ForeignKeyColumn
Returns the foreign key column of this struct’s table
sourceimpl Clone for UserSession
impl Clone for UserSession
sourcefn clone(&self) -> UserSession
fn clone(&self) -> UserSession
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for UserSession
impl Debug for UserSession
sourceimpl<'de> Deserialize<'de> for UserSession
impl<'de> Deserialize<'de> for UserSession
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl HasTable for UserSession
impl HasTable for UserSession
sourceimpl<'ident> Identifiable for &'ident UserSession
impl<'ident> Identifiable for &'ident UserSession
sourceimpl<__DB: Backend, __ST> Queryable<__ST, __DB> for UserSession where
(i32, i32, String, Option<String>, DateTime<Utc>, DateTime<Utc>): Queryable<__ST, __DB>,
impl<__DB: Backend, __ST> Queryable<__ST, __DB> for UserSession where
(i32, i32, String, Option<String>, DateTime<Utc>, DateTime<Utc>): Queryable<__ST, __DB>,
sourceimpl Serialize for UserSession
impl Serialize for UserSession
Auto Trait Implementations
impl RefUnwindSafe for UserSession
impl Send for UserSession
impl Sync for UserSession
impl Unpin for UserSession
impl UnwindSafe for UserSession
Blanket Implementations
sourceimpl<'a, Parent, Child> BelongingToDsl<&'a [Parent]> for Child where
Child: HasTable + BelongsTo<Parent>,
&'a Parent: Identifiable,
Vec<<&'a Parent as Identifiable>::Id, Global>: AsInExpression<<<Child as BelongsTo<Parent>>::ForeignKeyColumn as Expression>::SqlType>,
<Child as HasTable>::Table: FilterDsl<In<<Child as BelongsTo<Parent>>::ForeignKeyColumn, <Vec<<&'a Parent as Identifiable>::Id, Global> as AsInExpression<<<Child as BelongsTo<Parent>>::ForeignKeyColumn as Expression>::SqlType>>::InExpression>>,
<Child as BelongsTo<Parent>>::ForeignKeyColumn: ExpressionMethods,
impl<'a, Parent, Child> BelongingToDsl<&'a [Parent]> for Child where
Child: HasTable + BelongsTo<Parent>,
&'a Parent: Identifiable,
Vec<<&'a Parent as Identifiable>::Id, Global>: AsInExpression<<<Child as BelongsTo<Parent>>::ForeignKeyColumn as Expression>::SqlType>,
<Child as HasTable>::Table: FilterDsl<In<<Child as BelongsTo<Parent>>::ForeignKeyColumn, <Vec<<&'a Parent as Identifiable>::Id, Global> as AsInExpression<<<Child as BelongsTo<Parent>>::ForeignKeyColumn as Expression>::SqlType>>::InExpression>>,
<Child as BelongsTo<Parent>>::ForeignKeyColumn: ExpressionMethods,
type Output = <<Child as HasTable>::Table as FilterDsl<In<<Child as BelongsTo<Parent>>::ForeignKeyColumn, <Vec<<&'a Parent as Identifiable>::Id, Global> as AsInExpression<<<Child as BelongsTo<Parent>>::ForeignKeyColumn as Expression>::SqlType>>::InExpression>>>::Output
type Output = <<Child as HasTable>::Table as FilterDsl<In<<Child as BelongsTo<Parent>>::ForeignKeyColumn, <Vec<<&'a Parent as Identifiable>::Id, Global> as AsInExpression<<<Child as BelongsTo<Parent>>::ForeignKeyColumn as Expression>::SqlType>>::InExpression>>>::Output
The query returned by belonging_to
sourcefn belonging_to(
parents: &'a [Parent]
) -> <Child as BelongingToDsl<&'a [Parent]>>::Output
fn belonging_to(
parents: &'a [Parent]
) -> <Child as BelongingToDsl<&'a [Parent]>>::Output
Get the record(s) belonging to record(s) other
sourceimpl<'a, Parent, Child> BelongingToDsl<&'a Vec<Parent, Global>> for Child where
Child: BelongingToDsl<&'a [Parent]>,
impl<'a, Parent, Child> BelongingToDsl<&'a Vec<Parent, Global>> for Child where
Child: BelongingToDsl<&'a [Parent]>,
type Output = <Child as BelongingToDsl<&'a [Parent]>>::Output
type Output = <Child as BelongingToDsl<&'a [Parent]>>::Output
The query returned by belonging_to
sourcefn belonging_to(
parents: &'a Vec<Parent, Global>
) -> <Child as BelongingToDsl<&'a Vec<Parent, Global>>>::Output
fn belonging_to(
parents: &'a Vec<Parent, Global>
) -> <Child as BelongingToDsl<&'a Vec<Parent, Global>>>::Output
Get the record(s) belonging to record(s) other
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> IntoSql for T
impl<T> IntoSql for T
sourcefn into_sql<T>(self) -> Self::Expression where
Self: AsExpression<T>,
fn into_sql<T>(self) -> Self::Expression where
Self: AsExpression<T>,
Convert self to an expression for Diesel’s query builder. Read more
sourcefn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
&'a Self: AsExpression<T>,
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
&'a Self: AsExpression<T>,
Convert &self to an expression for Diesel’s query builder. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more