Documentation
¶
Index ¶
- func DefaultDestroy(ctx *plugin.Context) error
- func DefaultGetDBName(ctx *plugin.Context) string
- func DefaultMake(ctx *plugin.Context, groups []ERGroup) ([]string, error)
- func DefaultMakeDao(ctx *plugin.Context, outputPath *string, conf *DaoConfig) error
- func DefaultMakeER(ctx *plugin.Context, groups []ERGroup, outputFile *string, tplFile *string) error
- func DefaultMakeId(ctx *plugin.Context, table string, idField string, idSize uint) (string, error)
- func DefaultQuery1(ctx *plugin.Context, requestSql string, args ...interface{}) (map[string]interface{}, error)
- func DefaultQuery11(ctx *plugin.Context, requestSql string, args ...interface{}) (interface{}, error)
- func DefaultQuery1a(ctx *plugin.Context, requestSql string, args ...interface{}) ([]interface{}, error)
- func InKeys(numArgs int) string
- func MakeDao(outputPath string, conn *db.DB, conf *DaoConfig, ctx *plugin.Context) error
- func MakeER(groups []ERGroup, outputFile *string, tplFile *string, ctx *plugin.Context) error
- func MakeTable(conn *db.DB, table *TableStruct, ctx *plugin.Context) ([]string, error)
- type DB
- func (db *DB) Begin() *Tx
- func (db *DB) Delete(table string, wheres string, args ...interface{}) (ExecResult, error)
- func (db *DB) Destroy() error
- func (db *DB) Exec(requestSql string, args ...interface{}) (ExecResult, error)
- func (db *DB) GetDBName() string
- func (db *DB) Insert(table string, data map[string]interface{}) (ExecResult, error)
- func (db *DB) Make(groups []ERGroup, ctx *plugin.Context) ([]string, error)
- func (db *DB) MakeDao(outputPath *string, conf *DaoConfig, ctx *plugin.Context) error
- func (db *DB) MakeER(groups []ERGroup, outputFile *string, tplFile *string, ctx *plugin.Context) error
- func (db *DB) MakeId(table string, idField string, idSize uint) (string, error)
- func (db *DB) Query(requestSql string, args ...interface{}) (QueryResult, error)
- func (db *DB) Query1(requestSql string, args ...interface{}) (map[string]interface{}, error)
- func (db *DB) Query11(requestSql string, args ...interface{}) (interface{}, error)
- func (db *DB) Query1a(requestSql string, args ...interface{}) ([]interface{}, error)
- func (db *DB) Replace(table string, data map[string]interface{}) (ExecResult, error)
- func (db *DB) Update(table string, data map[string]interface{}, wheres string, args ...interface{}) (ExecResult, error)
- type DaoConfig
- type DaoData
- type ERGroup
- type ExecResult
- func DefaultDelete(ctx *plugin.Context, table string, wheres string, args ...interface{}) (ExecResult, error)
- func DefaultExec(ctx *plugin.Context, requestSql string, args ...interface{}) (ExecResult, error)
- func DefaultInsert(ctx *plugin.Context, table string, data map[string]interface{}) (ExecResult, error)
- func DefaultReplace(ctx *plugin.Context, table string, data map[string]interface{}) (ExecResult, error)
- func DefaultUpdate(ctx *plugin.Context, table string, data map[string]interface{}, wheres string, ...) (ExecResult, error)
- type FieldData
- type IndexField
- type QueryResult
- type TableData
- type TableDesc
- type TableField
- type TableFieldDesc
- type TableIndex
- type TableKeyDesc
- type TableStruct
- type Tx
- func (tx *Tx) CheckFinished() error
- func (tx *Tx) Commit() error
- func (tx *Tx) Delete(table string, wheres string, args ...interface{}) (ExecResult, error)
- func (tx *Tx) Exec(requestSql string, args ...interface{}) (ExecResult, error)
- func (tx *Tx) Finish(ok bool) error
- func (tx *Tx) Insert(table string, data map[string]interface{}) (ExecResult, error)
- func (tx *Tx) Query(requestSql string, args ...interface{}) (QueryResult, error)
- func (tx *Tx) Query1(requestSql string, args ...interface{}) (map[string]interface{}, error)
- func (tx *Tx) Query11(requestSql string, args ...interface{}) (interface{}, error)
- func (tx *Tx) Query1a(requestSql string, args ...interface{}) ([]interface{}, error)
- func (tx *Tx) Replace(table string, data map[string]interface{}) (ExecResult, error)
- func (tx *Tx) Rollback() error
- func (tx *Tx) Update(table string, data map[string]interface{}, wheres string, args ...interface{}) (ExecResult, error)
- type ValidFieldConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultDestroy ¶ added in v1.0.4
func DefaultGetDBName ¶ added in v1.0.4
func DefaultMake ¶ added in v1.0.4
func DefaultMakeDao ¶ added in v1.0.4
func DefaultMakeER ¶ added in v1.0.4
func DefaultMakeId ¶ added in v1.0.4
func DefaultQuery1 ¶ added in v1.0.4
func DefaultQuery11 ¶ added in v1.0.4
func DefaultQuery1a ¶ added in v1.0.4
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func GetDB ¶
GetDB 获得数据库连接 GetDB name 连接配置名称,如果不提供名称则使用默认连接 GetDB return 数据库连接,对象内置连接池操作,完成后无需手动关闭连接
func (*DB) Delete ¶
func (db *DB) Delete(table string, wheres string, args ...interface{}) (ExecResult, error)
Delete 删除数据 Delete return 返回影响的行数
func (*DB) Exec ¶
func (db *DB) Exec(requestSql string, args ...interface{}) (ExecResult, error)
Exec 执行SQL * requestSql SQL语句 * args SQL语句中问号变量的值,按顺序放在请求参数中 Exec return 如果是INSERT到含有自增字段的表中返回插入的自增ID,否则返回影响的行数
func (*DB) Insert ¶
func (db *DB) Insert(table string, data map[string]interface{}) (ExecResult, error)
Insert 插入数据 * table 表名 * data 数据对象(Key-Value格式) Insert return 如果是INSERT到含有自增字段的表中返回插入的自增ID,否则返回影响的行数
func (*DB) MakeER ¶ added in v1.0.3
func (db *DB) MakeER(groups []ERGroup, outputFile *string, tplFile *string, ctx *plugin.Context) error
MakeER 创建ER图
func (*DB) Query ¶
func (db *DB) Query(requestSql string, args ...interface{}) (QueryResult, error)
Query 查询 Query return 返回查询到的数据,对象数组格式
type DaoConfig ¶ added in v1.0.3
type DaoConfig struct { VersionField string ValidFields []ValidFieldConfig }
type ERGroup ¶ added in v1.0.3
type ERGroup struct { Group string Comment string Tables []TableStruct }
type ExecResult ¶ added in v1.0.3
func DefaultDelete ¶ added in v1.0.4
func DefaultExec ¶ added in v1.0.4
func DefaultExec(ctx *plugin.Context, requestSql string, args ...interface{}) (ExecResult, error)
func DefaultInsert ¶ added in v1.0.4
func DefaultReplace ¶ added in v1.0.4
func DefaultUpdate ¶ added in v1.0.4
type IndexField ¶ added in v1.0.3
type QueryResult ¶ added in v1.0.3
func DefaultQuery ¶ added in v1.0.4
func DefaultQuery(ctx *plugin.Context, requestSql string, args ...interface{}) (QueryResult, error)
type TableData ¶ added in v1.0.3
type TableData struct { DBName string TableName string FixedTableName string IsAutoId bool AutoIdField string AutoIdFieldType string PrimaryKey *IndexField UniqueKeys map[string]*IndexField IndexKeys map[string]*IndexField Fields []FieldData PointFields []FieldData //FieldsWithoutAutoId []FieldData SelectFields string ValidFieldConfig ValidFieldConfig ValidField string ValidWhere string ValidSet string InvalidSet string VersionField string HasVersion bool AutoGenerated []string AutoGeneratedOnUpdate []string ExtTableCode []string ExtItemCode []string ExtQueryCode []string }
type TableField ¶ added in v1.0.3
type TableField struct { Name string Type string Index string IndexGroup string Default string Comment string IsNull bool Extra string Null string // contains filtered or unexported fields }
func (*TableField) Parse ¶ added in v1.0.3
func (field *TableField) Parse(tableType string)
type TableFieldDesc ¶ added in v1.0.3
type TableIndex ¶ added in v1.0.3
type TableKeyDesc ¶ added in v1.0.3
type TableStruct ¶ added in v1.0.3
type TableStruct struct { Name string Comment string Fields []TableField }
type Tx ¶
type Tx struct {
// contains filtered or unexported fields
}
func DefaultBegin ¶ added in v1.0.4
func (*Tx) CheckFinished ¶
CheckFinished 检查事务是否已经提交或回滚,如果事务没有结束则执行回滚操作
func (*Tx) Delete ¶
func (tx *Tx) Delete(table string, wheres string, args ...interface{}) (ExecResult, error)
func (*Tx) Insert ¶
func (tx *Tx) Insert(table string, data map[string]interface{}) (ExecResult, error)
Click to show internal directories.
Click to hide internal directories.