Documentation ¶
Index ¶
- Variables
- type Engine
- func (engine *Engine) Close()
- func (engine *Engine) Delete(name string, namedCondition map[string]interface{}) (int64, error)
- func (engine *Engine) DropTable(name string) error
- func (engine *Engine) Find(name string, namedCondition map[string]interface{}, selectFields []string) ([]map[string]interface{}, error)
- func (engine *Engine) GetSchema(name string) *schema.Schema
- func (engine *Engine) GetSchemas() map[string]*schema.Schema
- func (engine *Engine) Insert(name string, data ...map[string]interface{}) (int64, error)
- func (engine *Engine) Migrate() error
- func (engine *Engine) MigrateTable(name string, tx ...*sqlx.Tx) error
- func (engine *Engine) Register(definition string) (string, error)
- func (engine *Engine) SchemaTableExists(name string, tx ...*sqlx.Tx) (bool, error)
- func (engine *Engine) Update(name string, data, namedCondition map[string]interface{}) (int64, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrSchemaNotRegistered error = errors.New("schema not registered")
)
Functions ¶
This section is empty.
Types ¶
type Engine ¶
Engine 数据库引擎, 该引擎通过解析模型json文件, 生成对应的数据库表,并对表进行增删改查操作
func (*Engine) Delete ¶
Delete 删除数据, where中的条件使用命名参数,如:where = "id = :id", namedCondition = map[string]interface{}{"id": 1},注意,delete方法必须有where条件
func (*Engine) Find ¶
func (engine *Engine) Find(name string, namedCondition map[string]interface{}, selectFields []string) ([]map[string]interface{}, error)
Find 查询数据, where中的条件使用命名参数,如:where = "id = :id", namedCondition = map[string]interface{}{"id": 1}
func (*Engine) GetSchemas ¶
GetSchemas 获取所有模型
func (*Engine) MigrateTable ¶
MigrateTable 迁移表
func (*Engine) SchemaTableExists ¶
SchemaTableExists 检查模型对应的表格是否存在
Click to show internal directories.
Click to hide internal directories.