Documentation ¶
Index ¶
- Constants
- Variables
- func CreateInterface(i interface{}, createFields []string) *typeInterface
- func CreateTypeData(ct []*sql.ColumnType) []interface{}
- func DBHelper() string
- func RegisterDbClient(db Database)
- func Trim(value string) string
- func Unpointer(data []interface{}) []interface{}
- type Column
- type CommonDatabase
- type CreateStatus
- type DataType
- type Database
- type Entries
- type NullBytes
- type NullUint
- type Query
- type Reference
- type ReferenceType
- type RegDbID
- func (id RegDbID) AdaptTable(tableName string, columns any) error
- func (id RegDbID) Batch(batch string) error
- func (id RegDbID) BatchSelect(batch string) ([][]interface{}, error)
- func (id RegDbID) BatchSelectFct(batch *Query, f ResultFunction) error
- func (id RegDbID) BeginTransaction() error
- func (id RegDbID) Close()
- func (id RegDbID) Commit() error
- func (id RegDbID) CreateTable(tableName string, columns any) error
- func (id RegDbID) CreateTableIfNotExists(tableName string, columns any) (CreateStatus, error)
- func (id RegDbID) Delete(name string, remove *Entries) (int64, error)
- func (id RegDbID) DeleteTable(tableName string) error
- func (id RegDbID) FreeHandler() error
- func (id RegDbID) GetTableColumn(tableName string) ([]string, error)
- func (id RegDbID) Insert(name string, insert *Entries) ([][]any, error)
- func (id RegDbID) Open() (any, error)
- func (id RegDbID) Ping() error
- func (id RegDbID) Query(query *Query, f ResultFunction) (*Result, error)
- func (id RegDbID) Rollback() error
- func (id RegDbID) SetCredentials(user, password string) error
- func (id RegDbID) Stream(search *Query, sf StreamFunction) error
- func (id RegDbID) String() string
- func (id RegDbID) Tables() ([]string, error)
- func (id RegDbID) URL() string
- func (id RegDbID) Update(name string, insert *Entries) ([][]any, int64, error)
- type Result
- type ResultFunction
- type SetType
- type Stream
- type StreamFunction
- type SubInterface
- type TagInfo
- type ValueDefinition
Constants ¶
const SubTypeTag = "sub"
const TagName = "flynn"
TagName name to be used for tagging structure field
Variables ¶
var Databases = make([]Database, 0)
Functions ¶
func CreateInterface ¶
func CreateInterface(i interface{}, createFields []string) *typeInterface
func CreateTypeData ¶
func CreateTypeData(ct []*sql.ColumnType) []interface{}
Types ¶
type Column ¶
type Column struct { Name string DataType DataType Length uint16 Digits uint8 SubColumns []*Column }
func CreateHeader ¶
func CreateHeader(ct []*sql.ColumnType) []*Column
type CommonDatabase ¶
func NewCommonDatabase ¶
func NewCommonDatabase(id RegDbID, driver string) CommonDatabase
func (*CommonDatabase) IsTransaction ¶
func (cd *CommonDatabase) IsTransaction() bool
func (*CommonDatabase) Used ¶
func (cd *CommonDatabase) Used()
type CreateStatus ¶
type CreateStatus byte
const ( CreateError CreateStatus = iota CreateExists CreateCreated CreateDriver CreateConnError )
type Database ¶
type Database interface { Used() ID() RegDbID URL() string Ping() error SetCredentials(string, string) error Maps() ([]string, error) Clone() Database GetTableColumn(tableName string) ([]string, error) CreateTable(string, any) error AdaptTable(string, any) error DeleteTable(string) error Open() (any, error) Close() FreeHandler() Insert(name string, insert *Entries) ([][]any, error) Update(name string, insert *Entries) ([][]any, int64, error) Delete(name string, remove *Entries) (int64, error) Batch(batch string) error BatchSelect(batch string) ([][]interface{}, error) BatchSelectFct(search *Query, f ResultFunction) error Query(search *Query, f ResultFunction) (*Result, error) BeginTransaction() error Commit() error Rollback() error Stream(search *Query, sf StreamFunction) error }
type Query ¶
type Query struct { Driver ReferenceType TableName string Search string Join string Fields []string Order []string Group []string Parameters []any Limit string Blocksize int32 Descriptor bool DataStruct any TypeInfo any FctParameter any }
func (*Query) ParseStruct ¶
type Reference ¶
type Reference struct { Driver ReferenceType Host string Port int User string Database string Options []string }
func NewReference ¶
NewReference new reference of database link
func (*Reference) OptionString ¶
type ReferenceType ¶
type ReferenceType byte
const ( NoType ReferenceType = iota MysqlType PostgresType AdabasType OracleType )
func ParseTypeName ¶
func ParseTypeName(t string) ReferenceType
ParseTypeName parse type string to internal type
func (ReferenceType) String ¶
func (rt ReferenceType) String() string
type RegDbID ¶
type RegDbID uint64
func (RegDbID) AdaptTable ¶
AdaptTable create a new table
func (RegDbID) BatchSelect ¶
BatchSelect batch SQL query in table
func (RegDbID) BatchSelectFct ¶
func (id RegDbID) BatchSelectFct(batch *Query, f ResultFunction) error
BatchSelect batch SQL query in table calling function
func (RegDbID) BeginTransaction ¶
BeginTransaction begin a transaction
func (RegDbID) CreateTable ¶
CreateTable create a new table
func (RegDbID) CreateTableIfNotExists ¶
func (id RegDbID) CreateTableIfNotExists(tableName string, columns any) (CreateStatus, error)
CreateTableIfNotExists create a new table if not exists
func (RegDbID) DeleteTable ¶
DeleteTable delete a table
func (RegDbID) FreeHandler ¶
FreeHandler unregister registry id for the driver
func (RegDbID) GetTableColumn ¶
GetTableColumn get table columne names
func (RegDbID) Query ¶
func (id RegDbID) Query(query *Query, f ResultFunction) (*Result, error)
Query query database records with search or SELECT
func (RegDbID) SetCredentials ¶
SetCredentials set credentials to connect to database
func (RegDbID) Stream ¶
func (id RegDbID) Stream(search *Query, sf StreamFunction) error
Stream streaming data from a field
type Result ¶
func (*Result) GenerateColumnByStruct ¶
func (result *Result) GenerateColumnByStruct(search *Query) (*ValueDefinition, error)
type ResultFunction ¶
type StreamFunction ¶
type ResultDataFunction func(index uint64, header []*Column, result []interface{}) error
type SubInterface ¶
type ValueDefinition ¶
type ValueDefinition struct { Copy any Values []any ScanValues []any TagInfo []TagInfo // contains filtered or unexported fields }
func (*ValueDefinition) ShiftNormalValues ¶
func (vd *ValueDefinition) ShiftNormalValues(d int, v any) error
func (*ValueDefinition) ShiftTransformContentValues ¶
func (vd *ValueDefinition) ShiftTransformContentValues(d int, v any) error
func (*ValueDefinition) ShiftValues ¶
func (vd *ValueDefinition) ShiftValues() error