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
sourceimpl 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
sourceimpl<'update> AsChangeset for &'update Attachment
impl<'update> AsChangeset for &'update Attachment
type Target = table
type Target = table
The table which Self::Changeset
will be updating
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
sourcefn as_changeset(self) -> Self::Changeset
fn as_changeset(self) -> Self::Changeset
Convert self
into the actual update statement being executed
sourceimpl AsChangeset for Attachment
impl AsChangeset for Attachment
type Target = table
type Target = table
The table which Self::Changeset
will be updating
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
sourcefn as_changeset(self) -> Self::Changeset
fn as_changeset(self) -> Self::Changeset
Convert self
into the actual update statement being executed
sourceimpl Clone for Attachment
impl Clone for Attachment
sourcefn clone(&self) -> Attachment
fn clone(&self) -> Attachment
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 Attachment
impl Debug for Attachment
sourceimpl<'de> Deserialize<'de> for Attachment
impl<'de> Deserialize<'de> for Attachment
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 HasTable for Attachment
impl HasTable for Attachment
sourceimpl<'ident> Identifiable for &'ident Attachment
impl<'ident> Identifiable for &'ident Attachment
sourceimpl<__DB: Backend, __ST0, __ST1, __ST2, __ST3, __ST4, __ST5> Queryable<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5), __DB> for Attachment where
(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 Attachment where
(i32, String, String, i32, i32, DateTime<Utc>): FromStaticSqlRow<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5), __DB>,
sourceimpl Serialize for Attachment
impl Serialize for Attachment
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
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