pgxs

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func QuoteString

func QuoteString(str string) string

according to https://github.com/jackc/pgx/blob/master/conn.go#L84 have to watch changes, to prevent internal issues

Types

type PgConf

type PgConf struct {
	ConnString       string      `json:"conn_string" yaml:"conn_string"`
	ServiceName      string      `json:"service" yaml:"service"`
	ActualSchemaPath string      `json:"actual_schema_path" yaml:"schema_path"`
	DataDir          string      `json:"data_dir" yaml:"data_dir"`
	Host             string      `json:"host" yaml:"host"`
	Port             string      `json:"port" yaml:"port"`
	Name             string      `json:"name" yaml:"name"`
	User             string      `json:"user" yaml:"user"`
	Password         string      `json:"password" yaml:"password"`
	SslMode          string      `json:"ssl_mode" yaml:"ssl_mode"`
	SslPath          string      `json:"ssl_path" yaml:"ssl_path"`
	TLS              SSL         `json:"tls" yaml:"tls"`
	TLSConfig        *tls.Config `json:"-" yaml:"-"`
}

type Repo

type Repo struct {
	ServiceName string `json:"service" yaml:"service"`
	Pool        *pgxpool.Pool
	Config      *PgConf
	// contains filtered or unexported fields
}

func NewPool

func NewPool(ctx context.Context, serviceName string, pgconf *PgConf) (Repo, error)

func NewSecurePool

func NewSecurePool(ctx context.Context, serviceName string, pgconf *PgConf) (Repo, error)

func (*Repo) ConnectDB

func (db *Repo) ConnectDB(ctx context.Context, tlsConfig *tls.Config) (*pgxpool.Pool, error)

func (*Repo) GetConfig

func (db *Repo) GetConfig() (*pgxpool.Config, error)

func (*Repo) GetPgxConfig

func (db *Repo) GetPgxConfig() (*pgxpool.Config, error)

func (*Repo) GetPgxPoolConnString

func (db *Repo) GetPgxPoolConnString() string

func (*Repo) GetPgxPoolString

func (db *Repo) GetPgxPoolString() string

func (*Repo) GracefulShutdown

func (db *Repo) GracefulShutdown(ctx context.Context)

func (*Repo) PoolFromString

func (db *Repo) PoolFromString(ctx context.Context, connString string) (*pgxpool.Pool, error)

func (*Repo) SanitizeString

func (db *Repo) SanitizeString(str string) string

type SSL

type SSL struct {
	CaPath   string `json:"ca" yaml:"ca"`
	KeyPath  string `json:"key" yaml:"key"`
	CertPath string `json:"cert" yaml:"cert"`
}

Jump to

Keyboard shortcuts

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