database

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrQueryMessage = "Error executing sql query"
)

Functions

func FilterRows

func FilterRows(driver Driver, query *builder.Sqlbuilder, filters map[string][]params.Filter, table string) error

FilterRows takes in the filters from the params set in http.Params If there is no filters set, an empty string will be returned. Returns errors.INVALID if the operator or column name was not found.

Types

type Driver

type Driver interface {
	DB() *sqlx.DB
	Schema() string
	Builder() *builder.Sqlbuilder
	Install() error
	Migrate(version *version.Version) error
	Tables() ([]string, error)
	Dump(path, filename string) error
	Drop() error
}

Driver represents the functions and methods for interacting with the Database, which could be MySQL (tested) Postgres (experimental).

func New

func New(env *environment.Env) (Driver, error)

New creates a new database driver dependant on the environment. Returns errors.INTERNAL if there there was an error setting up the driver. Returns errors.INVALID if the environment us invalid or the DB could not be pinged.

Directories

Path Synopsis
v0

Jump to

Keyboard shortcuts

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