pg

package
v0.0.0-...-b34fa9a Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*sql.DB
	// contains filtered or unexported fields
}

Client is the postgres client

func NewClient

func NewClient(watcher *watchdog.Client, connString string, opts ...Option) (*Client, error)

NewClient returns a new instance of Client

func (*Client) ExecContext

func (c *Client) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)

ExecContext wraps the base connector

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) error

func (*Client) QueryContext

func (c *Client) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)

QueryContext wraps the base connector

func (*Client) QueryRowContext

func (c *Client) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row

QueryRowContext wraps the base connector

func (*Client) Tx

func (c *Client) Tx(ctx context.Context, callback func(ContextExecutor) error) error

type ContextExecutor

type ContextExecutor interface {
	Executor // Only to satisfy sqlboiler boil.ContextExecutor. Not to be used
	ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
	QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
	QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
}

ContextExecutor can perform SQL queries with context

type Executor

type Executor interface {
	Exec(query string, args ...interface{}) (sql.Result, error)
	Query(query string, args ...interface{}) (*sql.Rows, error)
	QueryRow(query string, args ...interface{}) *sql.Row
}

Executor can perform SQL queries.

type Option

type Option func(*Client)

func SetConnMaxLifetime

func SetConnMaxLifetime(d time.Duration) Option

func SetDebugLogLevel

func SetDebugLogLevel(set bool) Option

func SetMaxIdleConns

func SetMaxIdleConns(num int) Option

func SetMaxOpenConns

func SetMaxOpenConns(num int) Option

Jump to

Keyboard shortcuts

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