pub struct UserPermission {
pub user_id: i32,
pub permission: String,
pub created_at: DateTime<Utc>,
}
Expand description
Rust struct modeling an entry in the user_permissions
table
Fields§
§user_id: i32
§permission: String
§created_at: DateTime<Utc>
Implementations§
Source§impl UserPermission
CRUD functions for UserPermission
impl UserPermission
CRUD functions for UserPermission
Sourcepub fn create(
db: &mut Connection,
item: &UserPermissionChangeset,
) -> QueryResult<Self>
pub fn create( db: &mut Connection, item: &UserPermissionChangeset, ) -> QueryResult<Self>
Create an entry in db
’s user_permissions
table that has the data stored in item
§Errors
diesel::result::Error
if the query fails
Sourcepub fn create_many(
db: &mut Connection,
items: Vec<UserPermissionChangeset>,
) -> QueryResult<Self>
pub fn create_many( db: &mut Connection, items: Vec<UserPermissionChangeset>, ) -> QueryResult<Self>
Create an entry in db
’s user_permissions
table for each element in items
§Errors
diesel::result::Error
if the query fails
Sourcepub fn read(
db: &mut Connection,
item_user_id: i32,
item_permission: String,
) -> QueryResult<Self>
pub fn read( db: &mut Connection, item_user_id: i32, item_permission: String, ) -> QueryResult<Self>
Read from db
, querying for an entry in the user_permissions
table that has
(item_user_id
,item_permission
) as it’s primary keys
§Errors
diesel::result::Error
if the query fails
Sourcepub fn read_all(
db: &mut Connection,
item_user_id: i32,
) -> QueryResult<Vec<Self>>
pub fn read_all( db: &mut Connection, item_user_id: i32, ) -> QueryResult<Vec<Self>>
Read from db
, querying for every entry in the user_permissions
table that has
item_user_id
as one of its primary keys
§Errors
diesel::result::Error
if the query fails
Sourcepub fn delete(
db: &mut Connection,
item_user_id: i32,
item_permission: String,
) -> QueryResult<usize>
pub fn delete( db: &mut Connection, item_user_id: i32, item_permission: String, ) -> QueryResult<usize>
Delete the entry in db
’s user_permissions
table that has
(item_user_id
,item_permission
) as it’s primary keys
§Errors
diesel::result::Error
if the query fails
Sourcepub fn delete_many(
db: &mut Connection,
item_user_id: i32,
item_permissions: Vec<String>,
) -> QueryResult<usize>
pub fn delete_many( db: &mut Connection, item_user_id: i32, item_permissions: Vec<String>, ) -> QueryResult<usize>
Delete every entry in db
’s user_permissions
table that has
item_user_id
, and an element ofitem_permissions
as it’s primary keys
§Errors
diesel::result::Error
if the query fails
Sourcepub fn delete_all(db: &mut Connection, item_user_id: i32) -> QueryResult<usize>
pub fn delete_all(db: &mut Connection, item_user_id: i32) -> QueryResult<usize>
Delete the entry in db
’s user_permissions
table that has
item_user_id
as one of it’s primary keys
§Errors
diesel::result::Error
if the query fails
Trait Implementations§
Source§impl<'update> AsChangeset for &'update UserPermission
impl<'update> AsChangeset for &'update UserPermission
Source§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
Source§fn as_changeset(self) -> <Self as AsChangeset>::Changeset
fn as_changeset(self) -> <Self as AsChangeset>::Changeset
self
into the actual update statement being executedSource§impl AsChangeset for UserPermission
impl AsChangeset for UserPermission
Source§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
Source§fn as_changeset(self) -> <Self as AsChangeset>::Changeset
fn as_changeset(self) -> <Self as AsChangeset>::Changeset
self
into the actual update statement being executedSource§impl<__FK> BelongsTo<&User> for UserPermissionwhere
__FK: Hash + Eq,
for<'__a> &'__a i32: Into<Option<&'__a __FK>>,
for<'__a> &'__a User: Identifiable<Id = &'__a __FK>,
impl<__FK> BelongsTo<&User> for UserPermissionwhere
__FK: Hash + Eq,
for<'__a> &'__a i32: Into<Option<&'__a __FK>>,
for<'__a> &'__a User: Identifiable<Id = &'__a __FK>,
Source§type ForeignKey = __FK
type ForeignKey = __FK
Source§type ForeignKeyColumn = user_id
type ForeignKeyColumn = user_id
Source§fn foreign_key(&self) -> Option<&Self::ForeignKey>
fn foreign_key(&self) -> Option<&Self::ForeignKey>
self
Source§fn foreign_key_column() -> Self::ForeignKeyColumn
fn foreign_key_column() -> Self::ForeignKeyColumn
Source§impl<__FK> BelongsTo<User> for UserPermissionwhere
__FK: Hash + Eq,
for<'__a> &'__a i32: Into<Option<&'__a __FK>>,
for<'__a> &'__a User: Identifiable<Id = &'__a __FK>,
impl<__FK> BelongsTo<User> for UserPermissionwhere
__FK: Hash + Eq,
for<'__a> &'__a i32: Into<Option<&'__a __FK>>,
for<'__a> &'__a User: Identifiable<Id = &'__a __FK>,
Source§type ForeignKey = __FK
type ForeignKey = __FK
Source§type ForeignKeyColumn = user_id
type ForeignKeyColumn = user_id
Source§fn foreign_key(&self) -> Option<&Self::ForeignKey>
fn foreign_key(&self) -> Option<&Self::ForeignKey>
self
Source§fn foreign_key_column() -> Self::ForeignKeyColumn
fn foreign_key_column() -> Self::ForeignKeyColumn
Source§impl Clone for UserPermission
impl Clone for UserPermission
Source§fn clone(&self) -> UserPermission
fn clone(&self) -> UserPermission
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for UserPermission
impl Debug for UserPermission
Source§impl<'de> Deserialize<'de> for UserPermission
impl<'de> Deserialize<'de> for UserPermission
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>,
Source§impl<__DB: Backend, __ST0, __ST1, __ST2> Queryable<(__ST0, __ST1, __ST2), __DB> for UserPermission
impl<__DB: Backend, __ST0, __ST1, __ST2> Queryable<(__ST0, __ST1, __ST2), __DB> for UserPermission
Auto Trait Implementations§
impl Freeze for UserPermission
impl RefUnwindSafe for UserPermission
impl Send for UserPermission
impl Sync for UserPermission
impl Unpin for UserPermission
impl UnwindSafe for UserPermission
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§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
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
&self
to an expression for Diesel’s query builder. Read more