repository

package
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

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

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

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

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

func (r *CooldownRepository) IsOnCooldown(ctx context.Context, mediaID int64) (bool, error)

IsOnCooldown checks if a specific media is on cooldown

func (*CooldownRepository) List

List retrieves cooldowns with optional filters

func (*CooldownRepository) Upsert

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

Count returns the total number of play history records

func (*HistoryRepository) Create

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

func (r *HistoryRepository) DeleteOlderThan(ctx context.Context, before time.Time) (int64, error)

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

func (r *HistoryRepository) GetPlayCount(ctx context.Context, mediaID int64) (int64, error)

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

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) Create

func (r *MediaRepository) Create(ctx context.Context, m *models.Media) error

Create inserts a new media record

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) GetByID

func (r *MediaRepository) GetByID(ctx context.Context, id int64) (*models.Media, error)

GetByID retrieves a media record by ID

func (*MediaRepository) List

List retrieves media with optional filters

func (*MediaRepository) ListByGenres

func (r *MediaRepository) ListByGenres(ctx context.Context, genres []string, mediaType models.MediaType, excludeIDs []int64) ([]models.Media, error)

ListByGenres retrieves media that has any of the specified genres

func (*MediaRepository) Upsert

func (r *MediaRepository) Upsert(ctx context.Context, m *models.Media) error

Upsert creates or updates a media record based on external_id and source

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL