db

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

The db package manages the Ego data base interfaces, similar to the sql package in conventional Go. There is basic functionality for creating a new connection, and then using that connection object (a db.Client) to perform queries, etc. A db.Rows type is also defined for row sets.

Index

Constants

This section is empty.

Variables

View Source
var ClientType *data.Type
View Source
var RowsType *data.Type

Functions

func AsStructures

func AsStructures(s *symbols.SymbolTable, args []interface{}) (interface{}, error)

AsStructures sets the asStruct flag. When true, result sets from queries are an array of structs, where the struct members are the same as the result set column names. When not true, the result set is an array of arrays, where the inner array contains the column data in the order of the result set, but with no labels, etc.

func Begin

func Begin(s *symbols.SymbolTable, args []interface{}) (interface{}, error)

Begin implements the Begin() db function. This allocated a new structure that contains all the info needed to call the database, including the function pointers for the functions available to a specific handle.

func Close

func Close(s *symbols.SymbolTable, args []interface{}) (interface{}, error)

Close closes the database connection, frees up any resources held, and resets the handle contents to prevent re-using the connection.

func Commit

func Commit(s *symbols.SymbolTable, args []interface{}) (interface{}, error)

Commit implements the Commit() db function.

func Execute

func Execute(s *symbols.SymbolTable, args []interface{}) (interface{}, error)

Execute executes a SQL statement, and returns the number of rows that were affected by the statement (such as number of rows deleted for a DELETE statement).

func New

func New(s *symbols.SymbolTable, args []interface{}) (interface{}, error)

New implements the New() db function. This allocated a new structure that contains all the info needed to call the database, including the function pointers for the functions available to a specific handle.

func Query

func Query(s *symbols.SymbolTable, args []interface{}) (interface{}, error)

Query executes a query, with optional parameter substitution, and returns row object for subsequent calls to fetch the data.

func QueryResult

func QueryResult(s *symbols.SymbolTable, args []interface{}) (interface{}, error)

QueryResult executes a query, with optional parameter substitution, and returns the entire result set as an array in a single operation.

func Rollback

func Rollback(s *symbols.SymbolTable, args []interface{}) (interface{}, error)

Rollback implements the Rollback() db function.

Types

This section is empty.

Jump to

Keyboard shortcuts

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