postgres

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2020 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMigrate

func GetMigrate() (*migrate.Migrate, error)

func NewDB

func NewDB() (*pg.DB, error)

func RebuildDB

func RebuildDB() error

RebuildDB rebuild

Types

type PgContextData

type PgContextData struct {
	DB    *pg.DB
	Tx    *pg.Tx
	Layer int
}

func (*PgContextData) GetSession

func (d *PgContextData) GetSession() Session

type Session

type Session interface {
	Exec(query interface{}, params ...interface{}) (pg.Result, error)
	Model(model ...interface{}) *orm.Query
	Query(model interface{}, query interface{}, params ...interface{}) (pg.Result, error)

	Insert(model ...interface{}) error
}

func GetSessionFromContext

func GetSessionFromContext(ctx context.Context) Session

type TxAdapter

type TxAdapter struct {
	DB *pg.DB
}

TxAdapter implements adapter.Tx

func (*TxAdapter) AttachDB

func (tx *TxAdapter) AttachDB(ctx context.Context) context.Context

func (*TxAdapter) WithTx

func (tx *TxAdapter) WithTx(ctx context.Context, fn func() error) error

Jump to

Keyboard shortcuts

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