Struct create_rust_app::auth::UserPermission
source · [−]pub struct UserPermission {
pub user_id: i32,
pub permission: String,
pub created_at: DateTime<Utc>,
}Fields
user_id: i32permission: Stringcreated_at: DateTime<Utc>Implementations
sourceimpl UserPermission
impl UserPermission
pub fn create(
db: &mut Connection,
item: &UserPermissionChangeset
) -> QueryResult<Self>
pub fn create_many(
db: &mut Connection,
items: Vec<UserPermissionChangeset>
) -> QueryResult<Self>
pub fn read(
db: &mut Connection,
item_user_id: i32,
item_permission: String
) -> QueryResult<Self>
pub fn read_all(db: &mut Connection, item_user_id: i32) -> QueryResult<Vec<Self>>
pub fn delete(
db: &mut Connection,
item_user_id: i32,
item_permission: String
) -> QueryResult<usize>
pub fn delete_many(
db: &mut Connection,
item_user_id: i32,
item_permissions: Vec<String>
) -> QueryResult<usize>
pub fn delete_all(db: &mut Connection, item_user_id: i32) -> QueryResult<usize>
Trait Implementations
sourceimpl<'update> AsChangeset for &'update UserPermission
impl<'update> AsChangeset for &'update UserPermission
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<permission, <&'update String as AsExpression<<permission as Expression>::SqlType>>::Expression>>, Grouped<Eq<created_at, <&'update DateTime<Utc> as AsExpression<<created_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<permission, <&'update String as AsExpression<<permission as Expression>::SqlType>>::Expression>>, Grouped<Eq<created_at, <&'update DateTime<Utc> as AsExpression<<created_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 UserPermission
impl AsChangeset for UserPermission
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<permission, <String as AsExpression<<permission as Expression>::SqlType>>::Expression>>, Grouped<Eq<created_at, <DateTime<Utc> as AsExpression<<created_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<permission, <String as AsExpression<<permission as Expression>::SqlType>>::Expression>>, Grouped<Eq<created_at, <DateTime<Utc> as AsExpression<<created_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 UserPermission 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 UserPermission 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 UserPermission 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 UserPermission 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 UserPermission
impl Clone for UserPermission
sourcefn clone(&self) -> UserPermission
fn clone(&self) -> UserPermission
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 UserPermission
impl Debug for UserPermission
sourceimpl<'de> Deserialize<'de> for UserPermission
impl<'de> Deserialize<'de> for UserPermission
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<__DB: Backend, __ST0, __ST1, __ST2> Queryable<(__ST0, __ST1, __ST2), __DB> for UserPermission where
(i32, String, DateTime<Utc>): FromStaticSqlRow<(__ST0, __ST1, __ST2), __DB>,
impl<__DB: Backend, __ST0, __ST1, __ST2> Queryable<(__ST0, __ST1, __ST2), __DB> for UserPermission where
(i32, String, DateTime<Utc>): FromStaticSqlRow<(__ST0, __ST1, __ST2), __DB>,
sourceimpl Serialize for UserPermission
impl Serialize for UserPermission
Auto Trait Implementations
impl RefUnwindSafe for UserPermission
impl Send for UserPermission
impl Sync for UserPermission
impl Unpin for UserPermission
impl UnwindSafe for UserPermission
Blanket Implementations
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