pub struct User {
pub id: i64,
pub external_id: i64,
pub credits: i64,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
pub timezone: String,
}Fields§
§id: i64Primary key of this user in the database
external_id: i64An ID which identifies this user in the external system
credits: i64How much of the currency this user has
created_at: DateTime<Utc>When the dataset was created
updated_at: DateTime<Utc>When the dataset was last updated
timezone: StringThe Timezone of this user, defaults to UTC
Implementations§
Source§impl User
impl User
pub fn get_timezone(&self) -> Tz
pub fn set_timezone(&mut self, timezone: Tz)
pub fn get_local_time(&self) -> DateTime<Tz>
Trait Implementations§
Source§impl<'update> AsChangeset for &'update User
impl<'update> AsChangeset for &'update User
Source§type Changeset = <(Grouped<Eq<external_id, <&'update i64 as AsExpression<<external_id as Expression>::SqlType>>::Expression>>, Grouped<Eq<credits, <&'update i64 as AsExpression<<credits 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>>, Grouped<Eq<timezone, <&'update String as AsExpression<<timezone as Expression>::SqlType>>::Expression>>) as AsChangeset>::Changeset
type Changeset = <(Grouped<Eq<external_id, <&'update i64 as AsExpression<<external_id as Expression>::SqlType>>::Expression>>, Grouped<Eq<credits, <&'update i64 as AsExpression<<credits 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>>, Grouped<Eq<timezone, <&'update String as AsExpression<<timezone as Expression>::SqlType>>::Expression>>) as AsChangeset>::Changeset
The update statement this type represents
Source§fn as_changeset(self) -> <Self as AsChangeset>::Changeset
fn as_changeset(self) -> <Self as AsChangeset>::Changeset
Convert
self into the actual update statement being executedSource§impl AsChangeset for User
impl AsChangeset for User
Source§type Changeset = <(Grouped<Eq<external_id, <i64 as AsExpression<<external_id as Expression>::SqlType>>::Expression>>, Grouped<Eq<credits, <i64 as AsExpression<<credits 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>>, Grouped<Eq<timezone, <String as AsExpression<<timezone as Expression>::SqlType>>::Expression>>) as AsChangeset>::Changeset
type Changeset = <(Grouped<Eq<external_id, <i64 as AsExpression<<external_id as Expression>::SqlType>>::Expression>>, Grouped<Eq<credits, <i64 as AsExpression<<credits 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>>, Grouped<Eq<timezone, <String as AsExpression<<timezone as Expression>::SqlType>>::Expression>>) as AsChangeset>::Changeset
The update statement this type represents
Source§fn as_changeset(self) -> <Self as AsChangeset>::Changeset
fn as_changeset(self) -> <Self as AsChangeset>::Changeset
Convert
self into the actual update statement being executedSource§impl<'de> Deserialize<'de> for User
impl<'de> Deserialize<'de> for User
Source§fn 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
Source§impl<__DB: Backend, __ST0, __ST1, __ST2, __ST3, __ST4, __ST5> Queryable<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5), __DB> for Userwhere
(i64, i64, i64, DateTime<Utc>, DateTime<Utc>, String): 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 Userwhere
(i64, i64, i64, DateTime<Utc>, DateTime<Utc>, String): FromStaticSqlRow<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5), __DB>,
Source§impl Repository<User> for UserRepository
impl Repository<User> for UserRepository
fn get_db(&self) -> Arc<RwLock<dyn DatabaseInterface>>
fn create(&self, new_entity: NewUser) -> Result<User, GameRepositoryError>
fn find(&self, id: i64) -> Result<Option<User>, GameRepositoryError>
fn save(&self, entity: User) -> Result<User, GameRepositoryError>
fn delete(&self, entity: User) -> Result<bool, GameRepositoryError>
fn get_connection( &self, ) -> Result<PooledConnection<ConnectionManager<PgConnection>>, GameDatabaseError>
Source§impl<__DB: Backend> Selectable<__DB> for User
impl<__DB: Backend> Selectable<__DB> for User
Source§type SelectExpression = (id, external_id, credits, created_at, updated_at, timezone)
type SelectExpression = (id, external_id, credits, created_at, updated_at, timezone)
The expression you’d like to select. Read more
Source§fn construct_selection() -> Self::SelectExpression
fn construct_selection() -> Self::SelectExpression
Construct an instance of the expression
impl StructuralPartialEq for User
Auto Trait Implementations§
impl Freeze for User
impl RefUnwindSafe for User
impl Send for User
impl Sync for User
impl Unpin for User
impl UnwindSafe for User
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoSql for T
impl<T> IntoSql for T
Source§fn into_sql<T>(self) -> Self::Expression
fn into_sql<T>(self) -> Self::Expression
Convert
self to an expression for Diesel’s query builder. Read moreSource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
Convert
&self to an expression for Diesel’s query builder. Read moreSource§impl<T, DB> SelectableHelper<DB> for Twhere
T: Selectable<DB>,
DB: Backend,
impl<T, DB> SelectableHelper<DB> for Twhere
T: Selectable<DB>,
DB: Backend,
Source§fn as_select() -> SelectBy<T, DB>
fn as_select() -> SelectBy<T, DB>
Construct a select clause based on a
Selectable implementation. Read moreSource§fn as_returning() -> SelectBy<Self, DB>
fn as_returning() -> SelectBy<Self, DB>
An alias for
as_select that can be used with returning clausesSource§impl<T, ST, DB> StaticallySizedRow<ST, DB> for T
impl<T, ST, DB> StaticallySizedRow<ST, DB> for T
Source§const 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.