store

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2025 License: Apache-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSQLite

func NewSQLite(dbFilePath string, requiredVer uint) (*sql.DB, error)

NewSQLite opens new SQLite database.

Types

type SQLiteStore

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

SQLiteStore is a SQLite implementation of the Store interface.

func NewSQLiteStore

func NewSQLiteStore(db *sql.DB) *SQLiteStore

NewSQLiteStore creates a new SQLiteStore instance.

func (*SQLiteStore) Begin

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

Begin returns a new SQLiteStore within a transaction

func (*SQLiteStore) Close

func (s *SQLiteStore) Close()

Close closes the database connection.

func (*SQLiteStore) Commit

func (s *SQLiteStore) Commit() error

Commit commits the transaction.

func (*SQLiteStore) EpisodeCreate

func (s *SQLiteStore) EpisodeCreate(ctx context.Context, episode *entities.Episode) error

EpisodeCreate creates a new episode in the database

func (*SQLiteStore) EpisodeGetByOriginalUrl

func (s *SQLiteStore) EpisodeGetByOriginalUrl(ctx context.Context, url string) ([]*entities.Episode, error)

EpisodeGetByOriginalUrl returns episodes by original URL

func (*SQLiteStore) EpisodeListAll

func (s *SQLiteStore) EpisodeListAll(ctx context.Context) ([]*entities.Episode, error)

EpisodeListAll returns all episodes from the database

func (*SQLiteStore) ProcessCountByUrlAndStatus

func (s *SQLiteStore) ProcessCountByUrlAndStatus(ctx context.Context, url string, status entities.Status) (int, error)

func (*SQLiteStore) ProcessGetByStatus

func (s *SQLiteStore) ProcessGetByStatus(ctx context.Context, status entities.Status) ([]*entities.Process, error)

func (*SQLiteStore) ProcessUpsert

func (s *SQLiteStore) ProcessUpsert(ctx context.Context, process *entities.Process) error

ProcessUpsert creates or updates a process in the database

func (*SQLiteStore) Rollback

func (s *SQLiteStore) Rollback() error

Rollback aborts the transaction.

type Store

type Store interface {
	// Close the store and release all resources.
	Close()
	// Begin starts a new transaction and returns a new Store instance.
	Begin(ctx context.Context) (Store, error)
	// Commit commits the current transaction.
	Commit() error
	// Rollback aborts the current transaction.
	Rollback() error

	// EpisodeCreate creates a new episode record in the store.
	EpisodeCreate(ctx context.Context, episode *entities.Episode) error
	// EpisodeListAll returns all episodes from the store in descending order by creation date.
	EpisodeListAll(ctx context.Context) ([]*entities.Episode, error)
	// EpisodeGetByOriginalUrl returns episodes matching the given original URL.
	EpisodeGetByOriginalUrl(ctx context.Context, url string) ([]*entities.Episode, error)

	// ProcessUpsert creates or updates a process record in the store.
	ProcessUpsert(ctx context.Context, process *entities.Process) error
	// ProcessGetByStatus returns processes matching the given status.
	ProcessGetByStatus(ctx context.Context, status entities.Status) ([]*entities.Process, error)
	// ProcessCountByUrlAndStatus returns the count of processes matching the given URL and status.
	ProcessCountByUrlAndStatus(ctx context.Context, url string, status entities.Status) (int, error)
}

Store defines the interface for a data store that manages episodes and processes.

Jump to

Keyboard shortcuts

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