pgxutil

package
v0.0.0-...-e44b46f Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EscapeIdentifier

func EscapeIdentifier(name string) string

Types

type FieldFilter

type FieldFilter interface {
	Filter(fieldExpr string) string
}

func FieldFilterEq

func FieldFilterEq(q QueryArg) FieldFilter

func FieldFilterGe

func FieldFilterGe(q QueryArg) FieldFilter

func FieldFilterGt

func FieldFilterGt(q QueryArg) FieldFilter

func FieldFilterLe

func FieldFilterLe(q QueryArg) FieldFilter

func FieldFilterLt

func FieldFilterLt(q QueryArg) FieldFilter

type FieldUpdate

type FieldUpdate interface {
	Update(fieldExpr string) string
}

func FieldUpdateArraySet

func FieldUpdateArraySet(idx QueryArg, nval FieldUpdate) FieldUpdate

func FieldUpdateSet

func FieldUpdateSet(arg QueryArg) FieldUpdate

type IConn

type IConn interface {
	IQueryable
	Begin() (*pgx.Tx, error)
	BeginEx(ctx context.Context, txOptions *pgx.TxOptions) (*pgx.Tx, error)
}

Generically allows access to *Conn and *ConnPool

var _ IConn = (*pgx.ConnPool)(nil)
var _ IConn = (*pgx.Conn)(nil)

type IQueryable

type IQueryable interface {
	BeginBatch() *pgx.Batch
	CopyFrom(tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int, error)
	CopyFromReader(r io.Reader, sql string) (commandTag pgx.CommandTag, err error)
	CopyToWriter(w io.Writer, sql string, args ...interface{}) (commandTag pgx.CommandTag, err error)

	Exec(sql string, arguments ...interface{}) (commandTag pgx.CommandTag, err error)
	ExecEx(ctx context.Context, sql string, options *pgx.QueryExOptions, arguments ...interface{}) (commandTag pgx.CommandTag, err error)

	Prepare(name, sql string) (*pgx.PreparedStatement, error)
	PrepareEx(ctx context.Context, name, sql string, opts *pgx.PrepareExOptions) (*pgx.PreparedStatement, error)

	Query(sql string, args ...interface{}) (*pgx.Rows, error)
	QueryEx(ctx context.Context, sql string, options *pgx.QueryExOptions, args ...interface{}) (*pgx.Rows, error)

	QueryRow(sql string, args ...interface{}) *pgx.Row
	QueryRowEx(ctx context.Context, sql string, options *pgx.QueryExOptions, args ...interface{}) *pgx.Row
}

Generically allows access to *Tx, *Conn and *ConnPool

var _ IQueryable = (*pgx.ConnPool)(nil)
var _ IQueryable = (*pgx.Conn)(nil)
var _ IQueryable = (*pgx.Tx)(nil)

type QueryArg

type QueryArg interface {
	// contains filtered or unexported methods
}

func NewQueryArg

func NewQueryArg(i int) QueryArg

func NewQueryArgArray

func NewQueryArgArray(args ...QueryArg) QueryArg

func NewQueryArgRow

func NewQueryArgRow(args ...QueryArg) QueryArg

func NewQueryArgValue

func NewQueryArgValue(i interface{}) QueryArg

type SqlSelect

type SqlSelect interface {
	SetExprs(exprs string)
	AddExpr(expr string)
	AddWhere(name string, filter FieldFilter)
	String() string
	PrepareWith(q IQueryable, name string) (*pgx.PreparedStatement, error)
}

func NewSqlSelect

func NewSqlSelect(table string) SqlSelect

type SqlUpdate

type SqlUpdate interface {
	AddUpdate(name string, update FieldUpdate)
	AddWhere(name string, filter FieldFilter)
	String() string
	PrepareWith(q IQueryable, name string) (*pgx.PreparedStatement, error)
}

func NewSqlUpdate

func NewSqlUpdate(table string) SqlUpdate

Jump to

Keyboard shortcuts

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