Struct create_rust_app::Attachment
source · pub struct Attachment {
pub id: i32,
pub name: String,
pub record_type: String,
pub record_id: i32,
pub blob_id: i32,
pub created_at: DateTime<Utc>,
}
Fields§
§id: i32
§name: String
§record_type: String
§record_id: i32
§blob_id: i32
§created_at: DateTime<Utc>
Implementations§
source§impl Attachment
impl Attachment
sourcepub async fn attach(
db: &mut Connection,
storage: &Storage,
name: String,
record_type: String,
record_id: i32,
data: AttachmentData,
allow_multiple: bool,
overwrite_existing: bool
) -> Result<String, String>
pub async fn attach( db: &mut Connection, storage: &Storage, name: String, record_type: String, record_id: i32, data: AttachmentData, allow_multiple: bool, overwrite_existing: bool ) -> Result<String, String>
in actix_web we don’t need to support send+sync handlers, so we can use the &mut Connection directly.
sourcepub async fn detach(
db: &mut Connection,
storage: &Storage,
item_id: i32
) -> Result<(), String>
pub async fn detach( db: &mut Connection, storage: &Storage, item_id: i32 ) -> Result<(), String>
in actix_web we don’t need to support send+sync handlers, so we can use the &mut Connection directly.
pub async fn detach_all( db: &mut Connection, storage: &Storage, name: String, record_type: String, record_id: i32 ) -> Result<(), String>
pub fn find_for_record( db: &mut Connection, item_name: String, item_record_type: String, item_record_id: i32 ) -> QueryResult<Self>
pub fn find_all_for_record( db: &mut Connection, item_name: String, item_record_type: String, item_record_id: i32 ) -> QueryResult<Vec<Self>>
pub fn find_all_for_records( db: &mut Connection, item_name: String, item_record_type: String, item_record_ids: Vec<i32> ) -> QueryResult<Vec<Self>>
Trait Implementations§
source§impl<'update> AsChangeset for &'update Attachment
impl<'update> AsChangeset for &'update Attachment
§type Changeset = <(Grouped<Eq<name, <&'update String as AsExpression<<name as Expression>::SqlType>>::Expression>>, Grouped<Eq<record_type, <&'update String as AsExpression<<record_type as Expression>::SqlType>>::Expression>>, Grouped<Eq<record_id, <&'update i32 as AsExpression<<record_id as Expression>::SqlType>>::Expression>>, Grouped<Eq<blob_id, <&'update i32 as AsExpression<<blob_id 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<name, <&'update String as AsExpression<<name as Expression>::SqlType>>::Expression>>, Grouped<Eq<record_type, <&'update String as AsExpression<<record_type as Expression>::SqlType>>::Expression>>, Grouped<Eq<record_id, <&'update i32 as AsExpression<<record_id as Expression>::SqlType>>::Expression>>, Grouped<Eq<blob_id, <&'update i32 as AsExpression<<blob_id 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
source§fn as_changeset(self) -> Self::Changeset
fn as_changeset(self) -> Self::Changeset
Convert
self
into the actual update statement being executedsource§impl AsChangeset for Attachment
impl AsChangeset for Attachment
§type Changeset = <(Grouped<Eq<name, <String as AsExpression<<name as Expression>::SqlType>>::Expression>>, Grouped<Eq<record_type, <String as AsExpression<<record_type as Expression>::SqlType>>::Expression>>, Grouped<Eq<record_id, <i32 as AsExpression<<record_id as Expression>::SqlType>>::Expression>>, Grouped<Eq<blob_id, <i32 as AsExpression<<blob_id 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<name, <String as AsExpression<<name as Expression>::SqlType>>::Expression>>, Grouped<Eq<record_type, <String as AsExpression<<record_type as Expression>::SqlType>>::Expression>>, Grouped<Eq<record_id, <i32 as AsExpression<<record_id as Expression>::SqlType>>::Expression>>, Grouped<Eq<blob_id, <i32 as AsExpression<<blob_id 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
source§fn as_changeset(self) -> Self::Changeset
fn as_changeset(self) -> Self::Changeset
Convert
self
into the actual update statement being executedsource§impl Clone for Attachment
impl Clone for Attachment
source§fn clone(&self) -> Attachment
fn clone(&self) -> Attachment
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for Attachment
impl Debug for Attachment
source§impl<'de> Deserialize<'de> for Attachment
impl<'de> Deserialize<'de> for Attachment
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 HasTable for Attachment
impl HasTable for Attachment
source§impl<'ident> Identifiable for &'ident Attachment
impl<'ident> Identifiable for &'ident Attachment
source§impl<__DB: Backend, __ST0, __ST1, __ST2, __ST3, __ST4, __ST5> Queryable<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5), __DB> for Attachmentwhere
(i32, String, String, i32, i32, DateTime<Utc>): 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 Attachmentwhere (i32, String, String, i32, i32, DateTime<Utc>): FromStaticSqlRow<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5), __DB>,
Auto Trait Implementations§
impl RefUnwindSafe for Attachment
impl Send for Attachment
impl Sync for Attachment
impl Unpin for Attachment
impl UnwindSafe for Attachment
Blanket Implementations§
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> IntoSql for T
impl<T> IntoSql for T
source§fn into_sql<T>(self) -> Self::Expressionwhere
Self: AsExpression<T> + Sized,
T: SqlType + TypedExpressionType,
fn into_sql<T>(self) -> Self::Expressionwhere Self: AsExpression<T> + Sized, T: SqlType + TypedExpressionType,
Convert
self
to an expression for Diesel’s query builder. Read moresource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere
&'a Self: AsExpression<T>,
T: SqlType + TypedExpressionType,
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere &'a Self: AsExpression<T>, T: SqlType + TypedExpressionType,
Convert
&self
to an expression for Diesel’s query builder. Read moresource§impl<T, ST, DB> StaticallySizedRow<ST, DB> for Twhere
ST: SqlTypeOrSelectable + TupleSize,
T: Queryable<ST, DB>,
DB: Backend,
impl<T, ST, DB> StaticallySizedRow<ST, DB> for Twhere ST: SqlTypeOrSelectable + TupleSize, T: Queryable<ST, DB>, DB: Backend,
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.