repository

package
v0.0.0-...-174de0b Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MigrateSchema

func MigrateSchema(cfg *config.DB, instance int) error

func RunTx

func RunTx(ctx context.Context, db TxRunner, fn TxFunc) error

Types

type DB

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

func NewDB

func NewDB(cfg *config.DB) (*DB, error)

func NewPostgresDB

func NewPostgresDB(cfg *config.DB) (*DB, error)

func (*DB) Close

func (db *DB) Close() error

type LogRepository

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

func NewRepository

func NewRepository(db *DB, log *zap.Logger) *LogRepository

func (*LogRepository) ReadLog

func (r *LogRepository) ReadLog(ctx context.Context, id int) (models.Log, error)

func (*LogRepository) ReadLogs

func (r *LogRepository) ReadLogs(ctx context.Context) ([]models.Log, error)

func (*LogRepository) WriteLog

func (r *LogRepository) WriteLog(ctx context.Context, raw string) (int64, error)

type TxFunc

type TxFunc func(tx *sqlx.Tx) error

type TxRunner

type TxRunner interface {
	BeginTxx(ctx context.Context, opts *sql.TxOptions) (*sqlx.Tx, error)
}

Jump to

Keyboard shortcuts

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