db

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2019 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DB

func DB() *sql.DB

DB returns DB handler

func Init

func Init(dbpath string)

Init opens DB connection

func Query

func Query(sql string, args ...interface{}) error

Query db function

func Select

func Select(sql string, out interface{}, args ...interface{}) (err error)

Select - selects multiple results from the DB

func SelectFirst

func SelectFirst(sql string, args ...interface{}) (interface{}, error)

SelectFirst - selects first result from a row

func SelectStruct

func SelectStruct(sql string, obj interface{}, args ...interface{}) (interface{}, error)

SelectStruct - returns selected result as struct

Types

type Database

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

Database encapsulates database

Jump to

Keyboard shortcuts

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