Documentation ¶
Index ¶
- Variables
- type CacheKey
- type Client
- func (c *Client) GetAllSongsID(ctx context.Context) ([]pkg.SongID, error)
- func (c *Client) GetSongByID(ctx context.Context, id pkg.SongID) (*pkg.Song, error)
- func (c *Client) GetUserSong(ctx context.Context, id pkg.SongID, user string) (*pkg.Song, error)
- func (c *Client) SetSong(ctx context.Context, song *pkg.Song) error
- func (c *Client) SetSongForced(ctx context.Context, song *pkg.Song) error
- func (c *Client) SetUserSong(ctx context.Context, song *pkg.Song, user string) error
- func (c *Client) UpsertSongIncPlaybacks(ctx context.Context, new *pkg.Song) (int, error)
- func (c *Client) WriteBatch(ctx context.Context, songs []*pkg.Song) error
- type Item
- type Service
- func (s *Service) GetRandomSongs(ctx context.Context, n int) ([]*pkg.Song, error)
- func (s *Service) GetSong(ctx context.Context, id pkg.SongID) (*pkg.Song, error)
- func (s *Service) IncrementUserRequests(ctx context.Context, song *pkg.Song, userID string)
- func (s *Service) SetSong(ctx context.Context, song *pkg.Song) error
- func (s *Service) UpsertSongIncPlaybacks(ctx context.Context, new *pkg.Song) (int, error)
- type SongsCache
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = errors.New("no docs found")
Functions ¶
This section is empty.
Types ¶
type Client ¶
func NewFirestoreClient ¶
func (*Client) GetAllSongsID ¶
func (*Client) GetSongByID ¶
func (*Client) GetUserSong ¶
func (*Client) SetSongForced ¶
func (*Client) SetUserSong ¶
func (*Client) UpsertSongIncPlaybacks ¶
UpsertSongIncPlaybacks We don't use it because our cash of songs is always consistent As we have only one writer to the song db - this bot
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewFirestoreService ¶
func (*Service) GetRandomSongs ¶
func (*Service) IncrementUserRequests ¶
type SongsCache ¶
SongsCache TODO: there is no need in this cache because firestore.client has it's own that can be reused
func NewSongsCache ¶
func NewSongsCache(ctx context.Context, expirationTime time.Duration) *SongsCache
func (*SongsCache) Clear ¶
func (c *SongsCache) Clear()
Click to show internal directories.
Click to hide internal directories.