database

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDataNotFound        = errors.New("data not found")
	ErrOrderValueIncorrect = errors.New("order value is incorrect")
	ErrDataAlreadyExists   = errors.New("data already exists")
	ErrDataUsedElsewhere   = errors.New("data used elsewhere")
)

Functions

This section is empty.

Types

type Database

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

func Init

func Init(logger *zerolog.Logger, conf *config.Database) (*Database, error)

func (*Database) MusicAlbumsCreate

func (db *Database) MusicAlbumsCreate(a *models.Album) (*models.Album, error)

func (*Database) MusicAlbumsDelete

func (db *Database) MusicAlbumsDelete(albumID int64) error

func (*Database) MusicAlbumsGet

func (db *Database) MusicAlbumsGet(albumID int64) (*models.AlbumWithArtists, error)

func (*Database) MusicAlbumsGetList

func (db *Database) MusicAlbumsGetList(start, count int64, orderBy []string) ([]*models.AlbumWithArtists, error)

func (*Database) MusicAlbumsGetListByArtist

func (db *Database) MusicAlbumsGetListByArtist(artistID int64, orderBy []string) ([]*models.Album, error)

func (*Database) MusicAlbumsSearchByName

func (db *Database) MusicAlbumsSearchByName(start, count int64, orderBy []string, name string) (
	[]*models.AlbumWithArtists, error)

func (*Database) MusicAlbumsUpdateImage

func (db *Database) MusicAlbumsUpdateImage(albumID int64, image string) error

func (*Database) MusicAlbumsUpdateTexts

func (db *Database) MusicAlbumsUpdateTexts(album *models.Album) error

func (*Database) MusicAristsAppendTrack

func (db *Database) MusicAristsAppendTrack(artistID, trackID int64) error

func (*Database) MusicAristsCreate

func (db *Database) MusicAristsCreate(artist *models.Artist) (*models.Artist, error)

func (*Database) MusicAristsDelete

func (db *Database) MusicAristsDelete(artistID int64) error

func (*Database) MusicAristsDeleteTrack

func (db *Database) MusicAristsDeleteTrack(artistID, trackID int64) error

func (*Database) MusicAristsGet

func (db *Database) MusicAristsGet(artistID int64) (*models.Artist, error)

func (*Database) MusicAristsGetList

func (db *Database) MusicAristsGetList(start, count int64, orderBy []string) ([]*models.Artist, error)

func (*Database) MusicAristsSearchByName

func (db *Database) MusicAristsSearchByName(start, count int64, orderBy []string, name string) (
	[]*models.Artist, error)

func (*Database) MusicAristsUpdateImage

func (db *Database) MusicAristsUpdateImage(artistID int64, image string) error

func (*Database) MusicAristsUpdateTexts

func (db *Database) MusicAristsUpdateTexts(artist *models.Artist) error

func (*Database) MusicCreate

func (db *Database) MusicCreate(fileMiddle, fileHigh, image string, duration, uid int64,
	info *music.Music, preData *models.PreMusicData) (int64, error)

MusicCreate creates new music row in the DB

func (*Database) MusicGenresAppendTrack

func (db *Database) MusicGenresAppendTrack(genreID, trackID int64) error

func (*Database) MusicGenresCreate

func (db *Database) MusicGenresCreate(g *models.Genre) (*models.Genre, error)

func (*Database) MusicGenresDelete

func (db *Database) MusicGenresDelete(genreID int64) error

func (*Database) MusicGenresDeleteTrack

func (db *Database) MusicGenresDeleteTrack(genreID, trackID int64) error

func (*Database) MusicGenresGet

func (db *Database) MusicGenresGet(genreID int64) (*models.Genre, error)

func (*Database) MusicGenresGetAlbums

func (db *Database) MusicGenresGetAlbums(start, count, genreID int64, orderBy []string) (
	[]*models.AlbumWithArtists, error)

func (*Database) MusicGenresGetArtists

func (db *Database) MusicGenresGetArtists(start, count, genreID int64, orderBy []string) ([]*models.Artist, error)

func (*Database) MusicGenresGetList

func (db *Database) MusicGenresGetList(orderBy []string) ([]*models.Genre, error)

func (*Database) MusicGenresGetTracks

func (db *Database) MusicGenresGetTracks(start, count, genreID int64, orderBy []string) (
	[]*models.TrackWithAlbumArtists, error)

func (*Database) MusicGenresUpdateTexts

func (db *Database) MusicGenresUpdateTexts(genre *models.Genre) error

func (*Database) MusicGetAlbumPicture

func (db *Database) MusicGetAlbumPicture(album, artist string) (has bool, pic string, err error)

MusicGetAlbumPicture returns true if album already has picture also returns name of the picture file

func (*Database) MusicIsExists

func (db *Database) MusicIsExists(trackName, album, artist string) bool

MusicIsExists returns true if db already has row with that data

func (*Database) MusicTagsAppendAlbum

func (db *Database) MusicTagsAppendAlbum(tagID, albumID int64) error

func (*Database) MusicTagsAppendArtist

func (db *Database) MusicTagsAppendArtist(tagID, artistID int64) error

func (*Database) MusicTagsAppendTrack

func (db *Database) MusicTagsAppendTrack(tagID, trackID int64) error

func (*Database) MusicTagsCreate

func (db *Database) MusicTagsCreate(t *models.Tag) (*models.Tag, error)

func (*Database) MusicTagsDelete

func (db *Database) MusicTagsDelete(tagID int64) error

func (*Database) MusicTagsDeleteAlbum

func (db *Database) MusicTagsDeleteAlbum(tagID, albumID int64) error

func (*Database) MusicTagsDeleteArtist

func (db *Database) MusicTagsDeleteArtist(tagID, artistID int64) error

func (*Database) MusicTagsDeleteTrack

func (db *Database) MusicTagsDeleteTrack(tagID, trackID int64) error

func (*Database) MusicTagsGet

func (db *Database) MusicTagsGet(tagID int64) (*models.Tag, error)

func (*Database) MusicTagsGetAlbums

func (db *Database) MusicTagsGetAlbums(start, count int64, tags, notTags []int64, orderBy []string) (
	[]*models.AlbumWithArtists, error)

func (*Database) MusicTagsGetArtists

func (db *Database) MusicTagsGetArtists(start, count int64, tags, notTags []int64, orderBy []string) (
	[]*models.Artist, error)

func (*Database) MusicTagsGetList

func (db *Database) MusicTagsGetList(orderBy []string) ([]*models.TagWithVariants, error)

func (*Database) MusicTagsGetListByAlbum

func (db *Database) MusicTagsGetListByAlbum(albumID int64, orderBy []string) ([]*models.Tag, error)

func (*Database) MusicTagsGetListByArtist

func (db *Database) MusicTagsGetListByArtist(artistID int64, orderBy []string) ([]*models.Tag, error)

func (*Database) MusicTagsGetListByTrack

func (db *Database) MusicTagsGetListByTrack(trackID int64, orderBy []string) ([]*models.Tag, error)

func (*Database) MusicTagsGetTracks

func (db *Database) MusicTagsGetTracks(start, count int64, tags, notTags []int64, orderBy []string) (
	[]*models.TrackWithAlbumArtists, error)

func (*Database) MusicTagsSearchByName

func (db *Database) MusicTagsSearchByName(orderBy []string, name string) ([]*models.TagWithVariants, error)

func (*Database) MusicTagsUpdateTexts

func (db *Database) MusicTagsUpdateTexts(tag *models.Tag) error

func (*Database) MusicTracksDelete

func (db *Database) MusicTracksDelete(trackID int64) error

func (*Database) MusicTracksGet

func (db *Database) MusicTracksGet(trackID int64) (*models.TrackWithGenresAlbumArtists, error)

func (*Database) MusicTracksGetList

func (db *Database) MusicTracksGetList(start, count int64, orderBy []string) ([]*models.TrackWithAlbumArtists, error)

func (*Database) MusicTracksGetListByAlbum

func (db *Database) MusicTracksGetListByAlbum(albumID int64, orderBy []string,
) ([]*models.TrackWithAlbumArtists, error)

func (*Database) MusicTracksGetListByArtist

func (db *Database) MusicTracksGetListByArtist(artistID int64, orderBy []string) (
	[]*models.TrackWithAlbumArtists, error)

func (*Database) MusicTracksSearchByName

func (db *Database) MusicTracksSearchByName(start, count int64, orderBy []string, name string) (
	[]*models.TrackWithAlbumArtists, error)

func (*Database) MusicTracksUpdateAlbum

func (db *Database) MusicTracksUpdateAlbum(trackID, albumID int64) error

func (*Database) MusicTracksUpdateTexts

func (db *Database) MusicTracksUpdateTexts(track *models.Track) error

func (*Database) SettingsGetList

func (db *Database) SettingsGetList() (map[string]string, error)

func (*Database) SettingsUpdateList

func (db *Database) SettingsUpdateList(setsData map[string]string) error

func (*Database) TasksCreate

func (db *Database) TasksCreate(fileName string, uid int64) (taskID int64, err error)

func (*Database) TasksGet

func (db *Database) TasksGet(taskID, userID int64) (*models.Task, error)

func (*Database) TasksGetListByUser

func (db *Database) TasksGetListByUser(start, count, userID int64, orderBy []string) ([]*models.Task, error)

func (*Database) TasksSetStatusError

func (db *Database) TasksSetStatusError(taskID int64, errorText string) error

func (*Database) TasksSetStatusInProgress

func (db *Database) TasksSetStatusInProgress(taskID int64) error

func (*Database) TasksSetStatusSuccess

func (db *Database) TasksSetStatusSuccess(taskID, trackID int64) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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