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: &mut Connection,
item: &UserSessionChangeset
) -> QueryResult<Self>
pub fn read(db: &mut Connection, item_id: i32) -> QueryResult<Self>
pub fn find_by_refresh_token(
db: &mut Connection,
item_refresh_token: &str
) -> QueryResult<Self>
pub fn read_all(
db: &mut Connection,
pagination: &PaginationParams,
item_user_id: i32
) -> QueryResult<Vec<Self>>
pub fn count_all(db: &mut Connection, item_user_id: i32) -> QueryResult<i64>
pub fn update(
db: &mut Connection,
item_id: i32,
item: &UserSessionChangeset
) -> QueryResult<Self>
pub fn delete(db: &mut Connection, item_id: i32) -> QueryResult<usize>
pub fn delete_all_for_user(
db: &mut 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 = <(Grouped<Eq<user_id, <&'update i32 as AsExpression<<user_id as Expression>::SqlType>>::Expression>>, Grouped<Eq<refresh_token, <&'update String as AsExpression<<refresh_token as Expression>::SqlType>>::Expression>>, Option<Grouped<Eq<device, <&'update String as AsExpression<<device as Expression>::SqlType>>::Expression>>>, Grouped<Eq<created_at, <&'update DateTime<Utc> as AsExpression<<created_at as Expression>::SqlType>>::Expression>>, Grouped<Eq<updated_at, <&'update DateTime<Utc> as AsExpression<<updated_at as Expression>::SqlType>>::Expression>>) as AsChangeset>::Changeset
type Changeset = <(Grouped<Eq<user_id, <&'update i32 as AsExpression<<user_id as Expression>::SqlType>>::Expression>>, Grouped<Eq<refresh_token, <&'update String as AsExpression<<refresh_token as Expression>::SqlType>>::Expression>>, Option<Grouped<Eq<device, <&'update String as AsExpression<<device as Expression>::SqlType>>::Expression>>>, Grouped<Eq<created_at, <&'update DateTime<Utc> as AsExpression<<created_at as Expression>::SqlType>>::Expression>>, Grouped<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 AsChangeset for UserSession
impl AsChangeset for UserSession
type Target = table
type Target = table
The table which Self::Changeset will be updating
type Changeset = <(Grouped<Eq<user_id, <i32 as AsExpression<<user_id as Expression>::SqlType>>::Expression>>, Grouped<Eq<refresh_token, <String as AsExpression<<refresh_token as Expression>::SqlType>>::Expression>>, Option<Grouped<Eq<device, <String as AsExpression<<device as Expression>::SqlType>>::Expression>>>, Grouped<Eq<created_at, <DateTime<Utc> as AsExpression<<created_at as Expression>::SqlType>>::Expression>>, Grouped<Eq<updated_at, <DateTime<Utc> as AsExpression<<updated_at as Expression>::SqlType>>::Expression>>) as AsChangeset>::Changeset
type Changeset = <(Grouped<Eq<user_id, <i32 as AsExpression<<user_id as Expression>::SqlType>>::Expression>>, Grouped<Eq<refresh_token, <String as AsExpression<<refresh_token as Expression>::SqlType>>::Expression>>, Option<Grouped<Eq<device, <String as AsExpression<<device as Expression>::SqlType>>::Expression>>>, Grouped<Eq<created_at, <DateTime<Utc> as AsExpression<<created_at as Expression>::SqlType>>::Expression>>, Grouped<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<__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, __ST0, __ST1, __ST2, __ST3, __ST4, __ST5> Queryable<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5), __DB> for UserSession where
(i32, i32, String, Option<String>, DateTime<Utc>, DateTime<Utc>): FromStaticSqlRow<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5), __DB>,
impl<__DB: Backend, __ST0, __ST1, __ST2, __ST3, __ST4, __ST5> Queryable<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5), __DB> for UserSession where
(i32, i32, String, Option<String>, DateTime<Utc>, DateTime<Utc>): FromStaticSqlRow<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5), __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 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> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> IntoSql for T
impl<T> IntoSql for T
sourcefn into_sql<T>(self) -> Self::Expression where
Self: AsExpression<T>,
T: SqlType + TypedExpressionType,
fn into_sql<T>(self) -> Self::Expression where
Self: AsExpression<T>,
T: SqlType + TypedExpressionType,
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
T: SqlType + TypedExpressionType,
&'a Self: AsExpression<T>,
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
T: SqlType + TypedExpressionType,
&'a Self: AsExpression<T>,
Convert &self to an expression for Diesel’s query builder. Read more
sourceimpl<T, ST, DB> StaticallySizedRow<ST, DB> for T where
ST: SqlTypeOrSelectable + TupleSize,
T: Queryable<ST, DB>,
DB: Backend,
impl<T, ST, DB> StaticallySizedRow<ST, DB> for T where
ST: SqlTypeOrSelectable + TupleSize,
T: Queryable<ST, DB>,
DB: Backend,
sourceconst FIELD_COUNT: usize = <ST as crate::util::TupleSize>::SIZE
const FIELD_COUNT: usize = <ST as crate::util::TupleSize>::SIZE
The number of fields that this type will consume.
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more