sqlite

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SettingIdentityFriendlyName         = "identity.friendly_name"
	SettingIdentityDeviceID             = "identity.device_id"
	SettingIdentityDeviceAuth           = "identity.device_auth"
	SettingPlaylistURL                  = "playlist.url"
	SettingJobsTimezone                 = "jobs.timezone"
	SettingJobsPlaylistSyncEnabled      = "jobs.playlist_sync.enabled"
	SettingJobsPlaylistSyncCron         = "jobs.playlist_sync.cron"
	SettingJobsAutoPrioritizeEnabled    = "jobs.auto_prioritize.enabled"
	SettingJobsAutoPrioritizeCron       = "jobs.auto_prioritize.cron"
	SettingJobsDVRLineupSyncEnabled     = "jobs.dvr_lineup_sync.enabled"
	SettingJobsDVRLineupSyncCron        = "jobs.dvr_lineup_sync.cron"
	SettingAnalyzerProbeTimeoutMS       = "analyzer.probe.timeout_ms"
	SettingAnalyzerAnalyzeDurationUS    = "analyzer.probe.analyzeduration_us"
	SettingAnalyzerProbeSizeBytes       = "analyzer.probe.probesize_bytes"
	SettingAnalyzerBitrateMode          = "analyzer.bitrate_mode"
	SettingAnalyzerSampleSeconds        = "analyzer.sample_seconds"
	SettingAutoPrioritizeEnabledOnly    = "analyzer.autoprioritize.enabled_only"
	SettingAutoPrioritizeTopNPerChannel = "analyzer.autoprioritize.top_n_per_channel"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CatalogSearchLimits

type CatalogSearchLimits struct {
	MaxTerms     int
	MaxDisjuncts int
	MaxTermRunes int
}

type CatalogSearchWarning

type CatalogSearchWarning struct {
	Mode                    string `json:"mode"`
	Truncated               bool   `json:"truncated"`
	MaxTerms                int    `json:"max_terms"`
	MaxDisjuncts            int    `json:"max_disjuncts"`
	MaxTermRunes            int    `json:"max_term_runes"`
	TermsApplied            int    `json:"terms_applied"`
	TermsDropped            int    `json:"terms_dropped"`
	DisjunctsApplied        int    `json:"disjuncts_applied"`
	DisjunctsDropped        int    `json:"disjuncts_dropped"`
	TermRuneTruncationCount int    `json:"term_rune_truncations"`
}

func CatalogSearchWarningForQuery

func CatalogSearchWarningForQuery(search string, searchRegex bool, limits CatalogSearchLimits) (CatalogSearchWarning, error)

CatalogSearchWarningForQuery returns token/regex parse warnings for a catalog search expression using the provided limits. It is useful for response metadata and logging without rebuilding store query SQL.

type RuntimePragmas

type RuntimePragmas struct {
	BusyTimeoutMS int
	Synchronous   string
	JournalMode   string
}

RuntimePragmas captures the active SQLite runtime tuning settings.

type SQLiteOptions

type SQLiteOptions struct {
	CatalogSearchLimits CatalogSearchLimits
}

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store provides SQLite-backed catalog persistence.

func Open

func Open(dbPath string) (*Store, error)

func OpenWithOptions

func OpenWithOptions(dbPath string, options SQLiteOptions) (*Store, error)

func (*Store) AddFavorite

func (s *Store) AddFavorite(ctx context.Context, itemKey string, startGuideNumber int) (favorites.Favorite, error)

func (*Store) AddSource

func (s *Store) AddSource(ctx context.Context, channelID int64, itemKey string, allowCrossChannel bool) (channels.Source, error)

func (*Store) CatalogSearchWarningForQuery

func (s *Store) CatalogSearchWarningForQuery(search string, searchRegex bool) (CatalogSearchWarning, error)

CatalogSearchWarningForQuery returns catalog-search truncation metadata for a query using the store's effective limits.

func (*Store) ClearAllSourceHealth

func (s *Store) ClearAllSourceHealth(ctx context.Context) (int64, error)

func (*Store) ClearSourceHealth

func (s *Store) ClearSourceHealth(ctx context.Context, channelID int64) (int64, error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) CreateChannelFromItem

func (s *Store) CreateChannelFromItem(ctx context.Context, itemKey, guideName, channelKey string, dynamicRule *channels.DynamicSourceRule, startGuideNumber int) (channels.Channel, error)

func (*Store) CreateDynamicChannelQuery

func (s *Store) CreateDynamicChannelQuery(ctx context.Context, create channels.DynamicChannelQueryCreate) (channels.DynamicChannelQuery, error)

func (*Store) CreateRun

func (s *Store) CreateRun(ctx context.Context, jobName, triggeredBy string, startedAt int64) (int64, error)

func (*Store) DeleteAllStreamMetrics

func (s *Store) DeleteAllStreamMetrics(ctx context.Context) (int64, error)

DeleteAllStreamMetrics removes all cached stream analysis rows.

func (*Store) DeleteChannel

func (s *Store) DeleteChannel(ctx context.Context, channelID int64, startGuideNumber int) error

func (*Store) DeleteChannelDVRMapping

func (s *Store) DeleteChannelDVRMapping(ctx context.Context, dvrInstanceID, channelID int64) error

func (*Store) DeleteDynamicChannelQuery

func (s *Store) DeleteDynamicChannelQuery(ctx context.Context, queryID int64) error

func (*Store) DeleteSource

func (s *Store) DeleteSource(ctx context.Context, channelID, sourceID int64) error

func (*Store) FinishRun

func (s *Store) FinishRun(ctx context.Context, runID int64, status, errText, summary string, finishedAt int64) error

func (*Store) GetChannelByGuideNumber

func (s *Store) GetChannelByGuideNumber(ctx context.Context, guideNumber string) (channels.Channel, error)

func (*Store) GetChannelDVRMapping

func (s *Store) GetChannelDVRMapping(
	ctx context.Context,
	dvrInstanceID,
	channelID int64,
) (dvr.ChannelMapping, error)

func (*Store) GetDVRInstance

func (s *Store) GetDVRInstance(ctx context.Context) (dvr.InstanceConfig, error)

func (*Store) GetDynamicChannelQuery

func (s *Store) GetDynamicChannelQuery(ctx context.Context, queryID int64) (channels.DynamicChannelQuery, error)

func (*Store) GetGroups

func (s *Store) GetGroups(ctx context.Context) ([]playlist.Group, error)

func (*Store) GetRun

func (s *Store) GetRun(ctx context.Context, runID int64) (jobs.Run, error)

func (*Store) GetSetting

func (s *Store) GetSetting(ctx context.Context, key string) (string, error)

GetSetting returns one setting value.

func (*Store) GetSource

func (s *Store) GetSource(ctx context.Context, channelID, sourceID int64, enabledOnly bool) (channels.Source, error)

func (*Store) GetStreamMetric

func (s *Store) GetStreamMetric(ctx context.Context, itemKey string) (jobs.StreamMetric, error)

GetStreamMetric returns one cached stream analysis row by item key.

func (*Store) IterateActiveItemKeysByCatalogFilter

func (s *Store) IterateActiveItemKeysByCatalogFilter(
	ctx context.Context,
	groupNames []string,
	searchQuery string,
	searchRegex bool,
	pageSize int,
	visit func(itemKey string) error,
) (int, error)

IterateActiveItemKeysByCatalogFilter iterates active catalog item keys matching the provided group+search filter in deterministic (name,item_key) order.

func (*Store) ListActiveItemKeysByCatalogFilter

func (s *Store) ListActiveItemKeysByCatalogFilter(ctx context.Context, groupNames []string, searchQuery string, searchRegex bool) ([]string, error)

ListActiveItemKeysByCatalogFilter returns active playlist item keys matching catalog group+search filters. Matching semantics intentionally mirror the /api/items query behavior.

func (*Store) ListActiveItemKeysByChannelKey

func (s *Store) ListActiveItemKeysByChannelKey(ctx context.Context, channelKey string) ([]string, error)

ListActiveItemKeysByChannelKey returns active playlist item keys for one channel_key.

func (*Store) ListCatalogItems

func (s *Store) ListCatalogItems(ctx context.Context, q playlist.Query) ([]playlist.Item, int, error)

ListCatalogItems returns only the catalog list fields needed by /api/items.

func (*Store) ListChannels

func (s *Store) ListChannels(ctx context.Context, enabledOnly bool) ([]channels.Channel, error)

func (*Store) ListChannelsForDVRSync

func (s *Store) ListChannelsForDVRSync(
	ctx context.Context,
	dvrInstanceID int64,
	enabledOnly bool,
	includeDynamic bool,
) ([]dvr.ChannelMapping, error)

func (*Store) ListChannelsForDVRSyncPaged

func (s *Store) ListChannelsForDVRSyncPaged(
	ctx context.Context,
	dvrInstanceID int64,
	enabledOnly bool,
	includeDynamic bool,
	limit int,
	offset int,
) ([]dvr.ChannelMapping, int, error)

func (*Store) ListChannelsPaged

func (s *Store) ListChannelsPaged(ctx context.Context, enabledOnly bool, limit, offset int) ([]channels.Channel, int, error)

func (*Store) ListDuplicateSuggestions

func (s *Store) ListDuplicateSuggestions(ctx context.Context, minItems int, searchQuery string, limit, offset int) ([]channels.DuplicateGroup, int, error)

func (*Store) ListDynamicChannelQueries

func (s *Store) ListDynamicChannelQueries(ctx context.Context) ([]channels.DynamicChannelQuery, error)

func (*Store) ListDynamicChannelQueriesPaged

func (s *Store) ListDynamicChannelQueriesPaged(ctx context.Context, limit, offset int) ([]channels.DynamicChannelQuery, int, error)

func (*Store) ListDynamicGeneratedChannelsPaged

func (s *Store) ListDynamicGeneratedChannelsPaged(ctx context.Context, queryID int64, limit, offset int) ([]channels.Channel, int, error)

func (*Store) ListFavorites

func (s *Store) ListFavorites(ctx context.Context, enabledOnly bool) ([]favorites.Favorite, error)

func (*Store) ListGroupsPaged

func (s *Store) ListGroupsPaged(ctx context.Context, limit, offset int, includeCounts bool) ([]playlist.Group, int, error)

func (*Store) ListItems

func (s *Store) ListItems(ctx context.Context, q playlist.Query) ([]playlist.Item, int, error)

func (*Store) ListLineupChannels

func (s *Store) ListLineupChannels(ctx context.Context) ([]channels.Channel, error)

func (*Store) ListRuns

func (s *Store) ListRuns(ctx context.Context, jobName string, limit, offset int) ([]jobs.Run, error)

func (*Store) ListSettings

func (s *Store) ListSettings(ctx context.Context, keyPrefix string) (map[string]string, error)

ListSettings returns key/value settings, optionally filtered by a key prefix.

func (*Store) ListSources

func (s *Store) ListSources(ctx context.Context, channelID int64, enabledOnly bool) ([]channels.Source, error)

func (*Store) ListSourcesByChannelIDs

func (s *Store) ListSourcesByChannelIDs(ctx context.Context, channelIDs []int64, enabledOnly bool) (map[int64][]channels.Source, error)

func (*Store) ListSourcesPaged

func (s *Store) ListSourcesPaged(ctx context.Context, channelID int64, enabledOnly bool, limit, offset int) ([]channels.Source, int, error)

func (*Store) MarkSourceFailure

func (s *Store) MarkSourceFailure(ctx context.Context, sourceID int64, reason string, failedAt time.Time) error

func (*Store) MarkSourceSuccess

func (s *Store) MarkSourceSuccess(ctx context.Context, sourceID int64, succeededAt time.Time) error

func (*Store) RefreshDynamicGeneratedGuideNames

func (s *Store) RefreshDynamicGeneratedGuideNames(ctx context.Context) (int, error)

RefreshDynamicGeneratedGuideNames re-synchronizes dynamic generated channel guide names from active catalog items without mutating slot/order assignments.

func (*Store) RemoveFavorite

func (s *Store) RemoveFavorite(ctx context.Context, favID int64, startGuideNumber int) error

func (*Store) ReorderChannels

func (s *Store) ReorderChannels(ctx context.Context, channelIDs []int64, startGuideNumber int) error

func (*Store) ReorderDynamicGeneratedChannels

func (s *Store) ReorderDynamicGeneratedChannels(ctx context.Context, queryID int64, channelIDs []int64) error

func (*Store) ReorderFavorites

func (s *Store) ReorderFavorites(ctx context.Context, favIDs []int64, startGuideNumber int) error

func (*Store) ReorderSources

func (s *Store) ReorderSources(ctx context.Context, channelID int64, sourceIDs []int64) error

func (*Store) RuntimePragmas

func (s *Store) RuntimePragmas(ctx context.Context) (RuntimePragmas, error)

RuntimePragmas reads active SQLite runtime settings for startup logging and tests.

func (*Store) SetSetting

func (s *Store) SetSetting(ctx context.Context, key, value string) error

SetSetting upserts one setting value.

func (*Store) SetSettings

func (s *Store) SetSettings(ctx context.Context, values map[string]string) error

SetSettings upserts multiple setting values in one transaction.

func (*Store) SyncDynamicChannelBlocks

func (s *Store) SyncDynamicChannelBlocks(ctx context.Context) (channels.DynamicChannelSyncResult, error)

func (*Store) SyncDynamicSources

func (s *Store) SyncDynamicSources(ctx context.Context, channelID int64, matchedItemKeys []string) (channels.DynamicSourceSyncResult, error)

func (*Store) SyncDynamicSourcesByCatalogFilter

func (s *Store) SyncDynamicSourcesByCatalogFilter(
	ctx context.Context,
	channelID int64,
	groupNames []string,
	searchQuery string,
	searchRegex bool,
	pageSize int,
	maxMatches int,
) (channels.DynamicSourceSyncResult, int, error)

SyncDynamicSourcesByCatalogFilter synchronizes one channel's dynamic sources by iterating catalog matches in bounded pages and staging matched keys in a temp table.

func (*Store) UpdateChannel

func (s *Store) UpdateChannel(ctx context.Context, channelID int64, guideName *string, enabled *bool, dynamicRule *channels.DynamicSourceRule) (channels.Channel, error)

func (*Store) UpdateDynamicChannelQuery

func (s *Store) UpdateDynamicChannelQuery(ctx context.Context, queryID int64, update channels.DynamicChannelQueryUpdate) (channels.DynamicChannelQuery, error)

func (*Store) UpdateRunProgress

func (s *Store) UpdateRunProgress(ctx context.Context, runID int64, progressCur, progressMax int, summary string) error

func (*Store) UpdateSource

func (s *Store) UpdateSource(ctx context.Context, channelID, sourceID int64, enabled *bool) (channels.Source, error)

func (*Store) UpdateSourceProfile

func (s *Store) UpdateSourceProfile(ctx context.Context, sourceID int64, profile channels.SourceProfileUpdate) error

func (*Store) UpsertChannelDVRMapping

func (s *Store) UpsertChannelDVRMapping(
	ctx context.Context,
	mapping dvr.ChannelMapping,
) (dvr.ChannelMapping, error)

func (*Store) UpsertDVRInstance

func (s *Store) UpsertDVRInstance(ctx context.Context, instance dvr.InstanceConfig) (dvr.InstanceConfig, error)

func (*Store) UpsertPlaylistItems

func (s *Store) UpsertPlaylistItems(ctx context.Context, items []playlist.Item) error

func (*Store) UpsertPlaylistItemsStream

func (s *Store) UpsertPlaylistItemsStream(ctx context.Context, stream playlist.ItemStream) (int, error)

UpsertPlaylistItemsStream upserts playlist items from an incremental stream in one transaction.

func (*Store) UpsertStreamMetric

func (s *Store) UpsertStreamMetric(ctx context.Context, metric jobs.StreamMetric) error

UpsertStreamMetric creates or updates one cached stream analysis row.

Jump to

Keyboard shortcuts

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