database

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: GPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAPIRepo

func NewAPIRepo(log logger.Logger, db *DB) domain.APIRepo

func NewMangaDataRepo

func NewMangaDataRepo(log logger.Logger, db *DB) domain.MangaDataRepo

func NewNotificationRepo

func NewNotificationRepo(log logger.Logger, db *DB) domain.NotificationRepo

func NewSyncRepo

func NewSyncRepo(log logger.Logger, db *DB) domain.SyncRepo

func NewUserRepo

func NewUserRepo(log logger.Logger, db *DB) domain.UserRepo

Types

type APIRepo

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

func (*APIRepo) Delete

func (r *APIRepo) Delete(ctx context.Context, key string) error

func (*APIRepo) Get added in v0.3.0

func (r *APIRepo) Get(ctx context.Context, key string) (*domain.APIKey, error)

func (*APIRepo) GetKeys

func (r *APIRepo) GetKeys(ctx context.Context) ([]domain.APIKey, error)

func (*APIRepo) Store

func (r *APIRepo) Store(ctx context.Context, key *domain.APIKey) error

type DB

type DB struct {
	Driver string
	DSN    string
	// contains filtered or unexported fields
}

func NewDB

func NewDB(cfg *domain.Config, log logger.Logger) (*DB, error)

func (*DB) BeginTx

func (db *DB) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)

func (*DB) Close

func (db *DB) Close() error

func (*DB) Open

func (db *DB) Open() error

func (*DB) Ping

func (db *DB) Ping() error

type ILikeDynamic

type ILikeDynamic interface {
	ToSql() (sql string, args []interface{}, err error)
}

func ILike

func ILike(col string, val string) ILikeDynamic

ILike is a wrapper for sq.Like and sq.ILike SQLite does not support ILike but postgres does so this checks what database is being used

type MangaRepo

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

func (MangaRepo) Delete

func (m MangaRepo) Delete(ctx context.Context, id int) error

func (MangaRepo) GetMangaDataByApiKey

func (m MangaRepo) GetMangaDataByApiKey(ctx context.Context, apiKey string) (*domain.BackupData, error)

func (MangaRepo) ListMangaData

func (m MangaRepo) ListMangaData(ctx context.Context, apiKey string) ([]domain.BackupData, error)

func (MangaRepo) Store

func (m MangaRepo) Store(ctx context.Context, mdata *domain.BackupData) (*domain.BackupData, error)

func (MangaRepo) Update

func (m MangaRepo) Update(ctx context.Context, mdata *domain.BackupData) (*domain.BackupData, error)

type NotificationRepo

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

func (*NotificationRepo) Delete

func (r *NotificationRepo) Delete(ctx context.Context, notificationID int) error

func (*NotificationRepo) Find

func (*NotificationRepo) FindByID

func (r *NotificationRepo) FindByID(ctx context.Context, id int) (*domain.Notification, error)

func (*NotificationRepo) List

func (*NotificationRepo) Store

func (r *NotificationRepo) Store(ctx context.Context, notification domain.Notification) (*domain.Notification, error)

func (*NotificationRepo) Update

func (r *NotificationRepo) Update(ctx context.Context, notification domain.Notification) (*domain.Notification, error)

type SyncRepo

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

func (SyncRepo) CreateSyncLockFile added in v0.3.4

func (r SyncRepo) CreateSyncLockFile(ctx context.Context, apiKey string, acquiredBy string) (*domain.SyncLockFile, error)

func (SyncRepo) Delete

func (r SyncRepo) Delete(ctx context.Context, id int) error

func (SyncRepo) DeleteSyncLockFile added in v0.3.4

func (r SyncRepo) DeleteSyncLockFile(ctx context.Context, apiKey string) bool

func (SyncRepo) GetSyncByApiKey

func (r SyncRepo) GetSyncByApiKey(ctx context.Context, apiKey string) (*domain.Sync, error)

func (SyncRepo) GetSyncLockFile added in v0.3.4

func (r SyncRepo) GetSyncLockFile(ctx context.Context, apiKey string) (*domain.SyncLockFile, error)

func (SyncRepo) ListSyncs

func (r SyncRepo) ListSyncs(ctx context.Context, apiKey string) ([]domain.Sync, error)

func (SyncRepo) Store

func (r SyncRepo) Store(ctx context.Context, sync *domain.Sync) (*domain.Sync, error)

func (SyncRepo) Update

func (r SyncRepo) Update(ctx context.Context, sync *domain.Sync) (*domain.Sync, error)

func (SyncRepo) UpdateSyncLockFile added in v0.3.4

func (r SyncRepo) UpdateSyncLockFile(ctx context.Context, syncLockFile *domain.SyncLockFile) (*domain.SyncLockFile, error)

type Tx

type Tx struct {
	*sql.Tx
	// contains filtered or unexported fields
}

type UserRepo

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

func (*UserRepo) FindByUsername

func (r *UserRepo) FindByUsername(ctx context.Context, username string) (*domain.User, error)

func (*UserRepo) GetUserCount

func (r *UserRepo) GetUserCount(ctx context.Context) (int, error)

func (*UserRepo) Store

func (r *UserRepo) Store(ctx context.Context, user domain.User) error

func (*UserRepo) Update

func (r *UserRepo) Update(ctx context.Context, user domain.User) error

Jump to

Keyboard shortcuts

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