Documentation ¶
Index ¶
- type Engine
- func (e *Engine) AddDB(tableName string, config *server.Config)
- func (e *Engine) AddDBWithShard(tableName, shardType, segName string, config *server.Config)
- func (engine *Engine) AddSpliter(split spliter.Split)
- func (engine *Engine) AddSpliterMap(splitMap map[string]spliter.Split)
- func (engine *Engine) AddUserSplitter()
- func (engine *Engine) Close()
- func (engine *Engine) NewSession() *session.Session
- func (engine *Engine) Transaction(f TxFunc) (result interface{}, err error)
- type TxFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine is the main struct of sorm, manages all db sessions and transactions.
func NewEngine ¶
NewEngine create a instance of Engine connect database and ping it to test whether it's alive
func NewEngineWithConfig ¶
通过config 初始化一个engine
func (*Engine) AddDBWithShard ¶
给engine 中 通过tableName 和config 增加dbs 用于分库 tableName 分表的原来表名 shardType 分表的类型 例如 %2 对应的表名为 user_0/user_1 m 对应的表名为 user_202001 d 对应的表名为 user_20200101 w 对应的表名为 user_20200101 h 对应的表名为 user_2020010101 y 对应的表名为 user_2020 segName 分表的字段
func (*Engine) AddSpliter ¶
给engine 新增一个spliter
func (*Engine) AddSpliterMap ¶
给engine 新增多个spliter
func (*Engine) AddUserSplitter ¶
func (engine *Engine) AddUserSplitter()
生成一个 模拟user 按照%4 的拆分表规则的spliter
func (*Engine) NewSession ¶
NewSession creates a new session for next operations
func (*Engine) Transaction ¶
Transaction executes sql wrapped in a transaction, then automatically commit if no error occurs
Directories ¶
Path | Synopsis |
---|---|
Package decimal implements an arbitrary precision fixed-point decimal.
|
Package decimal implements an arbitrary precision fixed-point decimal. |
driver/kingbase/v8r3/kingbase.com/gokb
Package kb is a pure Go Kingbase driver for the database/sql package.
|
Package kb is a pure Go Kingbase driver for the database/sql package. |
driver/kingbase/v8r3/kingbase.com/gokb/oid
Package oid contains OID constants as defined by the Kingbase server.
|
Package oid contains OID constants as defined by the Kingbase server. |
driver/kingbase/v8r3/kingbase.com/gokb/scram
Package scram implements a SCRAM-{SHA-1,etc} client per RFC5802.
|
Package scram implements a SCRAM-{SHA-1,etc} client per RFC5802. |
driver/kingbase/v8r6/kingbase.com/gokb
Package kb is a pure Go Kingbase driver for the database/sql package.
|
Package kb is a pure Go Kingbase driver for the database/sql package. |
driver/kingbase/v8r6/kingbase.com/gokb/oid
Package oid contains OID constants as defined by the Kingbase server.
|
Package oid contains OID constants as defined by the Kingbase server. |
driver/kingbase/v8r6/kingbase.com/gokb/scram
Package scram implements a SCRAM-{SHA-1,etc} client per RFC5802.
|
Package scram implements a SCRAM-{SHA-1,etc} client per RFC5802. |
driver/odbc
Package odbc implements database/sql driver to access data via odbc interface.
|
Package odbc implements database/sql driver to access data via odbc interface. |
driver/yxres/uxgo/oid
Package oid contains OID constants as defined by the UXres server.
|
Package oid contains OID constants as defined by the UXres server. |
driver/yxres/uxgo/scram
Package scram implements a SCRAM-{SHA-1,etc} client per RFC5802.
|
Package scram implements a SCRAM-{SHA-1,etc} client per RFC5802. |