postgres

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPgx

func NewPgx(conn PgxConn) *pgxConn

func NewSQL

func NewSQL(conn SQLConn) *dbSQL

Types

type Conn

type Conn interface {
	BeginFunc(ctx context.Context, f func(Conn) error) (err error)
	Exec(ctx context.Context, sql string, arguments ...interface{}) (int, error)
	Query(ctx context.Context, sql string, optionsAndArgs ...interface{}) (Rows, error)
}

type Engine

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

func New

func New(conn Conn, options ...Option) *Engine

func (*Engine) Build

func (pg *Engine) Build(fixtures populator.Fixtures) ([]populator.Command, error)

func (*Engine) Exec

func (pg *Engine) Exec(cmds []populator.Command) error

type Option

type Option func(*Engine)

Option defines options for Engine.

func DisableForeignKeyCheck

func DisableForeignKeyCheck() Option

type PgxConn

type PgxConn interface {
	Begin(context.Context) (pgx.Tx, error)
	Exec(ctx context.Context, sql string, arguments ...interface{}) (pgconn.CommandTag, error)
	Query(ctx context.Context, sql string, optionsAndArgs ...interface{}) (pgx.Rows, error)
}

type Rows

type Rows interface {
	Close()
	Err() error
	Next() bool
	Scan(dest ...interface{}) error
}

type SQLConn

type SQLConn interface {
	BeginTx(context.Context, *sql.TxOptions) (*sql.Tx, error)
	ExecContext(ctx context.Context, sql string, arguments ...interface{}) (sql.Result, error)
	QueryContext(ctx context.Context, sql string, optionsAndArgs ...interface{}) (*sql.Rows, error)
}

Jump to

Keyboard shortcuts

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