database

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 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 NewDeviceRepo

func NewDeviceRepo(log logger.Logger, db *DB) domain.DeviceRepo

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

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

func (DeviceRepo) Delete

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

func (DeviceRepo) GetDeviceByApiKey

func (r DeviceRepo) GetDeviceByApiKey(ctx context.Context, device *domain.Device) (*domain.Device, error)

func (DeviceRepo) GetDeviceByDeviceId

func (r DeviceRepo) GetDeviceByDeviceId(ctx context.Context, device *domain.Device) (*domain.Device, error)

func (DeviceRepo) ListDevices

func (r DeviceRepo) ListDevices(ctx context.Context, apikey string) ([]domain.Device, error)

func (DeviceRepo) Store

func (r DeviceRepo) Store(ctx context.Context, device *domain.Device) (*domain.Device, 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.MangaData, error)

func (MangaRepo) ListMangaData

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

func (MangaRepo) Store

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

func (MangaRepo) Update

func (m MangaRepo) Update(ctx context.Context, mdata *domain.MangaData) (*domain.MangaData, 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) Delete

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

func (SyncRepo) GetSyncByApiKey

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

func (SyncRepo) GetSyncByDeviceID

func (r SyncRepo) GetSyncByDeviceID(ctx context.Context, deviceID int) (*domain.Sync, 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) SyncData

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

func (SyncRepo) Update

func (r SyncRepo) Update(ctx context.Context, sync *domain.Sync) (*domain.Sync, 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