database

package
v0.0.0-...-91f2eb4 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ColumnType

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

ColumnType structure defining column definition

func (*ColumnType) DatabaseType

func (colType *ColumnType) DatabaseType() string

DatabaseType ColumnType underlying db type as defined by driver of Connection

func (*ColumnType) HasLength

func (colType *ColumnType) HasLength() bool

HasLength ColumnType content has Length definition

func (*ColumnType) HasNullable

func (colType *ColumnType) HasNullable() bool

HasNullable ColumnType content has NULL able content

func (*ColumnType) HasPrecisionScale

func (colType *ColumnType) HasPrecisionScale() bool

HasPrecisionScale ColumnType content has PrecisionScale

func (*ColumnType) Length

func (colType *ColumnType) Length() int64

Length ColumnType content lenth must be used in conjunction with HasLength

func (*ColumnType) Name

func (colType *ColumnType) Name() string

Name ColumnType.Name()

func (*ColumnType) Nullable

func (colType *ColumnType) Nullable() bool

Nullable ColumnType content is Nullable

func (*ColumnType) Numeric

func (colType *ColumnType) Numeric() bool

Numeric ColumnType is Numeric() bool

func (*ColumnType) Precision

func (colType *ColumnType) Precision() int64

Precision ColumnType numeric Precision. Used in conjunction with HasPrecisionScale

func (*ColumnType) Scale

func (colType *ColumnType) Scale() int64

Scale ColumnType Scale. Used in conjunction with HasPrecisionScale

func (*ColumnType) Type

func (colType *ColumnType) Type() reflect.Type

Type ColumnType reflect.Type as specified by golang sql/database

type Connection

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

func NewConnection

func NewConnection(dbms *DBMS, driverName, dataSource string) (cn *Connection)

func (*Connection) DbInvoke

func (cn *Connection) DbInvoke() (db *sql.DB, dberr error)

func (*Connection) Dispose

func (cn *Connection) Dispose() (err error)

func (*Connection) Status

func (cn *Connection) Status() (status sql.DBStats, err error)

func (*Connection) Stmnt

func (cn *Connection) Stmnt() (stmnt *Statement)

type DBMS

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

func GLOBALDBMS

func GLOBALDBMS() *DBMS

GLOBALDBMS - Global DBMS instance

func NewDBMS

func NewDBMS() (dbms *DBMS)

func (*DBMS) DBMSHandler

func (dbms *DBMS) DBMSHandler(ctx context.Context, runtime active.Runtime, prms parameters.ParametersAPI, cchng *concurrent.Map, fs *fsutils.FSUtils, callprepstmnt StatementHandlerFunc) (dbmshndlr *DBMSHandler)

func (*DBMS) DriverCnInvoker

func (dbms *DBMS) DriverCnInvoker(driver string) (dbinvoker func(string, ...interface{}) (*sql.DB, error), dbsqlparseparam func(int) string)

func (*DBMS) Execute

func (dbms *DBMS) Execute(alias string, a ...interface{}) (exectr *Executor)

func (*DBMS) Prepair

func (dbms *DBMS) Prepair(alias string, a ...interface{}) (exectr *Executor)

func (*DBMS) Query

func (dbms *DBMS) Query(alias string, a ...interface{}) (reader *Reader)

func (*DBMS) Register

func (dbms *DBMS) Register(alias string, driver string, datasource string, a ...interface{}) (registered bool)

func (*DBMS) RegisterDriver

func (dbms *DBMS) RegisterDriver(driver string, invokedbcall func(string, ...interface{}) (*sql.DB, error), parseDbSqlParamCall func(int) string)

func (*DBMS) Unregister

func (dbms *DBMS) Unregister(alias string, a ...interface{}) (unregistered bool)

type DBMSHandler

type DBMSHandler struct {
	CallPrepStatement StatementHandlerFunc
	// contains filtered or unexported fields
}

func (*DBMSHandler) Connections

func (dbmshndlr *DBMSHandler) Connections() (cns []string)

func (*DBMSHandler) Dispose

func (dbmshndlr *DBMSHandler) Dispose()

func (*DBMSHandler) DriverName

func (dbmshndlr *DBMSHandler) DriverName(alias string) (driver string)

func (*DBMSHandler) Drivers

func (dbmshndlr *DBMSHandler) Drivers() (drvrs []string)

func (*DBMSHandler) Exec

func (dbmshndlr *DBMSHandler) Exec(alias string, a ...interface{}) *Executor

func (*DBMSHandler) Execute

func (dbmshndlr *DBMSHandler) Execute(alias string, a ...interface{}) (exctr *Executor)

func (*DBMSHandler) Exists

func (dbmshndlr *DBMSHandler) Exists(alias string) (exists bool)

func (*DBMSHandler) InOut

func (dbmshndlr *DBMSHandler) InOut(in interface{}, out io.Writer, ioargs ...interface{}) (err error)

func (*DBMSHandler) Params

func (dbmshndlr *DBMSHandler) Params() (prms parameters.ParametersAPI)

func (*DBMSHandler) Prep

func (dbmshndlr *DBMSHandler) Prep(alias string, a ...interface{}) *Executor

func (*DBMSHandler) Prepair

func (dbmshndlr *DBMSHandler) Prepair(alias string, a ...interface{}) (exctr *Executor)

func (*DBMSHandler) Qry

func (dbmshndlr *DBMSHandler) Qry(alias string, a ...interface{}) *Reader

func (*DBMSHandler) QryArray

func (dbmshndlr *DBMSHandler) QryArray(alias string, a ...interface{}) []interface{}

func (*DBMSHandler) QryMap

func (dbmshndlr *DBMSHandler) QryMap(alias string, a ...interface{}) map[string]interface{}

func (*DBMSHandler) Query

func (dbmshndlr *DBMSHandler) Query(alias string, a ...interface{}) (reader *Reader)

func (*DBMSHandler) QueryArray

func (dbmshndlr *DBMSHandler) QueryArray(alias string, a ...interface{}) (arr []interface{})

func (*DBMSHandler) QueryMap

func (dbmshndlr *DBMSHandler) QueryMap(alias string, a ...interface{}) (mp map[string]interface{})

func (*DBMSHandler) Reg

func (dbmshndlr *DBMSHandler) Reg(alias string, driver string, datasource string, a ...interface{}) bool

func (*DBMSHandler) Register

func (dbmshndlr *DBMSHandler) Register(alias string, driver string, datasource string, a ...interface{}) (registered bool)

func (*DBMSHandler) Status

func (dbmshndlr *DBMSHandler) Status(alias string) (status map[string]interface{}, err error)

func (*DBMSHandler) TryConnect

func (dbmshndlr *DBMSHandler) TryConnect(dbtype string, datasource string) (connected interface{})

func (*DBMSHandler) Unreg

func (dbmshndlr *DBMSHandler) Unreg(alias string) bool

func (*DBMSHandler) Unregister

func (dbmshndlr *DBMSHandler) Unregister(alias string) (unregistered bool)

type DataReader

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

func (*DataReader) Close

func (datardr *DataReader) Close() (err error)

func (*DataReader) Columns

func (datardr *DataReader) Columns() (cols []string, err error)

func (*DataReader) Next

func (datardr *DataReader) Next() (next bool, err error)

type ErrorFunc

type ErrorFunc func(error)

type ExecErrorFunc

type ExecErrorFunc func(error, *Executor) (bool, error)

type ExecFunc

type ExecFunc func(*Executor, int64, int64) error

type Executor

type Executor struct {
	EventClose func(*Executor)
	// contains filtered or unexported fields
}

func NewExecutor

func NewExecutor(stmnt *Statement, prepOnly bool, oninit interface{}, onexec interface{}, onexecerror interface{}, onerror interface{}, onfinalize interface{}, runtime active.Runtime) (exectr *Executor)

func (*Executor) Close

func (exectr *Executor) Close() (err error)

func (*Executor) Exec

func (exectr *Executor) Exec() (err error)

func (*Executor) LastInsertedId

func (exectr *Executor) LastInsertedId() (lastInsertedId int64)

func (*Executor) RowsAffected

func (exectr *Executor) RowsAffected() (rowsAffected int64)

type ExecutorFinalizeFunc

type ExecutorFinalizeFunc func(*Executor) error

type ExecutorInitFunc

type ExecutorInitFunc func(*Executor) error

type PrepColumnsFunc

type PrepColumnsFunc func(*Reader, func(...string)) error

type PrepDataFunc

type PrepDataFunc func(*Reader, func(...interface{})) error

type Reader

type Reader struct {
	RowNr int64

	EventPrepColumns PrepColumnsFunc
	EventPrepData    PrepDataFunc
	EventInit        ReaderInitFunc
	EventError       ErrorFunc
	EventNext        RowNextFunc
	EventSelect      RowSelectFunc
	EventRow         RowFunc
	EventRowError    RowErrorFunc
	EventFinalize    ReaderFinalizeFunc
	EventClose       func(*Reader)

	CastTypeValue func(interface{}, interface{}) (interface{}, bool)
	// contains filtered or unexported fields
}

func NewReader

func NewReader(strmrdrd interface{}, strmtpe string, strmsttngs map[string]interface{}, stmnt *Statement, oninit interface{}, onprepcolumns interface{}, onprepdata interface{}, onnext interface{}, onselect interface{}, onrow interface{}, onrowerror interface{}, onerror interface{}, onfinalize interface{}, runtime active.Runtime) (reader *Reader)

func (*Reader) AppendReader

func (rdr *Reader) AppendReader(rdrs ...*Reader) (appended bool)

func (*Reader) AsArray

func (rdr *Reader) AsArray(cols ...string) (arr []interface{})

func (*Reader) AsMap

func (rdr *Reader) AsMap(cols ...string) (mp map[string]interface{})

func (*Reader) CSVReader

func (rdr *Reader) CSVReader(a ...interface{}) (eofr *iorw.EOFCloseSeekReader)

func (*Reader) Close

func (rdr *Reader) Close() (err error)

func (*Reader) ColumnTypes

func (rdr *Reader) ColumnTypes(cols ...string) (clstpes []*ColumnType)

func (*Reader) Columns

func (rdr *Reader) Columns(cols ...string) (cls []string)

func (*Reader) Data

func (rdr *Reader) Data(cols ...string) (dspdata []interface{})

func (*Reader) DataMap

func (rdr *Reader) DataMap(cols ...string) (datamap map[string]interface{})

DataMap return Displayable data in the form of a map[string]interface{} column and values

func (*Reader) DataSet

func (rdr *Reader) DataSet(cols ...string) (dataset []interface{}, err error)

func (*Reader) DataSetMap

func (rdr *Reader) DataSetMap(cols ...string) (datasetmap []map[string]interface{})

func (*Reader) ExecEachPrepaired

func (rdr *Reader) ExecEachPrepaired(execerr func(*Executor, int, error), execs ...*Executor) (err error)

func (*Reader) Field

func (rdr *Reader) Field(name string) (val interface{})

func (*Reader) ForEach

func (rdr *Reader) ForEach(eachitem func(*Reader, bool, bool) bool) (err error)

func (*Reader) ForEachColumn

func (rdr *Reader) ForEachColumn(eachitem func(string, int, bool, bool), cols ...string) (err error)

func (*Reader) ForEachColumnType

func (rdr *Reader) ForEachColumnType(eachitem func(*ColumnType, int, bool, bool), cols ...string) (err error)

func (*Reader) ForEachData

func (rdr *Reader) ForEachData(eachitem func([]interface{}, int64, bool, bool) bool, cols ...string) (err error)

func (*Reader) ForEachDataMap

func (rdr *Reader) ForEachDataMap(eachitem func(map[string]interface{}, int64, bool, bool) bool, cols ...string) (err error)

func (*Reader) ForEachDataMapSet

func (rdr *Reader) ForEachDataMapSet(eachitem func([]map[string]interface{}, int64, bool, bool) bool, cols ...string) (err error)

func (*Reader) InsertAfterReader

func (rdr *Reader) InsertAfterReader(aftrrdr *Reader, rdrs ...*Reader) (inserted bool)

func (*Reader) InsertBeforeReader

func (rdr *Reader) InsertBeforeReader(bfrrdr *Reader, rdrs ...*Reader) (inserted bool)

func (*Reader) IsFirst

func (rdr *Reader) IsFirst() (first bool)

func (*Reader) IsLast

func (rdr *Reader) IsLast() (last bool)

func (*Reader) JSONReader

func (rdr *Reader) JSONReader(layout string, cols ...string) (eofr *iorw.EOFCloseSeekReader)

func (*Reader) Next

func (rdr *Reader) Next() (next bool, err error)

func (*Reader) NextReader

func (rdr *Reader) NextReader() (nxtrdr *Reader)

func (*Reader) PreAppendReader

func (rdr *Reader) PreAppendReader(rdrs ...*Reader) (preappended bool)

func (*Reader) Prep

func (rdr *Reader) Prep() (err error)

func (*Reader) RemoveReader

func (rdr *Reader) RemoveReader(rdrstormv ...*Reader) (removed bool)

func (*Reader) ToCSV

func (rdr *Reader) ToCSV(w io.Writer, a ...interface{}) (err error)

func (*Reader) ToJSON

func (rdr *Reader) ToJSON(w io.Writer, layout string, cols ...string) (err error)

type ReaderFinalizeFunc

type ReaderFinalizeFunc func(*Reader) error

type ReaderInitFunc

type ReaderInitFunc func(*Reader) error

type RowErrorFunc

type RowErrorFunc func(error, *Reader) (bool, error)

type RowFunc

type RowFunc func(*Reader) error

type RowNextFunc

type RowNextFunc func(*Reader) (bool, error)

type RowSelectFunc

type RowSelectFunc func(*Reader) (bool, error)

type RowsAPI

type RowsAPI interface {
	Close() error
	ColumnTypes(...string) ([]*ColumnType, error)
	Columns(...string) ([]string, error)
	Data(...string) []interface{}
	DisplayData(...string) []interface{}
	Field(string) interface{}
	FieldByIndex(int) interface{}
	FieldIndex(string) int
	Err() error
	Next() bool
	Context() context.Context
	//NextResultSet() bool
	Scan(castTypeVal func(valToCast interface{}, colType interface{}) (val interface{}, scanned bool)) error
}

type SqlRows

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

func (*SqlRows) Close

func (sqlrws *SqlRows) Close() (err error)

func (*SqlRows) ColumnTypes

func (sqlrws *SqlRows) ColumnTypes(cols ...string) (coltypes []*ColumnType, err error)

func (*SqlRows) Columns

func (sqlrws *SqlRows) Columns(col ...string) (cols []string, err error)

func (*SqlRows) Context

func (sqlrws *SqlRows) Context() (ctx context.Context)

func (*SqlRows) Data

func (sqlrws *SqlRows) Data(cols ...string) (data []interface{})

func (*SqlRows) DisplayData

func (sqlrws *SqlRows) DisplayData(cols ...string) (displaydata []interface{})

func (*SqlRows) Err

func (sqlrws *SqlRows) Err() (err error)

func (*SqlRows) Field

func (sqlrws *SqlRows) Field(name string) (val interface{})

func (*SqlRows) FieldByIndex

func (sqlrws *SqlRows) FieldByIndex(index int) (val interface{})

func (*SqlRows) FieldIndex

func (sqlrws *SqlRows) FieldIndex(name string) (index int)

func (*SqlRows) Next

func (sqlrws *SqlRows) Next() (next bool)

func (*SqlRows) Scan

func (sqlrws *SqlRows) Scan(castTypeVal func(valToCast interface{}, colType interface{}) (val interface{}, scanned bool)) (err error)

type Statement

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

func NewStatement

func NewStatement(cn *Connection) (stmnt *Statement)

func (*Statement) Arguments

func (stmnt *Statement) Arguments() (args []interface{})

func (*Statement) Close

func (stmnt *Statement) Close() (err error)

func (*Statement) Prepair

func (stmnt *Statement) Prepair(prms *parameters.Parameters, rdr *Reader, args map[string]interface{}, a ...interface{}) (preperr error)

func (*Statement) Query

func (stmnt *Statement) Query() (rows RowsAPI, err error)

type StatementHandler

type StatementHandler interface {
	Prepair(...interface{}) []interface{}
}

type StatementHandlerFunc

type StatementHandlerFunc func(a ...interface{}) []interface{}

func (StatementHandlerFunc) Prepair

func (stmnthndlfnc StatementHandlerFunc) Prepair(a ...interface{}) []interface{}

type StreamReader

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

func (*StreamReader) Columns

func (strmrdr *StreamReader) Columns() (cols []string, err error)

func (*StreamReader) Next

func (strmrdr *StreamReader) Next() (next bool, err error)

func (*StreamReader) PrepColumns

func (strmrdr *StreamReader) PrepColumns(cols ...string)

func (*StreamReader) PrepData

func (strmrdr *StreamReader) PrepData(data ...interface{})

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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