db

package
v0.0.0-...-d867389 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	DB() DB
	Close() error
}

Client is a database client.

type DB

type DB interface {
	SQLExecer
	Transactor
	Pinger
	Close()
}

DB is an interface for database driver.

type Handler

type Handler func(ctx context.Context) error

Handler is a type of functions that is executed in transaction.

type NamedExecer

type NamedExecer interface {
	ScanOneContext(context.Context, interface{}, Query, ...interface{}) error
	ScanAllContext(context.Context, interface{}, Query, ...interface{}) error
}

NamedExecer is an interface for database named query.

type Pinger

type Pinger interface {
	Ping(context.Context) error
}

Pinger is an interface for database ping.

type Query

type Query struct {
	Name     string
	QueryRaw string
}

Query is a named query struct.

type QueryExecer

type QueryExecer interface {
	ExecContext(context.Context, Query, ...interface{}) (pgconn.CommandTag, error)
	QueryContext(context.Context, Query, ...interface{}) (pgx.Rows, error)
	QueryRowContext(context.Context, Query, ...interface{}) pgx.Row
}

QueryExecer is an interface for database common query.

type SQLExecer

type SQLExecer interface {
	NamedExecer
	QueryExecer
}

SQLExecer complex NamedExecer & QueryExecer

type Transactor

type Transactor interface {
	BeginTx(context.Context, pgx.TxOptions) (pgx.Tx, error)
}

Transactor is an interface for beggin database transaction.

type TxManager

type TxManager interface {
	ReadCommitted(context.Context, Handler) error
}

TxManager is an interface for transaction manager,

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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