Struct mostro_core::user::User

source ·
pub struct User {
    pub id: Uuid,
    pub pubkey: String,
    pub is_admin: i64,
    pub is_solver: i64,
    pub is_banned: i64,
    pub category: i64,
    pub created_at: i64,
}
Expand description

Database representation of an user

Fields§

§id: Uuid§pubkey: String§is_admin: i64§is_solver: i64§is_banned: i64§category: i64§created_at: i64

Implementations§

source§

impl User

source

pub fn new( pubkey: String, is_admin: i64, is_solver: i64, is_banned: i64, category: i64 ) -> Self

Trait Implementations§

source§

impl Clone for User

source§

fn clone(&self) -> User

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'e> Crud<'e, &'e Pool<Sqlite>> for User

source§

fn insert_args(self) -> <Sqlite as HasArguments<'e>>::Arguments

Returns an owned instance of [sqlx::Arguments]. self is consumed. Values in the fields are moved in to the Arguments instance.
source§

fn update_args(self) -> <Sqlite as HasArguments<'e>>::Arguments

Returns an owned instance of [sqlx::Arguments]. self is consumed. Values in the fields are moved in to the Arguments instance.
source§

fn create( self, pool: E ) -> Pin<Box<dyn Future<Output = Result<Self, Error>> + Send + 'e>>

Returns a future that resolves to an insert or sqlx::Error of the current instance. Read more
source§

fn all( pool: E ) -> TryCollect<Pin<Box<dyn Stream<Item = Result<Self, Error>> + Send + 'e>>, Vec<Self>>

Queries all records from the table and returns a future that returns to a try_collect stream, which resolves to a Vec<Self> or a sqlx::Error on error. Read more
source§

fn by_id( pool: E, id: Self::Id ) -> Pin<Box<dyn Future<Output = Result<Option<Self>, Error>> + Send + 'e>>

Looks up a row by ID and returns a future that resolves an Option<Self>. Returns None if and a record with the corresponding ID cannot be found and Some if it exists. Read more
source§

fn update( self, pool: E ) -> Pin<Box<dyn Future<Output = Result<Self, Error>> + Send + 'e>>

Updates the database with the current instance state and returns a future that resolves to the new Self returned from the database. Read more
source§

fn delete( self, pool: E ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'e>>

Deletes a record from the database by ID and returns a future that resolves to () on success or sqlx::Error on failure. Read more
source§

impl Debug for User

source§

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

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

impl<'de> Deserialize<'de> for User

source§

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<'a, R: Row> FromRow<'a, R> for User
where &'a str: ColumnIndex<R>, Uuid: Decode<'a, R::Database> + Type<R::Database>, String: Decode<'a, R::Database> + Type<R::Database>, i64: Decode<'a, R::Database> + Type<R::Database>,

source§

fn from_row(row: &'a R) -> Result<Self>

source§

impl PartialEq for User

source§

fn eq(&self, other: &User) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Schema for User

§

type Id = Uuid

Type of the table primary key column.
source§

fn table_name() -> &'static str

Database name of the table. Used by the query generation code and available for introspection. This is generated by taking the plural snake_case of the struct’s name. See: Inflector to_table_case. Read more
source§

fn id(&self) -> Self::Id

Returns the id of the current instance.
source§

fn id_column() -> &'static str

Returns the column name of the primary key.
source§

fn columns() -> &'static [&'static str]

Returns an array of column names.
source§

fn select_sql() -> &'static str

Returns the SQL string for a SELECT query against the table. Read more
source§

fn select_by_id_sql() -> &'static str

Returns the SQL string for a SELECT query against the table with a WHERE clause for the primary key. Read more
source§

fn insert_sql() -> &'static str

Returns the SQL for inserting a new record in to the database. The #[external_id] attribute may be used to specify IDs are assigned outside of the database. Read more
source§

fn update_by_id_sql() -> &'static str

Returns the SQL for updating an existing record in the database. Read more
source§

fn delete_by_id_sql() -> &'static str

Returns the SQL for deleting an existing record by ID from the database. Read more
source§

impl Serialize for User

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for User

source§

impl StructuralPartialEq for User

Auto Trait Implementations§

§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

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>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,