storage

package
v0.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2021 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package local implements having local cache of remote serve relational data (artist,album,playlist,song).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Db

type Db struct {
	// contains filtered or unexported fields
}

Db implements storing relational data to local database as cache. Schema reflects the data coming from server and tries to store updated content and not enforce relational integrity. This should also mean getting data from db and server should return same results for same queries.

func NewDb

func NewDb(id string) (*Db, error)

func (*Db) Close

func (db *Db) Close() error

func (*Db) GetAlbums

func (db *Db) GetAlbums(query *interfaces.QueryOpts) (albums []*models.Album, n int, err error)

func (*Db) GetArtists

func (db *Db) GetArtists(query *interfaces.QueryOpts) (artists []*models.Artist, count int, err error)

func (*Db) GetPlaylists

func (db *Db) GetPlaylists() ([]*models.Playlist, error)

func (*Db) GetSongs

func (db *Db) GetSongs(page int, pageSize int) ([]*models.Song, int, error)

func (*Db) GetStats

func (db *Db) GetStats() (models.StorageInfo, error)

func (*Db) UpdateAlbums

func (db *Db) UpdateAlbums(albums []*models.Album) error

func (*Db) UpdateArtists

func (db *Db) UpdateArtists(artists []*models.Artist) error

UpdateArtists updates/inserts artists.

func (*Db) UpdatePlaylists

func (db *Db) UpdatePlaylists(playlists []*models.Playlist) error

UpdatePlaylists updates playlists. Songs are expected to already exist.

func (*Db) UpdateSongs

func (db *Db) UpdateSongs(songs []*models.Song) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL