pgxpgcall

package module
v0.0.0-...-1673d0b Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2019 License: MIT Imports: 7 Imported by: 1

README

pgx-pgcall

pgx-pgcall is a pgx backend for pgcall

  • Project status: in active development

Documentation

Overview

Package pgxpgcall implements a jackc/pgx backend for pgcall. pgx was choosen for its postgresql type support

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Schema   string `long:"schema" env:"SCHEMA" default:"" description:"Database functions schema name or comma delimited list"`
	LogLevel string `long:"loglevel" env:"LOGLEVEL" default:"error" description:"DB logging level (trace|debug|info|warn|error|none)"`
	TimeZone string `long:"tz" env:"TZ" default:"Europe/Moscow" description:"Database connection timezone"`
	Retry    int    `long:"retry" default:"5" description:"Retry db connect after this interfal (secs), No retry if 0"`
	Workers  int    `long:"workers" default:"2" description:"DB connections count"`
}

Config defines local application flags

type DB

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

func New

func New(cfg Config, log loggers.Contextual) (*DB, error)

func (*DB) Exec

func (db *DB) Exec(sql string, arguments ...interface{}) (int64, error)

func (*DB) Query

func (db *DB) Query(query string, args ...interface{}) ([]interface{}, error)

Query fetches []interface{} (slece of 1st column values) from query result

func (*DB) QueryMaps

func (db *DB) QueryMaps(query string, args ...interface{}) ([]map[string]interface{}, error)

QueryMaps fetches []map[string]interface{} from query result

func (*DB) QueryProc

func (db *DB) QueryProc(method string, args ...interface{}) ([]map[string]interface{}, error)

QueryProc calls postgresql stored function without metadata usage

type Logger

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

Logger holds database logging via given logger

func (Logger) Log

func (l Logger) Log(level pgx.LogLevel, msg string, data map[string]interface{})

Log message via logger

Jump to

Keyboard shortcuts

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