pgsql

package module
v0.0.0-...-cd1e053 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2021 License: MIT Imports: 10 Imported by: 0

README

pgsql

A FAIRE.

Licence

MIT.


Copyright (c) 2021 mls-361.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoRows = pgx.ErrNoRows

ErrNoRows AFAIRE.

Functions

func CtxWT

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

CtxWT AFAIRE.

Types

type Batch

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

Batch AFAIRE.

func (*Batch) Len

func (b *Batch) Len() int

Len AFAIRE.

func (*Batch) Queue

func (b *Batch) Queue(query string, args ...interface{})

Queue AFAIRE.

func (*Batch) Send

func (b *Batch) Send(ctx context.Context) (BatchResults, error)

Send AFAIRE.

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) Database

func (c *Client) Database() string

Database AFAIRE.

func (*Client) Execute

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

Execute AFAIRE.

func (*Client) Pool

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

Pool AFAIRE.

func (*Client) Query

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

Query AFAIRE.

func (*Client) QueryRow

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

QueryRow AFAIRE.

func (*Client) Transaction

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

Transaction AFAIRE.

type Crypto

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

Crypto AFAIRE.

type Database

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

func NewDatabase

func NewDatabase(cfg *DatabaseConfig) (*Database, error)

NewDatabase AFAIRE.

func (*Database) Close

func (db *Database) Close()

Close AFAIRE.

func (*Database) NewBatch

func (db *Database) NewBatch() *Batch

NewBatch AFAIRE.

func (*Database) Primary

func (db *Database) Primary() (*Client, error)

Primary AFAIRE.

func (*Database) PrimaryPreferred

func (db *Database) PrimaryPreferred() (*Client, error)

PrimaryPreferred AFAIRE.

type DatabaseConfig

type DatabaseConfig struct {
	Name   string
	Nodes  []*NodeConfig
	Crypto Crypto
	Logger Logger
}

DatabaseConfig AFAIRE.

type Logger

type Logger interface {
	Trace(msg string, kv ...interface{})
	Debug(msg string, kv ...interface{})
	Info(msg string, kv ...interface{})
	Warning(msg string, kv ...interface{})
	Error(msg string, kv ...interface{})
}

Logger AFAIRE.

type NodeConfig

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

NodeConfig 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