database

package
v0.0.0-...-b88af98 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Album

type Album struct {
	Type
	// contains filtered or unexported fields
}

func GetAlbumFromDatabase

func GetAlbumFromDatabase(db *Database, id int) *Album

func GetAlbumFromRow

func GetAlbumFromRow(db *Database, row *sql.Rows) (*Album, error)

func GetAlbumsFromDatabaseByName

func GetAlbumsFromDatabaseByName(db *Database, name string) (albums []*Album)

func InsertAlbumToDatabase

func InsertAlbumToDatabase(db *Database, names map[string]string) *Album

func (*Album) AddArtist

func (r *Album) AddArtist(artist *AlbumArtist)

func (*Album) AddName

func (r *Album) AddName(kind, name string)

func (*Album) AddTag

func (r *Album) AddTag(tag *Tag)

func (*Album) GetArtists

func (r *Album) GetArtists() (artists []*AlbumArtist)

func (*Album) GetCover

func (r *Album) GetCover() *Resource

func (*Album) GetId

func (r *Album) GetId() int

func (*Album) GetIdentifiers

func (r *Album) GetIdentifiers() []string

func (*Album) GetMetadata

func (r *Album) GetMetadata() (result map[string]interface{})

func (*Album) GetNames

func (r *Album) GetNames() map[string]string

func (*Album) GetTags

func (r *Album) GetTags() (tags []*Tag)

func (*Album) RemoveArtist

func (r *Album) RemoveArtist(artist *AlbumArtist)

func (*Album) RemoveName

func (r *Album) RemoveName(kind string)

func (*Album) RemoveTag

func (r *Album) RemoveTag(tag *Tag)

func (*Album) SetCover

func (r *Album) SetCover(resource *Resource)

func (*Album) SetIdentifiers

func (r *Album) SetIdentifiers(identifiers []string)

func (*Album) SetMetadata

func (r *Album) SetMetadata(value map[string]interface{})

type AlbumArtist

type AlbumArtist struct {
	Artist
	// contains filtered or unexported fields
}

func GetAlbumArtistFromRow

func GetAlbumArtistFromRow(db *Database, row *sql.Rows) (*AlbumArtist, error)

type Artist

type Artist struct {
	Type
	// contains filtered or unexported fields
}

func GetArtistFromDatabase

func GetArtistFromDatabase(db *Database, id int) *Artist

func GetArtistFromRow

func GetArtistFromRow(db *Database, row *sql.Rows) (*Artist, error)

func GetArtistsFromDatabaseByName

func GetArtistsFromDatabaseByName(db *Database, name string) (artists []*Artist)

func InsertArtistToDatabase

func InsertArtistToDatabase(db *Database, names map[string]string) *Artist

func (*Artist) AddName

func (r *Artist) AddName(kind, name string)

func (*Artist) GetId

func (r *Artist) GetId() int

func (*Artist) GetMetadata

func (r *Artist) GetMetadata() (result map[string]interface{})

func (*Artist) GetNames

func (r *Artist) GetNames() map[string]string

func (*Artist) RemoveName

func (r *Artist) RemoveName(kind string)

func (*Artist) SetMetadata

func (r *Artist) SetMetadata(value map[string]interface{})

type Database

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

func OpenDatabase

func OpenDatabase(connStr string) (*Database, error)

func (*Database) Close

func (db *Database) Close() error

func (*Database) Exec

func (db *Database) Exec(query string, args ...interface{}) (sql.Result, error)

func (*Database) GetTx

func (db *Database) GetTx() (*sql.Tx, error)

func (*Database) Query

func (db *Database) Query(query string, args ...interface{}) (*sql.Rows, error)

type HashEntry

type HashEntry struct {
	Value HashIdentifier
	Kind  string
}

type HashIdentifier

type HashIdentifier multihash.DecodedMultihash

HashIdentifier Main identifier

func NewHashIdentifierFromMultihash

func NewHashIdentifierFromMultihash(mh multihash.Multihash) *HashIdentifier

func (*HashIdentifier) CID

func (i *HashIdentifier) CID() cid.Cid

func (*HashIdentifier) Encode

func (i *HashIdentifier) Encode() []byte

func (*HashIdentifier) Equals

func (i *HashIdentifier) Equals(o *HashIdentifier) bool

func (*HashIdentifier) Hash

func (i *HashIdentifier) Hash() multihash.Multihash

func (*HashIdentifier) IsKey

func (i *HashIdentifier) IsKey() bool

type Release

type Release struct {
	Type
	// contains filtered or unexported fields
}

func GetReleaseFromDatabase

func GetReleaseFromDatabase(db *Database, id int64) *Release

func GetReleaseFromRow

func GetReleaseFromRow(db *Database, row *sql.Rows) (*Release, error)

func GetReleasesFromDatabaseByIdentifier

func GetReleasesFromDatabaseByIdentifier(db *Database, identifier string) (releases []*Release)

func InsertReleaseToDatabase

func InsertReleaseToDatabase(db *Database, identifiers []string) *Release

func (*Release) GetId

func (r *Release) GetId() int64

func (*Release) GetIdentifiers

func (r *Release) GetIdentifiers() []string

func (*Release) GetMetadata

func (r *Release) GetMetadata() (result map[string]interface{})

func (*Release) SetIdentifiers

func (r *Release) SetIdentifiers(identifiers []string)

func (*Release) SetMetadata

func (r *Release) SetMetadata(value map[string]interface{})

type Resource

type Resource struct {
	Type
	// contains filtered or unexported fields
}

func GetResourceFromDatabase

func GetResourceFromDatabase(db *Database, id int64) *Resource

func GetResourceFromDatabaseByHash

func GetResourceFromDatabaseByHash(db *Database, hash ResourceHashIdentifier) *Resource

func GetResourceFromDatabaseByPath

func GetResourceFromDatabaseByPath(db *Database, pathEntry string) *Resource

func GetResourceFromRow

func GetResourceFromRow(db *Database, row *sql.Rows) (*Resource, error)

func InsertResourceToDatabase

func InsertResourceToDatabase(db *Database, hash ResourceHashIdentifier, size int64, path []byte, mime string) *Resource

func (*Resource) AddRelease

func (r *Resource) AddRelease(release *Release)

func (*Resource) GetHash

func (r *Resource) GetHash() ResourceHashIdentifier

func (*Resource) GetId

func (r *Resource) GetId() int64

func (*Resource) GetMime

func (r *Resource) GetMime() string

func (*Resource) GetPath

func (r *Resource) GetPath() []byte

func (*Resource) GetReleases

func (r *Resource) GetReleases() (releases []*Release)

func (*Resource) GetSize

func (r *Resource) GetSize() int64

func (*Resource) SetMime

func (r *Resource) SetMime(mime string)

func (*Resource) SetPath

func (r *Resource) SetPath(path []byte)

func (*Resource) SetSize

func (r *Resource) SetSize(size int64)

type ResourceHashIdentifier

type ResourceHashIdentifier [sha256.Size]byte

func (ResourceHashIdentifier) ToBytes

func (h ResourceHashIdentifier) ToBytes() []byte

type Song

type Song struct {
	Type
	// contains filtered or unexported fields
}

func GetSongFromDatabase

func GetSongFromDatabase(db *Database, id int64) *Song

func GetSongFromRow

func GetSongFromRow(db *Database, row *sql.Rows) (*Song, error)

func GetSongsFromDatabaseByName

func GetSongsFromDatabaseByName(db *Database, name string) (songs []*Song)

func InsertSongToDatabase

func InsertSongToDatabase(db *Database, resourceId int64, names map[string]string) *Song

func (*Song) AddArtist

func (r *Song) AddArtist(artist *SongArtist)

func (*Song) AddName

func (r *Song) AddName(kind, name string)

func (*Song) AddTag

func (r *Song) AddTag(tag *Tag)

func (*Song) GetAlbum

func (r *Song) GetAlbum() *Album

func (*Song) GetArtists

func (r *Song) GetArtists() (artists []*SongArtist)

func (*Song) GetCover

func (r *Song) GetCover() *Resource

func (*Song) GetId

func (r *Song) GetId() int64

func (*Song) GetMetadata

func (r *Song) GetMetadata() (result map[string]interface{})

func (*Song) GetNames

func (r *Song) GetNames() map[string]string

func (*Song) GetResource

func (r *Song) GetResource() *Resource

func (*Song) GetTags

func (r *Song) GetTags() (tags []*Tag)

func (*Song) RemoveArtist

func (r *Song) RemoveArtist(artist *SongArtist)

func (*Song) RemoveName

func (r *Song) RemoveName(kind string)

func (*Song) RemoveTag

func (r *Song) RemoveTag(tag *Tag)

func (*Song) SetAlbum

func (r *Song) SetAlbum(album *Album)

func (*Song) SetCover

func (r *Song) SetCover(resource *Resource)

func (*Song) SetMetadata

func (r *Song) SetMetadata(value map[string]interface{})

type SongArtist

type SongArtist struct {
	Artist
	// contains filtered or unexported fields
}

func GetSongArtistFromRow

func GetSongArtistFromRow(db *Database, row *sql.Rows) (*SongArtist, error)

type Tag

type Tag struct {
	Type
	// contains filtered or unexported fields
}

func GetOrCreateTagFromDatabaseByName

func GetOrCreateTagFromDatabaseByName(db *Database, name string) (tag *Tag)

func GetTagFromDatabase

func GetTagFromDatabase(db *Database, id int64) *Tag

func GetTagFromDatabaseByName

func GetTagFromDatabaseByName(db *Database, name string) *Tag

func GetTagFromRow

func GetTagFromRow(db *Database, row *sql.Rows) (*Tag, error)

func InsertTagToDatabase

func InsertTagToDatabase(db *Database, name string) *Tag

func (*Tag) GetAlbums

func (r *Tag) GetAlbums() (albums []*Album)

func (*Tag) GetId

func (r *Tag) GetId() int64

func (*Tag) GetName

func (r *Tag) GetName() string

type Type

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

Jump to

Keyboard shortcuts

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