Documentation ¶
Index ¶
- Constants
- func InitPool(username string, password string, ip string, port int, dbname string, ...)
- type BatchInsertEngine
- type BatchUpdateEngine
- type Condition
- func (condition *Condition) WhereEqZero(jsonFields ...string) *Condition
- func (condition *Condition) WhereEqs(jsonFields ...string) *Condition
- func (condition *Condition) WhereGes(jsonFields ...string) *Condition
- func (condition *Condition) WhereGts(jsonFields ...string) *Condition
- func (condition *Condition) WhereIns(jsonFields ...string) *Condition
- func (condition *Condition) WhereIsNotNull(jsonFields ...string) *Condition
- func (condition *Condition) WhereIsNull(jsonFields ...string) *Condition
- func (condition *Condition) WhereLeftLikes(jsonFields ...string) *Condition
- func (condition *Condition) WhereLes(jsonFields ...string) *Condition
- func (condition *Condition) WhereLikes(jsonField ...string) *Condition
- func (condition *Condition) WhereLts(jsonFields ...string) *Condition
- func (condition *Condition) WhereNeqZero(jsonFields ...string) *Condition
- func (condition *Condition) WhereNes(jsonFields ...string) *Condition
- func (condition *Condition) WhereRightLikes(jsonFields ...string) *Condition
- type DB
- func (db *DB) DoTransaction(dbOperates func() error) (bool, error)
- func (db *DB) SelectBySql(selectSql string, params ...interface{}) ([]map[string]interface{}, error)
- func (db *DB) SelectCountBySql(countSql string, params ...interface{}) (int, error)
- func (db *DB) SelectOneBySql(selectSql string, params ...interface{}) (map[string]interface{}, error)
- type DeleteEngine
- type InsertEngine
- type LocalTime
- type Model
- type ModelReflect
- type SelectEngine
- func (selectEngine *SelectEngine) Limit(currentPage int, pageSize int) *SelectEngine
- func (selectEngine *SelectEngine) OrderByAsc(jsonFields ...string) *SelectEngine
- func (selectEngine *SelectEngine) OrderByDesc(jsonFields ...string) *SelectEngine
- func (selectEngine *SelectEngine) SelectAll() ([]map[string]interface{}, error)
- func (selectEngine *SelectEngine) SelectOne() (map[string]interface{}, error)
- func (selectEngine *SelectEngine) SelectPage() ([]map[string]interface{}, int, error)
- type UpdateEngine
Constants ¶
const FormatLayout = "2006-01-02 15:04:05"
FormatLayout 日期时间格式化格式
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BatchInsertEngine ¶
type BatchInsertEngine struct {
// contains filtered or unexported fields
}
BatchInsertEngine struct
func NewBatchInsertEngine ¶
func NewBatchInsertEngine(models []Model) *BatchInsertEngine
NewBatchInsertEngine 创建批量新增代理
func NewBatchInsertEngineDB ¶
func NewBatchInsertEngineDB(models []Model, db *DB) *BatchInsertEngine
NewBatchInsertEngineDB 创建批量新增代理(事务)
func (*BatchInsertEngine) InsertMany ¶
func (engine *BatchInsertEngine) InsertMany() error
InsertMany 批量新增
type BatchUpdateEngine ¶
type BatchUpdateEngine struct {
// contains filtered or unexported fields
}
BatchUpdateEngine struct
func NewBatchUpdateEngine ¶
func NewBatchUpdateEngine(models []Model) *BatchUpdateEngine
NewBatchUpdateEngine 创建BatchUpdateEngine
func NewBatchUpdateEngineDB ¶
func NewBatchUpdateEngineDB(models []Model, db *DB) *BatchUpdateEngine
NewBatchUpdateEngineDB 创建BatchUpdateEngine(事务)
func (*BatchUpdateEngine) ReplaceIntoMany ¶
func (engine *BatchUpdateEngine) ReplaceIntoMany() error
ReplaceIntoMany 批量替换新增 根据主键或者唯一索引,存在则删除后新增,不存在则新增
type Condition ¶
type Condition struct { ModelReflect // contains filtered or unexported fields }
Condition 条件结构体
func (*Condition) WhereEqZero ¶
WhereEqZero 等于0
func (*Condition) WhereIsNotNull ¶
WhereIsNotNull 是null值
func (*Condition) WhereIsNull ¶
WhereIsNull 是null值
func (*Condition) WhereLeftLikes ¶
WhereLeftLikes 左模糊匹配条件
func (*Condition) WhereLikes ¶
WhereLikes 模糊匹配条件
func (*Condition) WhereNeqZero ¶
WhereNeqZero 不等于0
func (*Condition) WhereRightLikes ¶
WhereRightLikes 右模糊匹配条件
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB 数据库链接
func (*DB) DoTransaction ¶
DoTransaction 事务操作
func (*DB) SelectBySql ¶
func (db *DB) SelectBySql(selectSql string, params ...interface{}) ([]map[string]interface{}, error)
SelectBySql 查询记录
func (*DB) SelectCountBySql ¶
SelectCountBySql 查询记录数
type DeleteEngine ¶
type DeleteEngine struct { Condition // contains filtered or unexported fields }
DeleteEngine struct
func NewDeleteEngine ¶
func NewDeleteEngine(model Model) *DeleteEngine
NewDeleteEngine 创建DeleteEngine
func NewDeleteEngineDB ¶
func NewDeleteEngineDB(model Model, db *DB) *DeleteEngine
NewDeleteEngineDB 创建DeleteEngine(事务)
type InsertEngine ¶
type InsertEngine struct { ModelReflect // contains filtered or unexported fields }
InsertEngine struct
func NewInsertEngine ¶
func NewInsertEngine(model Model) *InsertEngine
NewInsertEngine 创建InsertEngine
func NewInsertEngineDB ¶
func NewInsertEngineDB(model Model, db *DB) *InsertEngine
NewInsertEngineDB 创建InsertEngine(事务)
type LocalTime ¶
LocalTime 自定义时间类型
func (LocalTime) MarshalJSON ¶
MarshalJSON marshal json方法
func (*LocalTime) UnmarshalJSON ¶
UnmarshalJSON unmarshal json方法
type ModelReflect ¶
type ModelReflect struct {
// contains filtered or unexported fields
}
ModelReflect 实体
func InitModelReflect ¶
func InitModelReflect(model Model) ModelReflect
InitModelReflect 初始化ModelReflect
type SelectEngine ¶
type SelectEngine struct { Condition // contains filtered or unexported fields }
SelectEngine 查询代理
func NewSelectEngineDB ¶
func NewSelectEngineDB(model Model, db *DB) *SelectEngine
NewSelectEngineDB 事务
func (*SelectEngine) Limit ¶
func (selectEngine *SelectEngine) Limit(currentPage int, pageSize int) *SelectEngine
Limit 分页设置
func (*SelectEngine) OrderByAsc ¶
func (selectEngine *SelectEngine) OrderByAsc(jsonFields ...string) *SelectEngine
OrderByAsc 正序排序
func (*SelectEngine) OrderByDesc ¶
func (selectEngine *SelectEngine) OrderByDesc(jsonFields ...string) *SelectEngine
OrderByDesc 倒序排序
func (*SelectEngine) SelectAll ¶
func (selectEngine *SelectEngine) SelectAll() ([]map[string]interface{}, error)
SelectAll 根据条件查询所有记录
func (*SelectEngine) SelectOne ¶
func (selectEngine *SelectEngine) SelectOne() (map[string]interface{}, error)
SelectOne 查询一行记录
func (*SelectEngine) SelectPage ¶
func (selectEngine *SelectEngine) SelectPage() ([]map[string]interface{}, int, error)
SelectPage 根据条件分页查询
type UpdateEngine ¶
type UpdateEngine struct { Condition // contains filtered or unexported fields }
UpdateEngine 更新Engine
func NewUpdateEngine ¶
func NewUpdateEngine(model Model) *UpdateEngine
NewUpdateEngine 创建InsertEngine
func NewUpdateEngineDB ¶
func NewUpdateEngineDB(model Model, db *DB) *UpdateEngine
NewUpdateEngineDB 创建UpdateEngine(事务)