Documentation
¶
Index ¶
- type CooldownRepository
- func (r *CooldownRepository) Count(ctx context.Context, opts ListCooldownOptions) (int64, error)
- func (r *CooldownRepository) CountActive(ctx context.Context) (int64, error)
- func (r *CooldownRepository) Create(ctx context.Context, c *models.MediaCooldown) error
- func (r *CooldownRepository) Delete(ctx context.Context, id int64) error
- func (r *CooldownRepository) DeleteByMediaID(ctx context.Context, mediaID int64) error
- func (r *CooldownRepository) DeleteExpired(ctx context.Context) (int64, error)
- func (r *CooldownRepository) GetActiveCooldownMediaIDs(ctx context.Context) ([]int64, error)
- func (r *CooldownRepository) GetByID(ctx context.Context, id int64) (*models.MediaCooldown, error)
- func (r *CooldownRepository) GetByMediaID(ctx context.Context, mediaID int64) (*models.MediaCooldown, error)
- func (r *CooldownRepository) IsOnCooldown(ctx context.Context, mediaID int64) (bool, error)
- func (r *CooldownRepository) List(ctx context.Context, opts ListCooldownOptions) ([]models.MediaCooldown, error)
- func (r *CooldownRepository) Upsert(ctx context.Context, c *models.MediaCooldown) error
- type HistoryRepository
- func (r *HistoryRepository) Count(ctx context.Context, opts ListHistoryOptions) (int64, error)
- func (r *HistoryRepository) Create(ctx context.Context, h *models.PlayHistory) error
- func (r *HistoryRepository) Delete(ctx context.Context, id int64) error
- func (r *HistoryRepository) DeleteOlderThan(ctx context.Context, before time.Time) (int64, error)
- func (r *HistoryRepository) GetByID(ctx context.Context, id int64) (*models.PlayHistory, error)
- func (r *HistoryRepository) GetLastPlayForMedia(ctx context.Context, mediaID int64) (*models.PlayHistory, error)
- func (r *HistoryRepository) GetPlayCount(ctx context.Context, mediaID int64) (int64, error)
- func (r *HistoryRepository) GetRecentlyPlayedMediaIDs(ctx context.Context, since time.Time) ([]int64, error)
- func (r *HistoryRepository) List(ctx context.Context, opts ListHistoryOptions) ([]models.PlayHistory, error)
- type ListCooldownOptions
- type ListHistoryOptions
- type ListMediaOptions
- type MediaRepository
- func (r *MediaRepository) Count(ctx context.Context, opts ListMediaOptions) (int64, error)
- func (r *MediaRepository) Create(ctx context.Context, m *models.Media) error
- func (r *MediaRepository) Delete(ctx context.Context, id int64) error
- func (r *MediaRepository) DeleteStale(ctx context.Context, source models.MediaSource, beforeTime time.Time) (int64, error)
- func (r *MediaRepository) GetByExternalID(ctx context.Context, externalID int64, source models.MediaSource) (*models.Media, error)
- func (r *MediaRepository) GetByID(ctx context.Context, id int64) (*models.Media, error)
- func (r *MediaRepository) List(ctx context.Context, opts ListMediaOptions) ([]models.Media, error)
- func (r *MediaRepository) ListByGenres(ctx context.Context, genres []string, mediaType models.MediaType, ...) ([]models.Media, error)
- func (r *MediaRepository) Upsert(ctx context.Context, m *models.Media) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CooldownRepository ¶
type CooldownRepository struct {
// contains filtered or unexported fields
}
CooldownRepository handles media cooldown persistence
func NewCooldownRepository ¶
func NewCooldownRepository(db database.DB) *CooldownRepository
NewCooldownRepository creates a new CooldownRepository
func (*CooldownRepository) Count ¶
func (r *CooldownRepository) Count(ctx context.Context, opts ListCooldownOptions) (int64, error)
Count returns the total number of cooldown records
func (*CooldownRepository) CountActive ¶
func (r *CooldownRepository) CountActive(ctx context.Context) (int64, error)
CountActive returns the number of media currently on cooldown
func (*CooldownRepository) Create ¶
func (r *CooldownRepository) Create(ctx context.Context, c *models.MediaCooldown) error
Create inserts a new cooldown record
func (*CooldownRepository) Delete ¶
func (r *CooldownRepository) Delete(ctx context.Context, id int64) error
Delete removes a cooldown record
func (*CooldownRepository) DeleteByMediaID ¶
func (r *CooldownRepository) DeleteByMediaID(ctx context.Context, mediaID int64) error
DeleteByMediaID removes a cooldown record by media ID
func (*CooldownRepository) DeleteExpired ¶
func (r *CooldownRepository) DeleteExpired(ctx context.Context) (int64, error)
DeleteExpired removes all expired cooldowns
func (*CooldownRepository) GetActiveCooldownMediaIDs ¶
func (r *CooldownRepository) GetActiveCooldownMediaIDs(ctx context.Context) ([]int64, error)
GetActiveCooldownMediaIDs returns IDs of media currently on cooldown
func (*CooldownRepository) GetByID ¶
func (r *CooldownRepository) GetByID(ctx context.Context, id int64) (*models.MediaCooldown, error)
GetByID retrieves a cooldown record by ID
func (*CooldownRepository) GetByMediaID ¶
func (r *CooldownRepository) GetByMediaID(ctx context.Context, mediaID int64) (*models.MediaCooldown, error)
GetByMediaID retrieves a cooldown record by media ID
func (*CooldownRepository) IsOnCooldown ¶
IsOnCooldown checks if a specific media is on cooldown
func (*CooldownRepository) List ¶
func (r *CooldownRepository) List(ctx context.Context, opts ListCooldownOptions) ([]models.MediaCooldown, error)
List retrieves cooldowns with optional filters
func (*CooldownRepository) Upsert ¶
func (r *CooldownRepository) Upsert(ctx context.Context, c *models.MediaCooldown) error
Upsert creates or updates a cooldown record
type HistoryRepository ¶
type HistoryRepository struct {
// contains filtered or unexported fields
}
HistoryRepository handles play history persistence
func NewHistoryRepository ¶
func NewHistoryRepository(db database.DB) *HistoryRepository
NewHistoryRepository creates a new HistoryRepository
func (*HistoryRepository) Count ¶
func (r *HistoryRepository) Count(ctx context.Context, opts ListHistoryOptions) (int64, error)
Count returns the total number of play history records
func (*HistoryRepository) Create ¶
func (r *HistoryRepository) Create(ctx context.Context, h *models.PlayHistory) error
Create inserts a new play history record
func (*HistoryRepository) Delete ¶
func (r *HistoryRepository) Delete(ctx context.Context, id int64) error
Delete removes a play history record
func (*HistoryRepository) DeleteOlderThan ¶
DeleteOlderThan removes play history records older than the given time
func (*HistoryRepository) GetByID ¶
func (r *HistoryRepository) GetByID(ctx context.Context, id int64) (*models.PlayHistory, error)
GetByID retrieves a play history record by ID
func (*HistoryRepository) GetLastPlayForMedia ¶
func (r *HistoryRepository) GetLastPlayForMedia(ctx context.Context, mediaID int64) (*models.PlayHistory, error)
GetLastPlayForMedia retrieves the most recent play for a specific media
func (*HistoryRepository) GetPlayCount ¶
GetPlayCount returns the number of times a media has been played
func (*HistoryRepository) GetRecentlyPlayedMediaIDs ¶
func (r *HistoryRepository) GetRecentlyPlayedMediaIDs(ctx context.Context, since time.Time) ([]int64, error)
GetRecentlyPlayedMediaIDs returns IDs of media played since the given time
func (*HistoryRepository) List ¶
func (r *HistoryRepository) List(ctx context.Context, opts ListHistoryOptions) ([]models.PlayHistory, error)
List retrieves play history with optional filters
type ListCooldownOptions ¶
type ListCooldownOptions struct {
MediaType models.MediaType
ActiveOnly bool
ExpiredOnly bool
Limit int
Offset int
}
ListCooldownOptions provides filtering options for List
type ListHistoryOptions ¶
type ListHistoryOptions struct {
MediaID int64
ChannelID string
ThemeName string
Since time.Time
Until time.Time
Limit int
Offset int
}
ListHistoryOptions provides filtering options for List
type ListMediaOptions ¶
type ListMediaOptions struct {
Source models.MediaSource
MediaType models.MediaType
HasFile *bool
MinRating float64
OrderBy string
Limit int
Offset int
}
ListMediaOptions provides filtering options for List
type MediaRepository ¶
type MediaRepository struct {
// contains filtered or unexported fields
}
MediaRepository handles media persistence
func NewMediaRepository ¶
func NewMediaRepository(db database.DB) *MediaRepository
NewMediaRepository creates a new MediaRepository
func (*MediaRepository) Count ¶
func (r *MediaRepository) Count(ctx context.Context, opts ListMediaOptions) (int64, error)
Count returns the total number of media records
func (*MediaRepository) Delete ¶
func (r *MediaRepository) Delete(ctx context.Context, id int64) error
Delete removes a media record
func (*MediaRepository) DeleteStale ¶
func (r *MediaRepository) DeleteStale(ctx context.Context, source models.MediaSource, beforeTime time.Time) (int64, error)
DeleteStale removes media that hasn't been synced since the given time
func (*MediaRepository) GetByExternalID ¶
func (r *MediaRepository) GetByExternalID(ctx context.Context, externalID int64, source models.MediaSource) (*models.Media, error)
GetByExternalID retrieves a media record by external ID and source
func (*MediaRepository) List ¶
func (r *MediaRepository) List(ctx context.Context, opts ListMediaOptions) ([]models.Media, error)
List retrieves media with optional filters