db

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2018 License: MIT Imports: 9 Imported by: 1

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(connStr string) (*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, error)

PgVersion returns Postgresql version

func (*Db) SetStatementTimeout

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

SetStatementTimeout sets statement timeout

type DbInterface

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

DbInterface describes Db methods

Jump to

Keyboard shortcuts

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