ssql3

package module
v0.0.0-...-eccbb13 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2021 License: AGPL-3.0 Imports: 6 Imported by: 0

README

ssql3

A wrapper for github.com/mattn/go-sqlite3 utilizing callback functions to handle sql.Result & *sql.Rows. This implementation makes it so that the enduser never has to worry about closing rows or prepared statements... only close the database itself.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

func New

func New(name string) (*DB, error)

New makes a new *DB with an open connection to the given database name. The user must run DB.Close when finished using the DB.

func (*DB) Close

func (d *DB) Close() error

Close ends the connection to the database and sets the DB.db = nil and the DB.open = false. Any errors that happen are pushed forward.

func (*DB) Exec

func (d *DB) Exec(statement string, resultCallBack SQLResultCallBack, args ...interface{}) error

Exec runs a statement and handles the context and closing of prep and any errors that take place are passed on.

func (*DB) Open

func (d *DB) Open() error

Open opens the database with the name that was provided within the DB.name.

func (*DB) Query

func (d *DB) Query(query string, rowsCallBack SQLRowsCallBack, args ...interface{}) error

Query runs a query and handles the context and closing of prep and rows any errors that take place are passed on.

type SQLResultCallBack

type SQLResultCallBack func(result sql.Result) error

SQLResultCallBack is used in executing a DB.Exec statement and handling the sql.Result of the execution.

type SQLRowsCallBack

type SQLRowsCallBack func(rows *sql.Rows) error

SQLRowsCallBack is used in executing a DB.Query statement and handling the *sql.Rows of the query.

Jump to

Keyboard shortcuts

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