postgres

package
v0.0.0-...-e1d1ae0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMaxConnAge = 10 * time.Minute

Variables

This section is empty.

Functions

func DefaultPoolSize

func DefaultPoolSize() int

Types

type DebugHook

type DebugHook struct{}

func (DebugHook) AfterQuery

func (DebugHook) AfterQuery(ctx context.Context, event *pg.QueryEvent) error

func (DebugHook) BeforeQuery

func (DebugHook) BeforeQuery(ctx context.Context, event *pg.QueryEvent) (context.Context, error)

type Postgres

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

func Connect

func Connect(opts *pg.Options, now func() time.Time) (*Postgres, error)

Connect parses a database URL into options that can be used to connect to PostgreSQL.

func (*Postgres) Check

func (p *Postgres) Check(ctx context.Context) error

func (*Postgres) Close

func (p *Postgres) Close() error

func (*Postgres) CreateCage

func (p *Postgres) CreateCage(ctx context.Context, cage *model.Cage) error

func (*Postgres) ExecTx

func (p *Postgres) ExecTx(ctx context.Context, fn func(tx *pg.Tx) error) error

func (*Postgres) GetCage

func (p *Postgres) GetCage(ctx context.Context, id model.ID) (*model.Cage, error)

func (*Postgres) ListCages

func (p *Postgres) ListCages(ctx context.Context, params storage.ListCageParams) ([]*model.Cage, error)

func (*Postgres) UpdateCage

func (p *Postgres) UpdateCage(ctx context.Context, id model.ID, updater storage.CageUpdater) error

Jump to

Keyboard shortcuts

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