Struct database::media::InsertableMedia
source · [−]pub struct InsertableMedia {
pub library_id: i64,
pub name: String,
pub description: Option<String>,
pub rating: Option<i64>,
pub year: Option<i64>,
pub added: String,
pub poster: Option<i64>,
pub backdrop: Option<i64>,
pub media_type: MediaType,
}
Expand description
Fields
library_id: i64
name: String
description: Option<String>
rating: Option<i64>
year: Option<i64>
added: String
poster: Option<i64>
backdrop: Option<i64>
media_type: MediaType
Implementations
sourceimpl InsertableMedia
impl InsertableMedia
sourcepub async fn insert(
&self,
conn: &mut Transaction<'_>
) -> Result<i64, DatabaseError>
pub async fn insert(
&self,
conn: &mut Transaction<'_>
) -> Result<i64, DatabaseError>
sourcepub async fn insert_with_id(
&self,
conn: &mut Transaction<'_>,
id: i64
) -> Result<i64, DatabaseError>
pub async fn insert_with_id(
&self,
conn: &mut Transaction<'_>,
id: i64
) -> Result<i64, DatabaseError>
Method used to insert a new media object with a specific id.
Arguments
conn
- mutable reference to a sqlx transaction.id
- Unused ID to use for this media object.
sourcepub async fn insert_blind(
&self,
conn: &mut Transaction<'_>
) -> Result<i64, DatabaseError>
pub async fn insert_blind(
&self,
conn: &mut Transaction<'_>
) -> Result<i64, DatabaseError>
Method blindly inserts self
into the database without checking whether a similar entry exists.
This is especially useful for tv shows as they usually have similar metadata with key differences
which are not indexed in the database.
Trait Implementations
sourceimpl Clone for InsertableMedia
impl Clone for InsertableMedia
sourcefn clone(&self) -> InsertableMedia
fn clone(&self) -> InsertableMedia
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 InsertableMedia
impl Debug for InsertableMedia
sourceimpl Default for InsertableMedia
impl Default for InsertableMedia
sourcefn default() -> InsertableMedia
fn default() -> InsertableMedia
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for InsertableMedia
impl Send for InsertableMedia
impl Sync for InsertableMedia
impl Unpin for InsertableMedia
impl UnwindSafe for InsertableMedia
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>
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