postgres

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSQLNotFound = errors.New("not found")

ErrSQLNotFound happens when no rows were found

Functions

func NewConnPool

func NewConnPool(postgresDBConf Config) (*sqlx.DB, error)

NewConnPool connects to db and return a connection pool

Types

type Config

type Config struct {
	Host     string
	Port     string
	User     string
	Password string
	DbName   string
	SSLConf
}

Config is a conf for the postgres database

type QueryFilter

type QueryFilter struct {
	FilterSQL   string
	NamedParams map[string]interface{}
}

QueryFilter allows for select filters

type SQLNamedQueryer

type SQLNamedQueryer interface {
	NamedQueryContext(ctx context.Context, query string, arg interface{}) (
		*sqlx.Rows, error,
	)
}

SQLNamedQueryer is used to do select queries

type SQLPrepareNamed

type SQLPrepareNamed interface {
	PrepareNamed(query string) (*sqlx.NamedStmt, error)
}

SQLPrepareNamed is THE most useful interface as postgres requires two phase to insert, with a prepare stmt

type SSLConf added in v1.0.8

type SSLConf struct {
	CertPath     string
	KeyPath      string
	RootCertPath string
}

SSLConf Represent the ssl configuration

Jump to

Keyboard shortcuts

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