pglib

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 21, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package pglib is for encapsulating github.com/go-pg/pg any operations

As a quick start:

cfg := pglib.GOPGConfig{
	URL:       "postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable",
	DebugMode: true,
	PoolSize:  5,
}
client, err := pglib.NewDefaultGOPGClient(cfg)
if err != nil {
	panic(err)
}
fmt.Println(client.Ping(context.Background()))

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GOPGClient

type GOPGClient struct {
	*pg.DB
}

func NewCustomizeGOPGClient

func NewCustomizeGOPGClient(opts *pg.Options, debugMode bool) (*GOPGClient, error)

func NewDefaultGOPGClient

func NewDefaultGOPGClient(config GOPGConfig) (*GOPGClient, error)

type GOPGConfig

type GOPGConfig struct {
	URL       string
	DebugMode bool
	PoolSize  int
}

type GOPGDebugQueryHook

type GOPGDebugQueryHook struct {
}

func (*GOPGDebugQueryHook) AfterQuery

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

func (*GOPGDebugQueryHook) BeforeQuery

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

Jump to

Keyboard shortcuts

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