dbgol

package
v0.0.0-...-942d1c8 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotConnected = errors.New("db connection: db is not yet connected")
)

Functions

func Exec

func Exec(command string) (int64, error)

Execute a command (INSERT, UPDATE, DELETE) using a given string

func PreStmtExec

func PreStmtExec(stmt *sql.Stmt, ef ExtractorFunc, values ...any) (int64, error)

Execute a command using a Stmt pre-created

func SetConnection

func SetConnection(db *sql.DB)

Set the DB connection to be used

func StmtExec

func StmtExec(preparedStmt string, ef ExtractorFunc, values ...any) (int64, error)

Excecute a command (INSERT, UPDATE, DELETE) using a prepared stmt string

Types

type ExtractorFunc

type ExtractorFunc func(any) []any

This type of function convert a any struct to an slice of the necessary data to do the db query

type QueryResult

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

The result of a query will return a array with all the rows obtained

func PreStmtQuery

func PreStmtQuery(stmt *sql.Stmt, ef ExtractorFunc, values ...any) (*QueryResult, error)

Execute a query using a Stmt pre-created

func Query

func Query(query string, sampleargs ...any) (*QueryResult, error)

Execute a Query

func StmtQuery

func StmtQuery(query string, ef ExtractorFunc, values ...any) (*QueryResult, error)

Execute a query using a given string

func (*QueryResult) Rows

func (qr *QueryResult) Rows() [][]any

Returns an Array all the rows of the query

Jump to

Keyboard shortcuts

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