pgxs

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2021 License: MIT Imports: 11 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 Config added in v0.6.0

type Config struct {
	ConnString      string      `json:"conn_string" yaml:"conn_string"`
	ActualSchema    string      `json:"actual_schema" yaml:"schema_path"`
	MigrationSchema string      `json:"migration_schema" yaml:"migration_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"`
	TLS             SSL         `json:"tls" yaml:"tls"`
	TLSConfig       *tls.Config `json:"-" yaml:"-"`
}

type Repo

type Repo struct {
	Logger *zap.SugaredLogger `json:"-" yaml:"-"`
	Pool   *pgxpool.Pool      `json:"-" yaml:"-"`
	Config *Config            `json:"-" yaml:"-"`
}

func New added in v0.6.0

func New(ctx context.Context, lg *zap.SugaredLogger, conf *Config) (*Repo, error)

func (*Repo) ConnectDB

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

func (*Repo) DebugLogSqlErr added in v0.2.1

func (db *Repo) DebugLogSqlErr(q string, err error) error

handleSqlErr used to avoid not exists and already exists debug queries

func (*Repo) GetPgxConfig

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

func (*Repo) GetPgxConnString added in v0.6.0

func (db *Repo) GetPgxConnString() string

func (*Repo) GracefulShutdown

func (db *Repo) GracefulShutdown()

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 {
	Enabled  bool   `json:"enabled" yaml:"enabled"`
	Verify   bool   `json:"verify" yaml:"verify"`
	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