repository

package
v1.1.1 Latest Latest
Warning

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

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

Documentation

Overview

Package repository provides database repository implementations for media, history, and cooldowns.

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

func (r *CooldownRepository) CountActive(ctx context.Context) (int64, error)

CountActive returns the number of media currently on cooldown

func (*CooldownRepository) GetActiveCooldownMediaIDs

func (r *CooldownRepository) GetActiveCooldownMediaIDs(ctx context.Context) ([]int64, error)

GetActiveCooldownMediaIDs returns IDs of media currently 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) 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) 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

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