Documentation
¶
Index ¶
- Variables
- func CtxWithTimeout(timeout time.Duration) (context.Context, context.CancelFunc)
- type Batch
- type BatchResults
- type CbOnError
- type CbOnSuccess
- type Client
- func (c *Client) Database() string
- func (c *Client) Execute(ctx context.Context, sql string, args ...interface{}) (int64, error)
- func (c *Client) Pool() *pgxpool.Pool
- func (c *Client) Query(ctx context.Context, sql string, args ...interface{}) (Rows, error)
- func (c *Client) QueryRow(ctx context.Context, sql string, args ...interface{}) Row
- func (c *Client) Transaction(ctx context.Context, fn func(*Transaction) error) error
- type Config
- type Crypto
- type Database
- type Logger
- type Node
- type Row
- type Rows
- type Transaction
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNoRows = pgx.ErrNoRows
)
Functions ¶
func CtxWithTimeout ¶
Types ¶
type BatchResults ¶
type CbOnSuccess ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Transaction ¶
type Config ¶
type Config struct {
Name string `cfg:"name"`
Nodes []*Node `cfg:"nodes"`
OnError CbOnError
OnSuccess CbOnSuccess
Logger Logger
}
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
func NewDatabase ¶
func (*Database) PrimaryPreferred ¶
type Node ¶
type Node struct {
Host string `cfg:"host"`
Port int `cfg:"port"`
Username string `cfg:"username"`
Password string `cfg:"password"`
MaxConns int `cfg:"max_conns"`
MinConns int `cfg:"min_conns"`
MaxConnLifetime time.Duration `cfg:"max_conn_lifetime"`
MaxConnIdleTime time.Duration `cfg:"max_conn_idle_time"`
HealthCheckPeriod time.Duration `cfg:"health_check_period"`
ConnectTimeout time.Duration `cfg:"connect_timeout"`
CheckTimeout time.Duration `cfg:"check_timeout"`
CheckPeriod time.Duration `cfg:"check_period"`
CheckPeriodOnError time.Duration `cfg:"check_period_on_errror"`
}
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
func (*Transaction) Execute ¶
func (t *Transaction) Execute(sql string, args ...interface{}) (int64, error)
func (*Transaction) Query ¶
func (t *Transaction) Query(sql string, args ...interface{}) (Rows, error)
func (*Transaction) QueryRow ¶
func (t *Transaction) QueryRow(sql string, args ...interface{}) Row
Click to show internal directories.
Click to hide internal directories.