124 lines
4.9 KiB
Go
124 lines
4.9 KiB
Go
// ==========================================================================
|
|
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
|
// ==========================================================================
|
|
|
|
package internal
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/gogf/gf/v2/database/gdb"
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
)
|
|
|
|
// InfraCodegenColumnDao is the data access object for the table infra_codegen_column.
|
|
type InfraCodegenColumnDao struct {
|
|
table string // table is the underlying table name of the DAO.
|
|
group string // group is the database configuration group name of the current DAO.
|
|
columns InfraCodegenColumnColumns // columns contains all the column names of Table for convenient usage.
|
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
|
}
|
|
|
|
// InfraCodegenColumnColumns defines and stores column names for the table infra_codegen_column.
|
|
type InfraCodegenColumnColumns struct {
|
|
Id string // 编号
|
|
TableId string // 表编号
|
|
ColumnName string // 字段名
|
|
DataType string // 字段类型
|
|
ColumnComment string // 字段描述
|
|
Nullable string // 是否允许为空
|
|
PrimaryKey string // 是否主键
|
|
OrdinalPosition string // 排序
|
|
JavaType string // Java 属性类型
|
|
JavaField string // Java 属性名
|
|
DictType string // 字典类型
|
|
Example string // 数据示例
|
|
CreateOperation string // 是否为 Create 创建操作的字段
|
|
UpdateOperation string // 是否为 Update 更新操作的字段
|
|
ListOperation string // 是否为 List 查询操作的字段
|
|
ListOperationCondition string // List 查询操作的条件类型
|
|
ListOperationResult string // 是否为 List 查询操作的返回字段
|
|
HtmlType string // 显示类型
|
|
Creator string // 创建者
|
|
CreateTime string // 创建时间
|
|
Updater string // 更新者
|
|
UpdateTime string // 更新时间
|
|
Deleted string // 是否删除
|
|
}
|
|
|
|
// infraCodegenColumnColumns holds the columns for the table infra_codegen_column.
|
|
var infraCodegenColumnColumns = InfraCodegenColumnColumns{
|
|
Id: "id",
|
|
TableId: "table_id",
|
|
ColumnName: "column_name",
|
|
DataType: "data_type",
|
|
ColumnComment: "column_comment",
|
|
Nullable: "nullable",
|
|
PrimaryKey: "primary_key",
|
|
OrdinalPosition: "ordinal_position",
|
|
JavaType: "java_type",
|
|
JavaField: "java_field",
|
|
DictType: "dict_type",
|
|
Example: "example",
|
|
CreateOperation: "create_operation",
|
|
UpdateOperation: "update_operation",
|
|
ListOperation: "list_operation",
|
|
ListOperationCondition: "list_operation_condition",
|
|
ListOperationResult: "list_operation_result",
|
|
HtmlType: "html_type",
|
|
Creator: "creator",
|
|
CreateTime: "create_time",
|
|
Updater: "updater",
|
|
UpdateTime: "update_time",
|
|
Deleted: "deleted",
|
|
}
|
|
|
|
// NewInfraCodegenColumnDao creates and returns a new DAO object for table data access.
|
|
func NewInfraCodegenColumnDao(handlers ...gdb.ModelHandler) *InfraCodegenColumnDao {
|
|
return &InfraCodegenColumnDao{
|
|
group: "default",
|
|
table: "infra_codegen_column",
|
|
columns: infraCodegenColumnColumns,
|
|
handlers: handlers,
|
|
}
|
|
}
|
|
|
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
|
func (dao *InfraCodegenColumnDao) DB() gdb.DB {
|
|
return g.DB(dao.group)
|
|
}
|
|
|
|
// Table returns the table name of the current DAO.
|
|
func (dao *InfraCodegenColumnDao) Table() string {
|
|
return dao.table
|
|
}
|
|
|
|
// Columns returns all column names of the current DAO.
|
|
func (dao *InfraCodegenColumnDao) Columns() InfraCodegenColumnColumns {
|
|
return dao.columns
|
|
}
|
|
|
|
// Group returns the database configuration group name of the current DAO.
|
|
func (dao *InfraCodegenColumnDao) Group() string {
|
|
return dao.group
|
|
}
|
|
|
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
|
func (dao *InfraCodegenColumnDao) Ctx(ctx context.Context) *gdb.Model {
|
|
model := dao.DB().Model(dao.table)
|
|
for _, handler := range dao.handlers {
|
|
model = handler(model)
|
|
}
|
|
return model.Safe().Ctx(ctx)
|
|
}
|
|
|
|
// Transaction wraps the transaction logic using function f.
|
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
|
// It commits the transaction and returns nil if function f returns nil.
|
|
//
|
|
// Note: Do not commit or roll back the transaction in function f,
|
|
// as it is automatically handled by this function.
|
|
func (dao *InfraCodegenColumnDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
|
}
|