database

package
v0.0.0-...-2ff407e Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2019 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteWithTransaction

func ExecuteWithTransaction(cmd string) error

ExecuteWithTransaction opens a transaction and executes the cmd. Rollback happens if there is an error

func GetConnection

func GetConnection() (bool, error)

GetConnection Make a connection to the database to execute queries against

Types

type Results

type Results struct {
	Columns []string
	Data    [][]string
}

Results contains the column names and the data

func ExecuteQuery

func ExecuteQuery(cmd string) (*Results, error)

ExecuteQuery Run the provided command and return the results in a 2 dimensional slice where slice[0] are column names, and all other slices are the resulting rows

func ExecuteStatement

func ExecuteStatement(name string, executeOnly bool, parameters map[string]*interface{}) (*Results, error)

ExecuteStatement executes the supplied procedure with parameters and returns results only if returnResults param is true

type SQLDatabase

type SQLDatabase struct {
	Connection *sql.DB
}

SQLDatabase struct to hold the connection

Jump to

Keyboard shortcuts

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