store

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBClient

type DBClient struct {
	Conn    *sqlx.DB
	Queries goyesql.Queries
}

DBClient represents the structure to hold DB Client object required to create DB session and query and fetch results.

func (*DBClient) FetchResults

func (client *DBClient) FetchResults(query string) (map[string]interface{}, error)

FetchResults executes the query and parses the result

type DBClientOpts added in v0.8.2

type DBClientOpts struct {
	QueryFile    string
	MaxIdleConns int
	MaxOpenConns int
}

DBClientOpts represents additional options to use for DB Client

type Manager

type Manager interface {
	FetchResults(string) (map[string]interface{}, error)
}

Manager represents the set of methods used to interact with the db.

func NewDBClient

func NewDBClient(db string, dsn string, opts *DBClientOpts) (Manager, error)

NewDBClient initializes a connection object with the databse.

func NewManager

func NewManager(store Store) (Manager, error)

NewManager instantiates an object of Manager based on the params

type Store added in v0.8.2

type Store struct {
	MaxOpenConnections int    `koanf:"max_open_connections"`
	MaxIdleConnections int    `koanf:"max_idle_connections"`
	DB                 string `koanf:"db"`
	DSN                string `koanf:"dsn"`
	QueryFile          string `koanf:"query"`
}

Store represents additional options for the external store

Jump to

Keyboard shortcuts

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