Documentation ¶
Index ¶
- type SongDB
- func (db SongDB) AddHearing(song string) (err error)
- func (db SongDB) AddHearingAndSongIfNeeded(song string) error
- func (db SongDB) AddSong(song string) (err error)
- func (db SongDB) CreateSchemaIfNotExists() (err error)
- func (db SongDB) ListFavouriteSongs() (songs []string, err error)
- func (db SongDB) ListFrecentSongs() (songs []string, err error)
- func (db SongDB) ListSongsInOrderOfAddition() (songs []string, err error)
- func (db SongDB) ListSongsInOrderOfLastHearing() (songs []string, err error)
- func (db SongDB) ListSuggestions(song string) (songs []string, err error)
- func (db SongDB) RemoveLastAddedSong() (song string, err error)
- func (db SongDB) RemoveLastHearing() (song string, err error)
- func (db SongDB) RemoveLastHearingOf(song string) (err error)
- func (db SongDB) RemoveSong(song string) (err error)
- func (db SongDB) RenameSong(song, newName string) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SongDB ¶
func (SongDB) AddHearing ¶
AddHearing registers that the given song was listened to at the current timestamp.
song must exactly match an already existing song from the database.
The current timestamp will be stored with the local timezone, to enable sorting hearings by time of day, even when traveling around timezones.
func (SongDB) AddHearingAndSongIfNeeded ¶
AddHearingAndSongIfNeeded registers that the song was listened to and, if necessary, adds the song to the database before that.
func (SongDB) AddSong ¶
AddSong adds the song with the given name and the current timestamp to the database.
Feel free to include the artist's name in the song.
The current timestamp will be stored with the local timezone, to enable sorting songs by time of day, even when traveling around timezones.
func (SongDB) CreateSchemaIfNotExists ¶
func (SongDB) ListFavouriteSongs ¶
ListFavouriteSongs lists all songs, listing those first, that you heard most often.
func (SongDB) ListFrecentSongs ¶
ListFrecentSongs lists songs you lately heard a lot, most frecent first.
func (SongDB) ListSongsInOrderOfAddition ¶
ListSongsInOrderOfAddition lists all songs in the order they were added. Newest additions will be listed first.
func (SongDB) ListSongsInOrderOfLastHearing ¶
ListSongsInOrderOfLastHearing lists all songs in the order they were last heard. The songs that were heard last will be listed first.
func (SongDB) ListSuggestions ¶
ListSuggestions lists songs that you aften hear before or after hearing the given song. Best suggestions first.
func (SongDB) RemoveLastAddedSong ¶
RemoveLastAddedSong removes the last added song from the database. Fails if there is still an entry in the hearing table, that references the song.
Returns the removed song's name.
func (SongDB) RemoveLastHearing ¶
RemoveLastHearing removes the latest hearing. Fails if there is no hearing in the database.
func (SongDB) RemoveLastHearingOf ¶
RemoveLastHearingOf removes the latest hearing of the given song. Fails if the song was never heard or the song does not exist.
func (SongDB) RemoveSong ¶
RemoveSong removes the song with the given name from the database. Fails if there is still an entry in the hearing table, that references the song.
func (SongDB) RenameSong ¶
RenameSong renames the given song to newName.