Documentation ¶
Overview ¶
The DAO of the database
Index ¶
- Constants
- type All
- type Assign
- type Condition
- type DAO
- func (d *DAO) GetAlbumID(path string) (int, error)
- func (d *DAO) GetPerformerID(name string) (int, error)
- func (d *DAO) GetPerformerType(idPerf string) (string, error)
- func (d *DAO) Init(templatePath string) error
- func (d *DAO) InsertAlbum(path, name, year string) (sql.Result, error)
- func (d *DAO) InsertGroup(name, startDate, endDate string) (sql.Result, error)
- func (d *DAO) InsertInGroup(personID, groupID string) (sql.Result, error)
- func (d *DAO) InsertPerformer(name string) (sql.Result, error)
- func (d *DAO) InsertPerson(stageName, realName, birthDate, deathDate string) (sql.Result, error)
- func (d *DAO) InsertSong(s *Song) (sql.Result, error)
- func (d *DAO) NewSong(path string, tags *id3v2.Tag) *Song
- func (d *DAO) SearchSelect(title, artist, album string) []int
- func (d *DAO) SelectSongs(songConds []Condition) ([]*Song, error)
- func (d *DAO) SelectSongsFromAlbum(al string) []int
- func (d *DAO) SelectSongsFromArtist(ar string) []int
- func (d *DAO) SelectSongsFromTitle(title string) []int
- func (d *DAO) UpdateAlbum(albumID string, newValues []*Assign) (sql.Result, error)
- func (d *DAO) UpdateSong(s *Song, newValues []*Assign) (sql.Result, error)
- type Like
- type Song
- func (s *Song) GetAlbum() string
- func (s *Song) GetAlbumID() int
- func (s *Song) GetArtist() string
- func (s *Song) GetArtistID() int
- func (s *Song) GetGenre() string
- func (s *Song) GetID() int
- func (s *Song) GetPath() string
- func (s *Song) GetTags() *id3v2.Tag
- func (s *Song) GetTitle() string
- func (s *Song) GetYear() string
- func (s *Song) SetAlbum(a string)
- func (s *Song) SetArtist(a string)
- func (s *Song) SetGenre(g string)
- func (s *Song) SetTags(tags *id3v2.Tag)
- func (s *Song) SetTitle(t string)
- func (s *Song) SetYear(y string)
Constants ¶
const ( Insert = "INSERT INTO %s (%s) VALUES (%s);" Select = "SELECT %s FROM %s WHERE %s;" Update = "UPDATE %s SET %s WHERE %s;" )
The two queries to be used, ready for formating.
const ( Types table = iota Performers Persons Groups Albums Rolas InGroup )
Enumeration of tables
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type All ¶
type All struct{}
All gets everything
func (*All) GetStringQuery ¶
GetStringQuery gets a string representation of the query
type Assign ¶
type Assign struct {
// contains filtered or unexported fields
}
Assign is a direct assignment
func (*Assign) GetStringQuery ¶
GetStringQuery gets a string representation of the query
type Condition ¶
type Condition interface {
GetStringQuery() string
}
Condition is an interface to simulat SQL conditions
type DAO ¶
type DAO struct {
// contains filtered or unexported fields
}
DAO
func (*DAO) GetAlbumID ¶
GetAlbumID given its path in the file system
func (*DAO) GetPerformerID ¶
GetPerformerID given its name
func (*DAO) GetPerformerType ¶
GetPerformerType given its id. It can be unknown, a group or a person
func (*DAO) InsertAlbum ¶
InsertAlbum given a name and a year
func (*DAO) InsertGroup ¶
InsertGroup given the full group data
func (*DAO) InsertInGroup ¶
InsertInGroup gives the relation of member of a group
func (*DAO) InsertPerformer ¶
InsertPerformer given its name
func (*DAO) InsertPerson ¶
InsertPerson given the full person data
func (*DAO) InsertSong ¶
InsertSong inserts a song
func (*DAO) SearchSelect ¶
SearchSelect gives a slice of songs id given a title, an album and an artist to be contained in each of those fields.
func (*DAO) SelectSongs ¶
SelectSongs gets a slice of songs from the database given several conditions.
func (*DAO) SelectSongsFromAlbum ¶
SelectSongsFromAlbum gets a slice of song id give a string to be contained in the album
func (*DAO) SelectSongsFromArtist ¶
SelectSongsFromArtist gets a slice of song id give a string to be contained in the artist
func (*DAO) SelectSongsFromTitle ¶
SelectSongsFromTitle gets a slice of song id give a string to be contained in the title
func (*DAO) UpdateAlbum ¶
UpdateAlbum given some new values
type Like ¶
type Like struct {
// contains filtered or unexported fields
}
Like is a LIKE sql condition
func (*Like) GetStringQuery ¶
GetStringQuery get the LIKE sql condition