db

package
v0.0.0-...-aa210b9 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Initialize

func Initialize(dbName string, dsn string) *sqlx.DB

Types

type SqliteStore

type SqliteStore struct {
	DB *sqlx.DB
}

func (*SqliteStore) ApplyMigrations

func (s *SqliteStore) ApplyMigrations(migrations embed.FS) error

func (*SqliteStore) ExecCustom

func (s *SqliteStore) ExecCustom(query string, args ...interface{}) error

func (*SqliteStore) GetByCategory

func (s *SqliteStore) GetByCategory(category string) (models.ComboDBMediaItem, error)

func (*SqliteStore) GetCustom

func (s *SqliteStore) GetCustom(query string, args ...interface{}) (models.ComboDBMediaItem, error)

func (*SqliteStore) GetNewest

func (s *SqliteStore) GetNewest() (models.ComboDBMediaItem, error)

func (*SqliteStore) GetRecent

func (s *SqliteStore) GetRecent() ([]models.ComboDBMediaItem, error)

func (*SqliteStore) GetTokenByID

func (s *SqliteStore) GetTokenByID(id string) string

func (*SqliteStore) Insert

func (s *SqliteStore) Insert(item models.MediaItem) error

func (*SqliteStore) UpsertToken

func (s *SqliteStore) UpsertToken(id, value string) error

type Store

type Store interface {
	ApplyMigrations(migrations embed.FS) error
	GetRecent() ([]models.ComboDBMediaItem, error)
	GetNewest() (models.ComboDBMediaItem, error)
	GetByCategory(category string) (models.ComboDBMediaItem, error)
	Insert(item models.MediaItem) error
	GetCustom(query string, args ...interface{}) (models.ComboDBMediaItem, error)
	ExecCustom(query string, args ...interface{}) error
	GetTokenByID(id string) string
	UpsertToken(id, value string) error
}

func NewSqliteStore

func NewSqliteStore(dsn string) (Store, error)

Jump to

Keyboard shortcuts

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