Documentation ¶
Index ¶
- func ErrWrap(e error, process string, args ...interface{}) error
- func ErrWrapf(e error, process string, fmt string, args ...interface{}) error
- func Parse(dial string) (*pg.Options, error)
- func RunInTransaction(ctx context.Context, db orm.DB, fn func(*pg.Tx) error) error
- type Adapter
- type Conn
- type Log
- type Logger
- type PGDriver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrWrap ¶
ErrWrap takes error returned from Postgres and returns structured error. Basically, we work with three database related kinds of errors: ErrNotFound for empty results, Coflict for insert/update violating data integrity, ErrInternal for all other kind of db errors.
Types ¶
type Adapter ¶
Adapter is the go-pg adapter implementation.
func (*Adapter) Do ¶
Do executes given function with taking care about the retries of the connection.
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn provides *pg.DB - a database handle representing a pool of zero or more underlying connections. It's safe for concurrent use by multiple goroutines.
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
Log is regular xlog
func (*Log) AfterQuery ¶
AfterQuery as after query went back
type PGDriver ¶
type PGDriver struct {
// contains filtered or unexported fields
}
PGDriver is an implementation of the xservice.Driver for the go-pg.
func NewDriver ¶
func NewDriver() *PGDriver
NewDriver creates a new driver implementation for the go-pg.
func (*PGDriver) CustomErrorCode ¶
CustomErrorCode overwrites default error map for given class, which would result in given code.
func (*PGDriver) DriverName ¶ added in v0.0.16
DriverName gets the name of the PGDriver.