db

package
v0.0.0-...-f92b78c Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnInstance

type ConnInstance struct {
	Name string
	Conn *sqlx.DB
}

ConnInstance represents one instance of a DBConnection

type Controller

type Controller struct {
	Connections map[string]ConnInstance
}

Controller represents a set of ConnInstances

var Instance *Controller

Instance is a pointer for the global Instance

func New

func New(dbs []config.DbConfig) (*Controller, error)

New is the factory method for the Controller

func (Controller) AppendConn

func (ctr Controller) AppendConn(dbConn config.DbConfig)

AppendConn appends one ConnInstance on Controller.Connections if it doesn't exists (search by name)

func (Controller) Query

func (ctr Controller) Query(sql string) (result map[string]interface{}, e error)

Query is the main method for querying data over a set of dbs

type GenericScanner

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

GenericScanner is a custom db column value scanner

func (*GenericScanner) Scan

func (scanner *GenericScanner) Scan(src interface{}) error

Scan returns the db column value converted for the language's corresponding type

Jump to

Keyboard shortcuts

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