database

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *sql.DB

Functions

func CountAlbums

func CountAlbums() int

func CountArtists

func CountArtists() int

func CountSongs

func CountSongs() int

func CreateAlbum

func CreateAlbum(tx *sql.Tx, name string, artist string, picture string, year int) error

func CreateArtist

func CreateArtist(tx *sql.Tx, name string) error

func CreatePicture

func CreatePicture(tx *sql.Tx, path string, mime string) error

func CreateSong

func CreateSong(tx *sql.Tx, s *Song, picture string) error

func GetPicturePath

func GetPicturePath(id int) (string, error)

func GetRandomSong

func GetRandomSong() int

func GetSongPath

func GetSongPath(id int) (string, error)

func Start

func Start(f string) error

Types

type Album added in v0.3.0

type Album struct {
	ID      int         `json:"id,omitempty"`
	Name    string      `json:"name"`
	Artist  string      `json:"artist,omitempty"`
	Picture int         `json:"picture"`
	Year    int         `json:"year,omitempty"`
	Songs   []albumSong `json:"songs,omitempty"`
}

func GetAlbum

func GetAlbum(id int) (Album, error)

func GetAlbums

func GetAlbums(page int) ([]Album, error)

type Artist added in v0.3.0

type Artist struct {
	ID      int     `json:"id,omitempty"`
	Name    string  `json:"name"`
	Albums  []Album `json:"albums,omitempty"`
	Singles []Song  `json:"singles,omitempty"`
}

func GetArtist

func GetArtist(id int) (Artist, error)

func GetArtists

func GetArtists(page int) ([]Artist, error)

type Song

type Song struct {
	ID      int    `json:"id,omitempty"`
	Title   string `json:"title"`
	Artist  string `json:"artist,omitempty"`
	Album   string `json:"album,omitempty"`
	Path    string `json:"path,omitempty"`
	Track   int    `json:"track,omitempty"`
	Year    int    `json:"year,omitempty"`
	Mime    string `json:"mime,omitempty"`
	Picture int    `json:"picture,omitempty"`
	Disc    int    `json:"disc,omitempty"`
}

func GetSong

func GetSong(id int) (Song, error)

func GetSongs

func GetSongs(page int) ([]Song, error)

Jump to

Keyboard shortcuts

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