pub struct RolePermission {
pub role: String,
pub permission: String,
pub created_at: DateTime<Utc>,
}
Expand description
Rust struct modeling an entry in the role_permissions
table
Fields§
§role: String
§permission: String
§created_at: DateTime<Utc>
Implementations§
Source§impl RolePermission
CRUD functions for RolePermission
impl RolePermission
CRUD functions for RolePermission
Sourcepub fn create(
db: &mut Connection,
item: &RolePermissionChangeset,
) -> QueryResult<Self>
pub fn create( db: &mut Connection, item: &RolePermissionChangeset, ) -> QueryResult<Self>
Create an entry in db
’s role_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<RolePermissionChangeset>,
) -> QueryResult<Vec<Self>>
pub fn create_many( db: &mut Connection, items: Vec<RolePermissionChangeset>, ) -> QueryResult<Vec<Self>>
Create an entry in db
’s role_permissions
table for each element in items
§Errors
diesel::result::Error
if the query fails
Sourcepub fn read(
db: &mut Connection,
item_role: String,
item_permission: String,
) -> QueryResult<Self>
pub fn read( db: &mut Connection, item_role: String, item_permission: String, ) -> QueryResult<Self>
Read from db
, querying for an entry in the role_permissions
table that has
(item_role
,item_permission
) as it’s primary keys
§Errors
diesel::result::Error
if the query fails
Sourcepub fn read_all(
db: &mut Connection,
item_role: String,
) -> QueryResult<Vec<Self>>
pub fn read_all( db: &mut Connection, item_role: String, ) -> QueryResult<Vec<Self>>
Read from db
, querying for every entry in the role_permissions
table that has
item_role
as one of its primary keys
§Errors
diesel::result::Error
if the query fails
Sourcepub fn delete(
db: &mut Connection,
item_role: String,
item_permission: String,
) -> QueryResult<usize>
pub fn delete( db: &mut Connection, item_role: String, item_permission: String, ) -> QueryResult<usize>
Delete the entry in db
’s role_permissions
table that has
(item_role
,item_permission
) as it’s primary keys
§Errors
diesel::result::Error
if the query fails
Sourcepub fn delete_many(
db: &mut Connection,
item_role: String,
item_permissions: Vec<String>,
) -> QueryResult<usize>
pub fn delete_many( db: &mut Connection, item_role: String, item_permissions: Vec<String>, ) -> QueryResult<usize>
Delete every entry in db
’s role_permissions
table that has
item_role
, 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_role: &str) -> QueryResult<usize>
pub fn delete_all(db: &mut Connection, item_role: &str) -> QueryResult<usize>
Delete the entry in db
’s role_permissions
table that has
item_role
as one of it’s primary keys
§Errors
diesel::result::Error
if the query fails
Trait Implementations§
Source§impl<'update> AsChangeset for &'update RolePermission
impl<'update> AsChangeset for &'update RolePermission
Source§type Changeset = <(Grouped<Eq<role, <&'update String as AsExpression<<role 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<role, <&'update String as AsExpression<<role 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 RolePermission
impl AsChangeset for RolePermission
Source§type Changeset = <(Grouped<Eq<role, <String as AsExpression<<role 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<role, <String as AsExpression<<role 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 Clone for RolePermission
impl Clone for RolePermission
Source§fn clone(&self) -> RolePermission
fn clone(&self) -> RolePermission
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 RolePermission
impl Debug for RolePermission
Source§impl<'de> Deserialize<'de> for RolePermission
impl<'de> Deserialize<'de> for RolePermission
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 RolePermission
impl<__DB: Backend, __ST0, __ST1, __ST2> Queryable<(__ST0, __ST1, __ST2), __DB> for RolePermission
Auto Trait Implementations§
impl Freeze for RolePermission
impl RefUnwindSafe for RolePermission
impl Send for RolePermission
impl Sync for RolePermission
impl Unpin for RolePermission
impl UnwindSafe for RolePermission
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