pub struct Library {
    pub id: i64,
    pub name: String,
    pub locations: Vec<String>,
    pub media_type: MediaType,
}
Expand description

Library struct which we can use to deserialize database queries into.

Fields

id: i64

unique id provided by postgres

name: String

unique name of the library

locations: Vec<String>

a path on the filesystem that holds media. ie /home/user/media/movies

media_type: MediaType

Enum used to identify the media type that this library contains. At the moment only movie and tv are supported

Implementations

Method returns all libraries that exist in the database in the form of a Vec. If no libraries are found the the Vec will just be empty.

This method will not return the locations indexed for this library, if you need those you must query for them separately.

Method filters the database for a library with the id supplied and returns it. This method will also fetch the indexed locations for this library.

Arguments
  • conn - mutable reference to a sqlx transaction.
  • lib_id - a integer that is the id of the library we are trying to query

Method filters the database for a library with the id supplied and deletes it.

Arguments
  • conn - mutable reference to a sqlx transaction.
  • lib_id - a integer that is the id of the library we are trying to query

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Deserialize this value from the given Serde deserializer. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more