// ================================================================================= // Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. // ================================================================================= package dao import ( "context" "github.com/gogf/gf/v2/database/gdb" "github.com/gogf/gf/v2/frame/g" ) // internalConfigDao is internal type for wrapping internal DAO implements. type internalConfigDao struct { table string // table is the underlying table name of the DAO. group string // group is the database configuration group name of current DAO. columns ConfigColumns // columns contains all the column names of Table for convenient usage. } // ConfigColumns defines and stores column names for table nl_config. type ConfigColumns struct { Id string // 配置ID ConfigKey string // 配置键 ConfigValue string // 配置值 ConfigType string // 配置类型 Description string // 配置描述 Status string // 状态:0禁用,1启用 CreatedAt string // 创建时间 UpdatedAt string // 更新时间 } // configColumns holds the columns for table nl_config. var configColumns = ConfigColumns{ Id: "id", ConfigKey: "config_key", ConfigValue: "config_value", ConfigType: "config_type", Description: "description", Status: "status", CreatedAt: "created_at", UpdatedAt: "updated_at", } // NewConfigDao creates and returns a new DAO object for table data access. func NewConfigDao() *internalConfigDao { return &internalConfigDao{ group: "default", table: "nl_config", columns: configColumns, } } // DB retrieves and returns the underlying raw database management object of current DAO. func (dao *internalConfigDao) DB() gdb.DB { return g.DB(dao.group) } // Table returns the table name of current dao. func (dao *internalConfigDao) Table() string { return dao.table } // Columns returns the columns of current dao. func (dao *internalConfigDao) Columns() ConfigColumns { return dao.columns } // Group returns the configuration group name of database of current dao. func (dao *internalConfigDao) Group() string { return dao.group } // Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation. func (dao *internalConfigDao) Ctx(ctx context.Context) *gdb.Model { return dao.DB().Model(dao.table).Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. func (dao *internalConfigDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) error { return dao.Ctx(ctx).Transaction(ctx, f) }