database

package
v0.0.0-...-1967991 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2023 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const MaxPageItems = 2 // According to the docs

Variables

View Source
var ErrDuplicated = errors.New("operation duplicated")
View Source
var ErrForeignKey = errors.New("foreign key failed")
View Source
var ErrNoResult = sql.ErrNoRows

Functions

This section is empty.

Types

type AppDatabase

type AppDatabase interface {
	Ping() error
	Version() (int, error)
	QueryStructRow(destPointer any, query string, args ...any) error
	QueryStructRows(entityStruct any, query string, args ...any) (StructRows, error)
	Exec(query string, args ...any) error
	ExecRows(query string, args ...any) (int64, error)
	BeginTx() (transaction, error)
}

AppDatabase is an abstraction over platform *sql.DB

func New

func New(db *sqlx.DB, logger logrus.FieldLogger) (AppDatabase, error)

New returns a new instance of AppDatabase based on the SQLite connection `db`. `db` is required - an error will be returned if `db` is `nil`.

type StructRows

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

func (*StructRows) Close

func (r *StructRows) Close() error

func (*StructRows) Next

func (r *StructRows) Next() (any, error)

Next will parse and return the next row as a struct, not a pointer.

Jump to

Keyboard shortcuts

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