pg

package
v1.1.42 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: MIT Imports: 14 Imported by: 5

Documentation

Index

Constants

View Source
const (
	ErrPrefix = "pg-error"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type OptionsSt

type OptionsSt struct {
	Dsn               string
	Timezone          string
	MaxConns          int32
	MinConns          int32
	MaxConnLifetime   time.Duration
	MaxConnIdleTime   time.Duration
	HealthCheckPeriod time.Duration
	FieldTag          string
}

type St

type St struct {
	Con *pgxpool.Pool
	// contains filtered or unexported fields
}

func New

func New(debug bool, lg logger.WarnAndError, opts OptionsSt) (*St, error)

func (*St) DbExec

func (d *St) DbExec(ctx context.Context, sql string, args ...any) error

func (*St) DbExecM

func (d *St) DbExecM(ctx context.Context, sql string, argMap map[string]any) error

func (*St) DbQuery

func (d *St) DbQuery(ctx context.Context, sql string, args ...any) (db.RDBRows, error)

func (*St) DbQueryM

func (d *St) DbQueryM(ctx context.Context, sql string, argMap map[string]any) (db.RDBRows, error)

func (*St) DbQueryRow

func (d *St) DbQueryRow(ctx context.Context, sql string, args ...any) db.RDBRow

func (*St) DbQueryRowM

func (d *St) DbQueryRowM(ctx context.Context, sql string, argMap map[string]any) db.RDBRow

func (*St) HErr

func (d *St) HErr(err error) error

func (*St) HfCreate

func (d *St) HfCreate(ctx context.Context, ops db.RDBCreateOptions) error

func (*St) HfDelete added in v1.0.4

func (d *St) HfDelete(ctx context.Context, ops db.RDBDeleteOptions) error

func (*St) HfGenerateSort

func (d *St) HfGenerateSort(rNames []string, allowed map[string]string) []string

func (*St) HfGet

func (d *St) HfGet(ctx context.Context, ops db.RDBGetOptions) error

func (*St) HfGetCUFields

func (d *St) HfGetCUFields(obj any) (map[string]any, map[string]bool)

func (*St) HfList

func (d *St) HfList(ctx context.Context, ops db.RDBListOptions) (int64, error)

func (*St) HfOptionalWhere added in v1.0.20

func (d *St) HfOptionalWhere(conds []string) string

func (*St) HfUpdate added in v1.0.4

func (d *St) HfUpdate(ctx context.Context, ops db.RDBUpdateOptions) error

func (*St) RenewContextTransaction

func (d *St) RenewContextTransaction(ctx context.Context) error

func (*St) TransactionAddAsyncCallback added in v1.1.41

func (d *St) TransactionAddAsyncCallback(ctx context.Context, f func())

func (*St) TransactionFn added in v1.0.6

func (d *St) TransactionFn(ctx context.Context, f func(context.Context) error) error

Jump to

Keyboard shortcuts

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