Help us shape the future of Go! Take the 2026 Go Developer Survey

pg

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

README

go-pg

Async Postgres Implementation for Microservices

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func New

func New(ctx context.Context) (*Client, error)

func (*Client) Close

func (c *Client) Close()

func (*Client) Exec

func (c *Client) Exec(ctx context.Context, query string, args ...any) (sql.Result, error)

func (*Client) Ping

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

func (*Client) Port

func (c *Client) Port() int

func (*Client) Query

func (c *Client) Query(ctx context.Context, query string, args ...any) (*sql.Rows, error)

func (*Client) QueryRow

func (c *Client) QueryRow(ctx context.Context, query string, args ...any) *sql.Row

func (*Client) WithTx

func (c *Client) WithTx(ctx context.Context, fn func(tx *sql.Tx) error) error

type Config

type Config struct {
	URL             string
	MinConns        int32
	MaxConns        int32
	MaxConnLifetime time.Duration
	MaxConnIdleTime time.Duration
	ConnectTimeout  time.Duration
	Host            string
	Port            int
	DBName          string
	User            string
	Password        string
	AsyncWorkers    int
	AsyncQueueSize  int
}

func ConfigFromEnv

func ConfigFromEnv() (Config, error)

func DefaultConfig

func DefaultConfig() Config

type Executor

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

func NewExecutor

func NewExecutor(db *Client) *Executor

func (*Executor) Close

func (e *Executor) Close()

func (*Executor) Submit

func (e *Executor) Submit(ctx context.Context, task Task) (<-chan error, error)

type Task

type Task func(ctx context.Context, db *Client) error

Jump to

Keyboard shortcuts

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