Documentation
¶
Index ¶
- Constants
- func ClearSlice[S ~[]E, E any](s S) S
- func GetApplicationName() string
- func IsPointer(value interface{}) bool
- func JoinSlice(list any) string
- func StrNotEmpty(s string) bool
- type Conn
- func NewConnection(dialect DialectType, dsn string) (*Conn, error)
- func NewConnectionFirebird(dsn string) (*Conn, error)
- func NewConnectionInterbase(dsn string) (*Conn, error)
- func NewConnectionMySql(dsn string) (*Conn, error)
- func NewConnectionOracle(dsn string) (*Conn, error)
- func NewConnectionPostgres(dsn string) (*Conn, error)
- func NewConnectionSqLite(dsn string) (*Conn, error)
- func NewConnectionSqlServer(dsn string) (*Conn, error)
- func (co *Conn) AddOracleSessionParam(key, value string) error
- func (co *Conn) Close()
- func (co *Conn) CreateContext(ctx context.Context) (context.Context, context.CancelFunc)
- func (co *Conn) DisableLog()
- func (co *Conn) EnableLog()
- func (co *Conn) Exec(sql string, arg ...any) (sql.Result, error)
- func (co *Conn) NewDataSet() *DataSet
- func (co *Conn) Open() error
- func (co *Conn) Ping() error
- func (co *Conn) SetConnLifeTime(d time.Duration)
- func (co *Conn) SetMaxOpenConns(n int)
- func (co *Conn) SetPoolLifeTime(d time.Duration)
- func (co *Conn) SetSchema(s string)
- func (co *Conn) SetSizePool(n int)
- func (co *Conn) StartTransaction() (*Transaction, error)
- func (co *Conn) StartTransactionContext(ctx context.Context) (*Transaction, error)
- type DataSet
- func (ds *DataSet) AddContext(ctx context.Context) *DataSet
- func (ds *DataSet) AddDetailFields(fields ...string) *DataSet
- func (ds *DataSet) AddMasterFields(fields ...string) *DataSet
- func (ds *DataSet) AddMasterSource(dataSet *DataSet) *DataSet
- func (ds *DataSet) AddSql(sql string) *DataSet
- func (ds *DataSet) Bof() bool
- func (ds *DataSet) ClearDetailFields() *DataSet
- func (ds *DataSet) ClearMasterFields() *DataSet
- func (ds *DataSet) Close()
- func (ds *DataSet) CloseNoClearSQL()
- func (ds *DataSet) Count() int
- func (ds *DataSet) Delete() (int64, error)
- func (ds *DataSet) DeleteContext(context context.Context) (int64, error)
- func (ds *DataSet) Eof() bool
- func (ds *DataSet) Exec() (sql.Result, error)
- func (ds *DataSet) ExecBatch(size int) error
- func (ds *DataSet) ExecContext(context context.Context) (sql.Result, error)
- func (ds *DataSet) FieldByName(fieldName string) *Field
- func (ds *DataSet) First()
- func (ds *DataSet) Free()
- func (ds *DataSet) GetMacros() []any
- func (ds *DataSet) GetParams() []any
- func (ds *DataSet) GetParamsBatch(index int) []any
- func (ds *DataSet) GetSql() (sql string)
- func (ds *DataSet) GetSqlMasterDetail() (vsql string)
- func (ds *DataSet) GetValue(field *Field, fieldType any) any
- func (ds *DataSet) IsEmpty() bool
- func (ds *DataSet) IsNotEmpty() bool
- func (ds *DataSet) Last()
- func (ds *DataSet) Locate(key string, value any) bool
- func (ds *DataSet) MacroByName(macroName string) *Macro
- func (ds *DataSet) Next()
- func (ds *DataSet) Open() error
- func (ds *DataSet) OpenContext(context context.Context) error
- func (ds *DataSet) ParamByName(paramName string) *Param
- func (ds *DataSet) Prepare() error
- func (ds *DataSet) Previous()
- func (ds *DataSet) PrintParam()
- func (ds *DataSet) SetInOutputParam(paramName string, paramValue any) *DataSet
- func (ds *DataSet) SetInOutputParamBlob(paramName string, paramValue []byte) *DataSet
- func (ds *DataSet) SetInOutputParamClob(paramName string, paramValue string) *DataSet
- func (ds *DataSet) SetInputParam(paramName string, paramValue any) *DataSet
- func (ds *DataSet) SetInputParamBlob(paramName string, paramValue []byte) *DataSet
- func (ds *DataSet) SetInputParamClob(paramName string, paramValue string) *DataSet
- func (ds *DataSet) SetMacro(macroName string, macroValue any) *DataSet
- func (ds *DataSet) SetOutputParam(paramName string, paramValue any) *DataSet
- func (ds *DataSet) SetOutputParamSlice(params ...ParamOut) *DataSet
- func (ds *DataSet) SqlParam() string
- func (ds *DataSet) ToStruct(model any) error
- func (ds *DataSet) ToStructJson(model any) ([]byte, error)
- type DataType
- type DialectType
- type Field
- func (field *Field) AsBool() bool
- func (field *Field) AsBoolNil() *bool
- func (field *Field) AsByte() []byte
- func (field *Field) AsByteNil() *[]byte
- func (field *Field) AsDateTime() time.Time
- func (field *Field) AsDateTimeNil() *time.Time
- func (field *Field) AsFloat() float32
- func (field *Field) AsFloat64() float64
- func (field *Field) AsFloat64Nil() *float64
- func (field *Field) AsFloatNil() *float32
- func (field *Field) AsInt() int
- func (field *Field) AsInt8() int8
- func (field *Field) AsInt8Nil() *int8
- func (field *Field) AsInt16() int16
- func (field *Field) AsInt16Nil() *int16
- func (field *Field) AsInt32() int32
- func (field *Field) AsInt32Nil() *int32
- func (field *Field) AsInt64() int64
- func (field *Field) AsInt64Nil() *int64
- func (field *Field) AsIntNil() *int
- func (field *Field) AsString() string
- func (field *Field) AsStringNil() *string
- func (field *Field) AsValue() any
- func (field *Field) IsNotNull() bool
- func (field *Field) IsNull() bool
- type Fields
- type Lob
- type Macro
- type Macros
- type MasterSource
- func (ms *MasterSource) AddDetailFields(fields ...string) *MasterSource
- func (ms *MasterSource) AddMasterFields(fields ...string) *MasterSource
- func (ms *MasterSource) AddMasterSource(dataSet *DataSet) *MasterSource
- func (ms *MasterSource) And() *DataSet
- func (ms *MasterSource) Clear()
- func (ms *MasterSource) ClearDetailFields()
- func (ms *MasterSource) ClearMasterFields()
- func (ms *MasterSource) CountDetailFields() int
- func (ms *MasterSource) CountMasterFields() int
- type Param
- func (param *Param) AsBool() bool
- func (param *Param) AsDateTime() time.Time
- func (param *Param) AsFloat() float32
- func (param *Param) AsFloat64() float64
- func (param *Param) AsInt() int
- func (param *Param) AsInt8() int8
- func (param *Param) AsInt16() int16
- func (param *Param) AsInt32() int32
- func (param *Param) AsInt64() int64
- func (param *Param) AsString() string
- func (param *Param) AsValue() *Variant
- type ParamOut
- type ParamType
- type Params
- func (p *Params) Add(paramName string) *Param
- func (p *Params) Clear() *Params
- func (p *Params) Count() int
- func (p *Params) FindParamByName(paramName string) *Param
- func (p *Params) ParamByName(paramName string) *Param
- func (p *Params) PrintParam()
- func (p *Params) SetInOutputParam(paramName string, paramValue any) *Params
- func (p *Params) SetInOutputParamBlob(paramName string, paramValue []byte) *Params
- func (p *Params) SetInOutputParamClob(paramName string, paramValue string) *Params
- func (p *Params) SetInputParam(paramName string, paramValue any) *Params
- func (p *Params) SetInputParamBlob(paramName string, paramValue []byte) *Params
- func (p *Params) SetInputParamClob(paramName string, paramValue string) *Params
- func (p *Params) SetOutputParam(paramName string, paramValue any) *Params
- func (p *Params) SetOutputParamSlice(params ...ParamOut) *Params
- func (p *Params) SetParam(paramName string, paramValue any, paramType ParamType) *Params
- func (p *Params) SetParamBlob(paramName string, paramValue []byte, paramType ParamType) *Params
- func (p *Params) SetParamClob(paramName string, paramValue string, paramType ParamType) *Params
- type Row
- type Strings
- type Transaction
- type Value
- type Variant
- func (v Variant) AsBool() bool
- func (v Variant) AsBoolNil() *bool
- func (v Variant) AsByte() []byte
- func (v Variant) AsByteNil() *[]byte
- func (v Variant) AsDateTime() time.Time
- func (v Variant) AsDateTimeNil() *time.Time
- func (v Variant) AsFloat() float32
- func (v Variant) AsFloat64() float64
- func (v Variant) AsFloat64Nil() *float64
- func (v Variant) AsFloatNil() *float32
- func (v Variant) AsInt() int
- func (v Variant) AsInt8() int8
- func (v Variant) AsInt8Nil() *int8
- func (v Variant) AsInt16() int16
- func (v Variant) AsInt16Nil() *int16
- func (v Variant) AsInt32() int32
- func (v Variant) AsInt32Nil() *int32
- func (v Variant) AsInt64() int64
- func (v Variant) AsInt64Nil() *int64
- func (v Variant) AsIntNil() *int
- func (v Variant) AsString() string
- func (v Variant) AsStringNil() *string
- func (v Variant) AsValue() any
- func (v Variant) IsNotNull() bool
- func (v Variant) IsNull() bool
- func (v Variant) SetSilent(value bool) Variant
Constants ¶
View Source
const ( FIREBIRD DialectType = 1 INTERBASE = 2 MYSQL = 3 ORACLE = 4 POSTGRESQL = 5 SQLSERVER = 6 SQLITE = 7 )
Variables ¶
This section is empty.
Functions ¶
func ClearSlice ¶
func ClearSlice[S ~[]E, E any](s S) S
func GetApplicationName ¶
func GetApplicationName() string
func StrNotEmpty ¶
Types ¶
type Conn ¶
type Conn struct {
DB *sql.DB
Dialect DialectType
DSN string
Schema string
PoolSize int // Máximo de conexões abertas
PoolLifetime time.Duration // Tempo máximo ocioso antes de fechar a conexão
MaxOpenConns int // Máximo de conexões ociosas
ConnLifetime time.Duration // Tempo máximo de vida de uma conexão
// contains filtered or unexported fields
}
func NewConnection ¶
func NewConnection(dialect DialectType, dsn string) (*Conn, error)
func NewConnectionFirebird ¶
func NewConnectionInterbase ¶
func NewConnectionMySql ¶
func NewConnectionOracle ¶
func NewConnectionPostgres ¶
func NewConnectionSqLite ¶
func NewConnectionSqlServer ¶
func (*Conn) AddOracleSessionParam ¶
func (*Conn) CreateContext ¶
func (*Conn) DisableLog ¶
func (co *Conn) DisableLog()
func (*Conn) NewDataSet ¶
func (*Conn) SetConnLifeTime ¶
SetConnLifeTime Tempo de vida das conexões
func (*Conn) SetMaxOpenConns ¶
SetMaxOpenConns Maximo de conexões abertas
func (*Conn) SetPoolLifeTime ¶
SetPoolLifeTime Tempo de vida do Pool de conexões
func (*Conn) SetSizePool ¶
SetSizePool Tamanho maximo do Pool de conexão
func (*Conn) StartTransaction ¶
func (co *Conn) StartTransaction() (*Transaction, error)
func (*Conn) StartTransactionContext ¶
func (co *Conn) StartTransactionContext(ctx context.Context) (*Transaction, error)
type DataSet ¶
type DataSet struct {
Connection *Conn
Tx *Transaction
Ctx context.Context
Sql Strings
Fields *Fields
Params *Params
Macros *Macros
Rows []Row
Index int
Recno int
MasterSource *MasterSource
IndexFieldNames string
Silent bool
}
func NewDataSet ¶
func NewDataSetTx ¶
func NewDataSetTx(tx *Transaction) *DataSet
func (*DataSet) AddDetailFields ¶
func (*DataSet) AddMasterFields ¶
func (*DataSet) AddMasterSource ¶
func (*DataSet) ClearDetailFields ¶
func (*DataSet) ClearMasterFields ¶
func (*DataSet) CloseNoClearSQL ¶
func (ds *DataSet) CloseNoClearSQL()
func (*DataSet) DeleteContext ¶
func (*DataSet) ExecContext ¶
func (*DataSet) FieldByName ¶
func (*DataSet) GetParamsBatch ¶
func (*DataSet) GetSqlMasterDetail ¶
func (*DataSet) IsNotEmpty ¶
func (*DataSet) MacroByName ¶
func (*DataSet) ParamByName ¶
func (*DataSet) PrintParam ¶
func (ds *DataSet) PrintParam()
func (*DataSet) SetInOutputParam ¶
func (*DataSet) SetInOutputParamBlob ¶
func (*DataSet) SetInOutputParamClob ¶
func (*DataSet) SetInputParam ¶
func (*DataSet) SetInputParamBlob ¶
func (*DataSet) SetInputParamClob ¶
func (*DataSet) SetOutputParam ¶
func (*DataSet) SetOutputParamSlice ¶
type DialectType ¶
type DialectType uint8
func (DialectType) String ¶
func (d DialectType) String() string
type Field ¶
type Field struct {
Owner *Fields
Name string
Caption string
DataType *sql.ColumnType
IDataType *DataType
Precision int64
Scale int64
DataMask string
BoolValue bool
TrueValue string
FalseValue string
Visible bool
AcceptNull bool
QuoteNull bool
OmitNull bool
StrNull string
Order int
Index int
// contains filtered or unexported fields
}
func (*Field) AsDateTime ¶
func (*Field) AsDateTimeNil ¶
func (*Field) AsFloat64Nil ¶
func (*Field) AsFloatNil ¶
func (*Field) AsInt16Nil ¶
func (*Field) AsInt32Nil ¶
func (*Field) AsInt64Nil ¶
func (*Field) AsStringNil ¶
type MasterSource ¶
func NewMasterSource ¶
func NewMasterSource() *MasterSource
func (*MasterSource) AddDetailFields ¶
func (ms *MasterSource) AddDetailFields(fields ...string) *MasterSource
func (*MasterSource) AddMasterFields ¶
func (ms *MasterSource) AddMasterFields(fields ...string) *MasterSource
func (*MasterSource) AddMasterSource ¶
func (ms *MasterSource) AddMasterSource(dataSet *DataSet) *MasterSource
func (*MasterSource) And ¶
func (ms *MasterSource) And() *DataSet
func (*MasterSource) Clear ¶
func (ms *MasterSource) Clear()
func (*MasterSource) ClearDetailFields ¶
func (ms *MasterSource) ClearDetailFields()
func (*MasterSource) ClearMasterFields ¶
func (ms *MasterSource) ClearMasterFields()
func (*MasterSource) CountDetailFields ¶
func (ms *MasterSource) CountDetailFields() int
func (*MasterSource) CountMasterFields ¶
func (ms *MasterSource) CountMasterFields() int
type Param ¶
type Param struct {
Owner *Params
Name string
Value *Variant
ParamType ParamType
DataType reflect.Type
Values []*Variant
}
func (*Param) AsDateTime ¶
type Params ¶
func (*Params) FindParamByName ¶
func (*Params) ParamByName ¶
func (*Params) PrintParam ¶
func (p *Params) PrintParam()
func (*Params) SetInOutputParam ¶
func (*Params) SetInOutputParamBlob ¶
func (*Params) SetInOutputParamClob ¶
func (*Params) SetInputParam ¶
func (*Params) SetInputParamBlob ¶
func (*Params) SetInputParamClob ¶
func (*Params) SetOutputParam ¶
func (*Params) SetOutputParamSlice ¶
func (*Params) SetParamBlob ¶
type Transaction ¶
type Transaction struct {
Conn *Conn
Ctx context.Context
// contains filtered or unexported fields
}
func NewTransaction ¶
func NewTransaction(conn *Conn) (*Transaction, error)
func NewTransactionCtx ¶
func NewTransactionCtx(conn *Conn, ctx context.Context) (*Transaction, error)
func (*Transaction) Commit ¶
func (t *Transaction) Commit() error
func (*Transaction) NewDataSet ¶
func (t *Transaction) NewDataSet() *DataSet
func (*Transaction) Rollback ¶
func (t *Transaction) Rollback() error
type Variant ¶
func (Variant) AsDateTime ¶
func (Variant) AsDateTimeNil ¶
func (Variant) AsFloat64Nil ¶
func (Variant) AsFloatNil ¶
func (Variant) AsInt16Nil ¶
func (Variant) AsInt32Nil ¶
func (Variant) AsInt64Nil ¶
func (Variant) AsStringNil ¶
Click to show internal directories.
Click to hide internal directories.