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 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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