db

package
v0.0.0-...-f267496 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package db provides operations on SQLite DB.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

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

Database type is sql.DB

func New

func New(dbDir, dbName string) (*Database, error)

New initializes database, connect to it and return the connection

func (*Database) Close

func (db *Database) Close() error

Close closes the connection to the database.

func (*Database) Exec

func (db *Database) Exec(sqlStatement string) error

Exec executes given SQL statement.

func (*Database) Insert

func (db *Database) Insert(rec []interface{}) error

Insert executes SQL INSERT query with a given record.

func (*Database) SelectAll

func (db *Database) SelectAll() ([]Record, error)

SelectAll executes SQL SELECT query and returns all records in the migration table.

func (*Database) SelectByNameAndHost

func (db *Database) SelectByNameAndHost(name, host string) ([]Record, error)

SelectByNameAndHost prepares WHERE clause for SELECT query and returns array of the Record(s) found by the SQL query.

func (*Database) SelectByUID

func (db *Database) SelectByUID(uid string) ([]Record, error)

SelectByUID prepares WHERE clause for SELECT query and returns array of the Record(s) found by the SQL query.

func (*Database) SelectByUIDAndName

func (db *Database) SelectByUIDAndName(uid, name string) ([]Record, error)

SelectByUIDAndName prepares WHERE clause for SELECT query and returns array of the Record(s) found by the SQL query.

func (*Database) SelectByUIDNameAndHost

func (db *Database) SelectByUIDNameAndHost(uid, name, host string) ([]Record, error)

SelectByUIDNameAndHost prepares WHERE clause for SELECT query and returns array of the Record(s) found by the SQL query.

func (*Database) SelectByUIDNameAndType

func (db *Database) SelectByUIDNameAndType(uid, name, dataType string) ([]Record, error)

SelectByUIDNameAndType prepares WHERE clause for SELECT query and returns array of the Record(s) found by the SQL query.

func (*Database) SelectByUIDNameTypeAndHost

func (db *Database) SelectByUIDNameTypeAndHost(uid, name, dataType, host string) ([]Record, error)

SelectByUIDNameTypeAndHost prepares WHERE clause for SELECT query and returns array of the Record(s) found by the SQL query.

type Record

type Record struct {
	UID, Name, Host, DataType, Data string
}

Record type represents Database record.

Jump to

Keyboard shortcuts

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