Documentation
¶
Index ¶
- Constants
- func Service() fns.Service
- func TxBegin(ctx fns.Context, param TxBeginParam) (err errors.CodeError)
- func TxCommit(ctx fns.Context) (err errors.CodeError)
- func TxRollback(ctx fns.Context) (err errors.CodeError)
- type Client
- type Cluster
- type Column
- type ColumnType
- type Config
- type ExecResult
- type Executor
- type FieldColumn
- type GlobalTransaction
- type GlobalTransactionManagement
- func (gtm *GlobalTransactionManagement) Close()
- func (gtm *GlobalTransactionManagement) Del(ctx fns.Context)
- func (gtm *GlobalTransactionManagement) Get(ctx fns.Context) (tx *sql.Tx, has bool)
- func (gtm *GlobalTransactionManagement) Set(ctx fns.Context, tx *sql.Tx, timeout time.Duration) (err error)
- type KDB
- type MasterSlaver
- type NullJson
- type NullSQLRaw
- type Param
- type QueryAble
- type Row
- type Rows
- type Standalone
- type Tuple
- type TxAddress
- type TxBeginParam
Constants ¶
View Source
const ( StringType = ColumnType("string") IntType = ColumnType("int") FloatType = ColumnType("float") BytesType = ColumnType("bytes") JsonType = ColumnType("json") BoolType = ColumnType("bool") TimeType = ColumnType("time") UnknownType = ColumnType("unknown") )
View Source
const ( Namespace = "sql" TxBeginFn = "tx_begin" TxCommitFn = "tx_commit" TxRollbackFn = "tx_rollback" QueryFn = "query" ExecuteFn = "execute" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Column ¶
type Column struct { Type ColumnType `json:"type,omitempty"` Name string `json:"name,omitempty"` Value json.RawMessage `json:"value,omitempty"` Nil bool `json:"nil,omitempty"` // contains filtered or unexported fields }
type ColumnType ¶
type ColumnType string
type Config ¶
type Config struct { Driver string `json:"driver"` MasterSlaverMode bool `json:"masterSlaverMode,omitempty"` DSN []string `json:"dsn,omitempty"` MaxIdles int `json:"maxIdles,omitempty"` MaxOpens int `json:"maxOpens,omitempty"` }
func (*Config) CreateClient ¶
type ExecResult ¶
type FieldColumn ¶ added in v0.3.10
type GlobalTransaction ¶
type GlobalTransaction struct {
// contains filtered or unexported fields
}
type GlobalTransactionManagement ¶
type GlobalTransactionManagement struct {
// contains filtered or unexported fields
}
func NewGlobalTransactionManagement ¶
func NewGlobalTransactionManagement() *GlobalTransactionManagement
func (*GlobalTransactionManagement) Close ¶
func (gtm *GlobalTransactionManagement) Close()
func (*GlobalTransactionManagement) Del ¶
func (gtm *GlobalTransactionManagement) Del(ctx fns.Context)
type MasterSlaver ¶
type MasterSlaver struct {
// contains filtered or unexported fields
}
func NewMasterSlaver ¶
func NewMasterSlaver(master *db.DB, slavers []*db.DB) (client *MasterSlaver)
func (*MasterSlaver) Close ¶
func (client *MasterSlaver) Close() (err error)
func (*MasterSlaver) Reader ¶
func (client *MasterSlaver) Reader() (v *db.DB)
func (*MasterSlaver) Writer ¶
func (client *MasterSlaver) Writer() (v *db.DB)
type NullJson ¶
type NullJson struct { Json json.RawMessage Valid bool }
type NullSQLRaw ¶
func (*NullSQLRaw) Scan ¶
func (v *NullSQLRaw) Scan(src interface{}) error
type Standalone ¶
type Standalone struct {
// contains filtered or unexported fields
}
func NewStandalone ¶
func NewStandalone(v *db.DB) (client *Standalone)
func (*Standalone) Close ¶
func (client *Standalone) Close() (err error)
func (*Standalone) Reader ¶
func (client *Standalone) Reader() (v *db.DB)
func (*Standalone) Writer ¶
func (client *Standalone) Writer() (v *db.DB)
type Tuple ¶
type Tuple struct {
// contains filtered or unexported fields
}
func (Tuple) MarshalJSON ¶
func (*Tuple) UnmarshalJSON ¶
type TxBeginParam ¶
type TxBeginParam struct { Timeout time.Duration `json:"timeout,omitempty"` Isolation db.IsolationLevel `json:"isolation,omitempty"` }
Click to show internal directories.
Click to hide internal directories.