db

package
v0.0.0-...-3db4b2e Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn interface {
	Query(sql string, args ...interface{}) (*pgx.Rows, error)
}

type DataRequest

type DataRequest struct {
	Start            int64       `json:"start"`
	Limit            int64       `json:"limit"`
	OrderBy          string      `json:"orderBy"`
	OrderByAscending bool        `json:"orderByAscending"`
	Filter           interface{} `json:"filter"`
}

type DataResponse

type DataResponse struct {
	Items     *[]interface{} `json:"items"`
	Count     int64          `json:"count"`
	Aggregate interface{}    `json:"aggregate"`
}

type Database

type Database interface {
	Execute(handler func(tx Transaction))
}

func NewDatabase

func NewDatabase(config *DatabaseConfig) Database

type DatabaseConfig

type DatabaseConfig struct {
	Host     string // host (e.g. localhost) or path to unix domain socket directory (e.g. /private/tmp)
	Port     uint16 // default: 5432
	Database string
	User     string // default: OS user name
	Password string
	// Run-time parameters to set on connection as session default values
	// (e.g. search_path or application_name)
	RuntimeParams map[string]string
}

type Number

type Number struct {
	decimal.Dec
	Null bool
}

func (*Number) Scan

func (p *Number) Scan(vr *pgx.ValueReader) error

type Result

type Result interface {
	Scan(dest ...interface{}) (err error)

	Values() ([]interface{}, error)
}

type Transaction

type Transaction interface {
	Execute(sql string, args ...interface{}) int64

	Query(query string, handler func(Result), args ...interface{}) int32
}

Jump to

Keyboard shortcuts

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