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

postgresql

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_MAX_POOL_SIZE          = 1
	DEFAULT_POOL_CREATION_ATTEMPTS = 10
	DEFAULT_POOL_CREATION_TIMEOUT  = time.Millisecond * 200
)

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(opts ...ClientOption) (*Client, error)

func (*Client) Close

func (c *Client) Close()

func (*Client) GetInstancePool

func (c *Client) GetInstancePool(ctx context.Context, urlOpts UrlOpts) (*pgxpool.Pool, error)

func (*Client) GetInstanceSqlDB

func (c *Client) GetInstanceSqlDB(opts UrlOpts) (*sql.DB, error)

type ClientOption

type ClientOption func(*Client)

func WithConnAttempts

func WithConnAttempts(att int) ClientOption

func WithConnTimeout

func WithConnTimeout(t time.Duration) ClientOption

func WithMaxPoolSize

func WithMaxPoolSize(pz int) ClientOption

type UrlOpts

type UrlOpts struct {
	DBName string
	Host   string
	Pass   string
	Port   int
	User   string
}

func (UrlOpts) URL

func (opt UrlOpts) URL() string

TODO: add validation fro mandatory fields

Jump to

Keyboard shortcuts

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