db

package
v0.0.0-...-ac3e8bd Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrQueryTimeout = errors.New("canceled due to statement timeout")

ErrQueryTimeout describes statement timeout error

Functions

func ToFloat64

func ToFloat64(t interface{}) (float64, error)

ToFloat64 converts interface{} value to a float64 value

func ToString

func ToString(t interface{}) (string, bool)

ToString converts interface{} value to a string

Types

type Db

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

Db describes database

func New

func New(ctx context.Context, dbConfig config.DbConfig) (*Db, error)

New creates new instance of database connection

func (*Db) Close

func (d *Db) Close() error

Close closes connection to the database

func (*Db) Exec

func (d *Db) Exec(query string) ([]map[string]interface{}, error)

Exec executes the query

func (*Db) PgVersion

func (d *Db) PgVersion() config.PgVersion

PgVersion returns Postgresql version

func (*Db) SetStatementTimeout

func (d *Db) SetStatementTimeout(duration time.Duration) error

SetStatementTimeout sets statement timeout

type Interface

type Interface interface {
	SetStatementTimeout(time.Duration) error
	Exec(string) ([]map[string]interface{}, error)
	PgVersion() config.PgVersion
	Close() error
}

Interface describes Db methods

Jump to

Keyboard shortcuts

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