Expand description
Episode struct encapsulates a media entry representing a episode
Fields
id: i64
Unique id provided by postgres
seasonid: i64
Season id foreign_key
episode: i64
episode number
media: Media
Regerence to a media object which represents this epsiode. We are essnetially aliasing and wrapping around Media transparently, behind the scene in the db episode inherits all fields from media.
Implementations
sourceimpl Episode
impl Episode
pub async fn get_first_for_season(
conn: &mut Transaction<'_>,
season_id: i64
) -> Result<Self, DatabaseError>
pub async fn get_first_for_show(
conn: &mut Transaction<'_>,
tv_id: i64
) -> Result<Self, DatabaseError>
sourcepub async fn get_all_of_tv(
conn: &mut Transaction<'_>,
tv_show_id: i64
) -> Result<Vec<Self>, DatabaseError>
pub async fn get_all_of_tv(
conn: &mut Transaction<'_>,
tv_show_id: i64
) -> Result<Vec<Self>, DatabaseError>
Method returns all of the episodes belonging to a tv show.
Arguments
conn
- a mutable reference to a sqlx transaction.media
- reference to a media object which should be a tv show.
sourcepub async fn get_all_of_season(
conn: &mut Transaction<'_>,
season_id: i64
) -> Result<Vec<Episode>, DatabaseError>
pub async fn get_all_of_season(
conn: &mut Transaction<'_>,
season_id: i64
) -> Result<Vec<Episode>, DatabaseError>
Method returns all of the episodes belonging to a season.
Arguments
conn
- mutable reference to a sqlx transaction.media
- reference to a season object/entry.
sourcepub async fn get(
conn: &mut Transaction<'_>,
tv_id: i64,
season_num: i64,
ep_num: i64
) -> Result<Episode, DatabaseError>
pub async fn get(
conn: &mut Transaction<'_>,
tv_id: i64,
season_num: i64,
ep_num: i64
) -> Result<Episode, DatabaseError>
Method returns a episodes discriminated by episode number, season number and tv show id
Arguments
conn
- mutable reference to a sqlx transaction.id
- The id of a tv show we targetseason_num
- The season we are targettingep_num
- Episode we are targetting
pub async fn get_by_id(
conn: &mut Transaction<'_>,
episode_id: i64
) -> Result<Episode, DatabaseError>
pub async fn get_season_episode_by_id(
conn: &mut Transaction<'_>,
episode_id: i64
) -> Result<(i64, i64), DatabaseError>
pub async fn get_season_number(
&self,
conn: &mut Transaction<'_>
) -> Result<i64, DatabaseError>
sourcepub async fn get_next_episode(
&self,
conn: &mut Transaction<'_>
) -> Result<Episode, DatabaseError>
pub async fn get_next_episode(
&self,
conn: &mut Transaction<'_>
) -> Result<Episode, DatabaseError>
Function will query for the episode after the episode passed in.
sourcepub async fn get_prev_episode(
&self,
conn: &mut Transaction<'_>
) -> Result<Episode, DatabaseError>
pub async fn get_prev_episode(
&self,
conn: &mut Transaction<'_>
) -> Result<Episode, DatabaseError>
Function will query for the episode after the episode passed in.
sourcepub async fn get_last_watched_episode(
conn: &mut Transaction<'_>,
tvid: i64,
uid: UserID
) -> Result<Option<Episode>, DatabaseError>
pub async fn get_last_watched_episode(
conn: &mut Transaction<'_>,
tvid: i64,
uid: UserID
) -> Result<Option<Episode>, DatabaseError>
Function will query the last episode that was watched for a show.
sourcepub async fn delete(
conn: &mut Transaction<'_>,
episode_id: i64
) -> Result<usize, DatabaseError>
pub async fn delete(
conn: &mut Transaction<'_>,
episode_id: i64
) -> Result<usize, DatabaseError>
Method deletes a episode based on the tv show id, season number, and episode number
Arguments
&
- diesel &ection reference to postgresid
- The id of a tv show we targetseason_num
- The season we are targettingep_num
- Episode we are targetting
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Episode
impl Send for Episode
impl Sync for Episode
impl Unpin for Episode
impl UnwindSafe for Episode
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> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
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