pub struct Collection {
pub id: CollectionId,
pub name: String,
pub runtime: Duration,
pub song_count: usize,
}Fields§
§id: CollectionIdthe unique identifier for this Collection.
name: StringThe name of the collection.
runtime: DurationTotal runtime.
song_count: usizethe number of songs this collection has.
Implementations§
Source§impl Collection
impl Collection
pub async fn create<C: Connection>( db: &Surreal<C>, collection: Self, ) -> StorageResult<Option<Self>>
pub async fn read_all<C: Connection>( db: &Surreal<C>, ) -> StorageResult<Vec<Self>>
pub async fn read<C: Connection>( db: &Surreal<C>, id: CollectionId, ) -> StorageResult<Option<Self>>
pub async fn update<C: Connection>( db: &Surreal<C>, id: CollectionId, changes: CollectionChangeSet, ) -> StorageResult<Option<Self>>
pub async fn delete<C: Connection>( db: &Surreal<C>, id: CollectionId, ) -> StorageResult<Option<Self>>
pub async fn add_songs<C: Connection>( db: &Surreal<C>, id: CollectionId, song_ids: Vec<SongId>, ) -> StorageResult<()>
pub async fn read_songs<C: Connection>( db: &Surreal<C>, id: CollectionId, ) -> StorageResult<Vec<Song>>
Sourcepub async fn remove_songs<C: Connection>(
db: &Surreal<C>,
id: CollectionId,
song_ids: Vec<SongId>,
) -> StorageResult<bool>
pub async fn remove_songs<C: Connection>( db: &Surreal<C>, id: CollectionId, song_ids: Vec<SongId>, ) -> StorageResult<bool>
Sourcepub async fn repair<C: Connection>(
db: &Surreal<C>,
id: CollectionId,
) -> StorageResult<bool>
pub async fn repair<C: Connection>( db: &Surreal<C>, id: CollectionId, ) -> StorageResult<bool>
Sourcepub async fn freeze<C: Connection>(
db: &Surreal<C>,
id: CollectionId,
name: String,
) -> StorageResult<Playlist>
pub async fn freeze<C: Connection>( db: &Surreal<C>, id: CollectionId, name: String, ) -> StorageResult<Playlist>
“Freeze” a collection, this will create a playlist with the given name that contains all the songs in the given collection
Source§impl Collection
impl Collection
pub fn generate_id() -> CollectionId
Trait Implementations§
Source§impl Clone for Collection
impl Clone for Collection
Source§fn clone(&self) -> Collection
fn clone(&self) -> Collection
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 Collection
impl Debug for Collection
Source§impl<'de> Deserialize<'de> for Collection
impl<'de> Deserialize<'de> for Collection
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 From<&Collection> for CollectionBrief
impl From<&Collection> for CollectionBrief
Source§fn from(collection: &Collection) -> Self
fn from(collection: &Collection) -> Self
Converts to this type from the input type.
Source§impl From<Collection> for CollectionBrief
impl From<Collection> for CollectionBrief
Source§fn from(collection: Collection) -> Self
fn from(collection: Collection) -> Self
Converts to this type from the input type.
Source§impl PartialEq for Collection
impl PartialEq for Collection
Source§impl Serialize for Collection
impl Serialize for Collection
Source§impl Table for Collection
impl Table for Collection
const TABLE_NAME: &'static str = "collection"
fn init_table<C: Connection>( db: &Surreal<C>, ) -> impl Future<Output = Result<()>> + Send
impl Eq for Collection
impl StructuralPartialEq for Collection
Auto Trait Implementations§
impl Freeze for Collection
impl RefUnwindSafe for Collection
impl Send for Collection
impl Sync for Collection
impl Unpin for Collection
impl UnwindSafe for Collection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.