gopg

package
v0.0.0-...-91dbb5c Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// These functions are copied from the go-pg package, so that you don't
	// have to import "github.com/go-pg/pg/v10/types".
	TypesScan        = types.Scan
	TypesScanString  = types.ScanString
	TypesScanBytes   = types.ScanBytes
	TypesReadBytes   = types.ReadBytes
	TypesScanInt     = types.ScanInt
	TypesScanInt64   = types.ScanInt64
	TypesScanUint64  = types.ScanUint64
	TypesScanFloat32 = types.ScanFloat32
	TypesScanFloat64 = types.ScanFloat64
	TypesScanTime    = types.ScanTime
	TypesScanBool    = types.ScanBool
)

Functions

func MustOpen

func MustOpen(conn string) db.DB

MustOpen is like Open but panics if connect operation fails.

func Open

func Open(conn string) (db.DB, error)

Open creates and establishes one connection to database.

Types

type DB

type DB struct {
	*pg.DB
}

func (*DB) BeginTx

func (d *DB) BeginTx(ctx context.Context, isolationLevel string) (db.Tx, error)

func (*DB) ConvertParameters

func (d *DB) ConvertParameters(query string, args []interface{}) (outQuery string, outArgs []interface{})

Convert positional parameters (like $1 in "WHERE name = $1") to question marks ("?") used in go-pg.

func (*DB) ErrGetCode

func (d *DB) ErrGetCode(err error) string

func (*DB) ErrNoRows

func (d *DB) ErrNoRows() error

func (*DB) Exec

func (d *DB) Exec(query string, args ...interface{}) (db.Result, error)

func (*DB) Query

func (d *DB) Query(query string, args ...interface{}) (db.Rows, error)

func (*DB) QueryRow

func (d *DB) QueryRow(query string, args ...interface{}) db.Row

type Result

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

func (Result) RowsAffected

func (r Result) RowsAffected() (int64, error)

type Tx

type Tx struct {
	*pg.Tx
}

func (*Tx) Commit

func (t *Tx) Commit(ctx context.Context) error

func (*Tx) ExecContext

func (t *Tx) ExecContext(ctx context.Context, query string, args ...interface{}) (db.Result, error)

func (*Tx) QueryContext

func (t *Tx) QueryContext(ctx context.Context, query string, args ...interface{}) (db.Rows, error)

func (*Tx) QueryRowContext

func (t *Tx) QueryRowContext(ctx context.Context, query string, args ...interface{}) db.Row

func (*Tx) Rollback

func (t *Tx) Rollback(ctx context.Context) error

type TypesReader

type TypesReader = types.Reader

types.Reader from go-pg package, so that you don't have to import it.

Jump to

Keyboard shortcuts

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