Documentation
¶
Index ¶
- type Config
- type RestOrm
- func (t *RestOrm) DbConfigAdd(name string, cfg *Config)
- func (t *RestOrm) DbConfigDelete(name string)
- func (t *RestOrm) DbConfigUpdate(name string, cfg *Config)
- func (t *RestOrm) DbStats() map[string]sql.DBStats
- func (t *RestOrm) Import(name string, f io.Reader) []sql.Result
- func (t *RestOrm) ResCount(dbName, tbName string, filter ...interface{}) int64
- func (t *RestOrm) ResCreateMany(dbName, tbName string, dts ...map[string]interface{}) (lastInsertId int64)
- func (t *RestOrm) ResDeleteMany(dbName, tbName string, filter ...interface{}) int64
- func (t *RestOrm) ResDeleteOne(dbName, tbName string, id int) int64
- func (t *RestOrm) ResGetAll(dbName, tbName string) []map[string]interface{}
- func (t *RestOrm) ResGetMany(dbName, tbName string, fields string, groupBy string, order string, ...) []map[string]interface{}
- func (t *RestOrm) ResGetOne(dbName, tbName string, id int) map[string]interface{}
- func (t *RestOrm) ResPage(dbName, tbName string, fields string, order string, limit, offset int, ...) []map[string]interface{}
- func (t *RestOrm) ResUpdateMany(dbName, tbName string, data map[string]interface{}, filter ...interface{}) int64
- func (t *RestOrm) ResUpdateOne(dbName, tbName string, id int, dt map[string]interface{}) int64
- type RestOrmDef
- type SQLBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Enable bool `toml:"enable" json:"enable"`
Driver string `toml:"driver" json:"driver"`
Dsn string `toml:"dsn" json:"dsn"`
MaxOpenConns int `toml:"max_open_conns" json:"max_open_conns"`
MaxIdleConns int `toml:"max_idle_conns" json:"max_idle_conns"`
MaxLifetime int `toml:"max_lefttime" json:"max_lefttime"`
ShowSql bool `toml:"show_sql" json:"show_sql"`
// contains filtered or unexported fields
}
Config is database connection configuration
type RestOrm ¶
type RestOrm struct {
// contains filtered or unexported fields
}
func (*RestOrm) DbConfigAdd ¶
func (*RestOrm) DbConfigDelete ¶
func (*RestOrm) DbConfigUpdate ¶
func (*RestOrm) ResCreateMany ¶
func (t *RestOrm) ResCreateMany(dbName, tbName string, dts ...map[string]interface{}) (lastInsertId int64)
创建记录
func (*RestOrm) ResDeleteMany ¶
删除记录
func (*RestOrm) ResGetMany ¶
func (t *RestOrm) ResGetMany(dbName, tbName string, fields string, groupBy string, order string, limit, offset int, filter ...interface{}) []map[string]interface{}
查询
type RestOrmDef ¶
type RestOrmDef interface {
ResCreateMany(dbName, tbName string, dts ...map[string]interface{}) (lastInsertId int64)
ResDeleteMany(dbName, tbName string, filter ...interface{}) int64
ResUpdateMany(dbName, tbName string, data map[string]interface{}, filter ...interface{}) int64
ResGetMany(dbName, tbName string, fields string, groupBy string, order string, limit, offset int, filter ...interface{}) []map[string]interface{}
ResPage(dbName, tbName string, fields string, order string, limit, offset int, filter ...interface{}) []map[string]interface{}
ResCount(dbName, tbName string, filter ...interface{}) int64
WithTx(tx *sqlx.Tx)
Hint(hint string)
ForceIndex(i string)
ResQuery(dbName string, sql string) (lastInsertId int64)
ResExec(dbName string, sql string) (lastInsertId int64)
}
type SQLBuilder ¶
type SQLBuilder struct {
// contains filtered or unexported fields
}
func (*SQLBuilder) Where ¶
func (s *SQLBuilder) Where(str string, args ...interface{})
Click to show internal directories.
Click to hide internal directories.