pgsql

package module
v0.0.0-...-4cbc278 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2021 License: MIT Imports: 9 Imported by: 1

README

pgsql

AFAIRE.

Licence

MIT.


Copyright (c) 2020-2021 mls-361.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoRows AFAIRE.
	ErrNoRows = pgx.ErrNoRows
)

Functions

func Context

func Context(timeout time.Duration) (context.Context, context.CancelFunc)

Context AFAIRE.

Types

type Batch

type Batch interface {
	Len() int
	Queue(sql string, args ...interface{})
	Send(ctx context.Context, client *Client) BatchResults
}

Batch AFAIRE.

func NewBatch

func NewBatch() Batch

type BatchResults

type BatchResults interface {
	Execute() (int64, error)
	Query() (Rows, error)
	QueryRow() Row
	Close() error
}

BatchResults AFAIRE.

type Client

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

Client AFAIRE.

func (*Client) Close

func (cl *Client) Close()

Close AFAIRE.

func (*Client) Connect

func (cl *Client) Connect() error

Connect AFAIRE.

func (*Client) Database

func (cl *Client) Database() string

Database AFAIRE.

func (*Client) Execute

func (cl *Client) Execute(ctx context.Context, sql string, args ...interface{}) (int64, error)

Execute AFAIRE.

func (*Client) Pool

func (cl *Client) Pool() *pgxpool.Pool

Pool AFAIRE.

func (*Client) Query

func (cl *Client) Query(ctx context.Context, sql string, args ...interface{}) (Rows, error)

Query AFAIRE.

func (*Client) QueryRow

func (cl *Client) QueryRow(ctx context.Context, sql string, args ...interface{}) Row

QueryRow AFAIRE.

func (*Client) Transaction

func (cl *Client) Transaction(ctx context.Context, fn func(*Transaction) error) error

Transaction AFAIRE.

type Config

type Config struct {
	Host              string
	Port              int
	Username          string
	Password          string
	Database          string
	MaxConns          int
	MinConns          int
	ConnLifeTime      time.Duration
	ConnIdleTime      time.Duration
	HealthCheckPeriod time.Duration
	ConnectTimeout    time.Duration
}

Config AFAIRE.

func (*Config) Connect

func (cfg *Config) Connect(crypto Crypto, logger logger.Logger) (*Client, error)

Connect AFAIRE.

func (*Config) NewClient

func (cfg *Config) NewClient(crypto Crypto, logger logger.Logger) (*Client, error)

NewClient AFAIRE.

type Crypto

type Crypto interface {
	DecryptString(text string) (string, error)
}

Crypto AFAIRE.

type Row

type Row interface {
	Scan(dest ...interface{}) error
}

Row AFAIRE.

type Rows

type Rows interface {
	Next() bool
	Scan(dest ...interface{}) error
	Close()
	Err() error
}

Rows AFAIRE.

type Transaction

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

Transaction AFAIRE.

func (*Transaction) Execute

func (t *Transaction) Execute(sql string, args ...interface{}) (int64, error)

Execute AFAIRE.

func (*Transaction) Query

func (t *Transaction) Query(sql string, args ...interface{}) (Rows, error)

Query AFAIRE.

func (*Transaction) QueryRow

func (t *Transaction) QueryRow(sql string, args ...interface{}) Row

QueryRow AFAIRE.

Jump to

Keyboard shortcuts

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