Documentation ¶
Index ¶
- Constants
- Variables
- func ConvertPrivacyFromString(privacy string) int64
- func ConvertPrivacyToString(privacy int64) string
- func InitDB()
- type Album
- type AlbumCount
- type Artist
- type ArtistCount
- type ArtistTag
- type GuildMember
- type Logger
- type RateYourMusicAlbum
- type RateYourMusicAlbumAlbum
- type Rating
- type Scrobble
- type Tag
- type Track
- type TrackCount
- type User
Constants ¶
const DefaultPrivacy = 5
Possible values - PRIVATE (1) - DISCORD (2) - FMUSERNAME (3) - BOTH (4) - UNSET (5) - used for displaying help messages for people who haven't set it
Variables ¶
var Db *pg.DB
Db holds a database reference
Functions ¶
func ConvertPrivacyToString ¶
Types ¶
type Album ¶
type Album struct { ID int64 `pg:",pk"` Name string ArtistID int64 Artist *Artist `pg:"rel:has-one"` }
Album represents a cached artist
type AlbumCount ¶
type AlbumCount struct { ID int64 `pg:",pk"` Playcount int32 UserID int64 User *User `pg:"rel:has-one"` AlbumID int64 Album *Album `pg:"rel:has-one"` }
AlbumCount represents aggregated album plays
type Artist ¶
type Artist struct { ID int64 `pg:",pk"` Name string CheckedForTags bool Tags []Tag `pg:"many2many:artist_tags"` }
Artist represents a cached artist
type ArtistCount ¶
type ArtistCount struct { ID int64 `pg:",pk"` Playcount int32 UserID int64 User *User `pg:"rel:has-one"` ArtistID int64 Artist *Artist `pg:"rel:has-one"` }
ArtistCount represents aggregated artist plays
type GuildMember ¶
GuildMember represents a discord user in a guild
type Logger ¶
type Logger struct{}
Logger logs queries when they are run
func (Logger) AfterQuery ¶
AfterQuery runs after a query is executed
type RateYourMusicAlbum ¶
type RateYourMusicAlbumAlbum ¶
type RateYourMusicAlbumAlbum struct { RateYourMusicAlbumID int64 RateYourMusicAlbum *RateYourMusicAlbum `pg:"rel:has-one"` AlbumID int64 Album *Album `pg:"rel:has-one"` }
type Rating ¶
type Rating struct { ID int `pg:",pk"` Rating int UserID int64 User *User `pg:"rel:has-one"` RateYourMusicAlbumID int64 RateYourMusicAlbum *RateYourMusicAlbum `pg:"rel:has-one"` }
Rating represents a single user's rating from rateyourmusic
type Scrobble ¶
type Scrobble struct { ID int64 `pg:",pk"` ScrobbledAt time.Time UserID int64 User *User `pg:"rel:has-one"` TrackID int64 Track *Track `pg:"rel:has-one"` ArtistID int64 Artist *Artist `pg:"rel:has-one"` AlbumID int64 Album *Album `pg:"rel:has-one"` }
Scrobble represents a single play of a song (eg. a Last.fm scrobble)
type Track ¶
type Track struct { ID int64 `pg:",pk"` Name string ArtistID int64 Artist *Artist `pg:"rel:has-one"` AlbumID *int64 Album *Album `pg:"rel:has-one"` }
Track represents a cached artist
type TrackCount ¶
type TrackCount struct { ID int64 `pg:",pk"` Playcount int32 UserID int64 User *User `pg:"rel:has-one"` TrackID int64 Track *Track `pg:"rel:has-one"` }
TrackCount represents aggregated track plays
type User ¶
type User struct { ID int64 `pg:",pk"` DiscordID string Username string LastIndexed time.Time LastFMSession *string Privacy int64 GuildMembers *[]GuildMember `pg:"rel:has-many"` }
User is the database model for a last.fm user
func (User) AsRequestable ¶
func (u User) AsRequestable() lastfm.Requestable
func (User) SetLastIndexed ¶
SetLastIndexed sets a user's last indexed time