// ================================================================================= // 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" ) // internalVipLevelDao is internal type for wrapping internal DAO implements. type internalVipLevelDao 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 VipLevelColumns // columns contains all the column names of Table for convenient usage. } // VipLevelColumns defines and stores column names for table nl_vip_level. type VipLevelColumns struct { Id string // VIP等级ID Name string // VIP等级名称 Level string // 等级数值 Price string // 价格 Duration string // 有效期(天) Description string // 等级描述 Privileges string // 特权说明(JSON格式) Status string // 状态:0禁用,1启用 Sort string // 排序 CreatedAt string // 创建时间 UpdatedAt string // 更新时间 } // vipLevelColumns holds the columns for table nl_vip_level. var vipLevelColumns = VipLevelColumns{ Id: "id", Name: "name", Level: "level", Price: "price", Duration: "duration", Description: "description", Privileges: "privileges", Status: "status", Sort: "sort", CreatedAt: "created_at", UpdatedAt: "updated_at", } // NewVipLevelDao creates and returns a new DAO object for table data access. func NewVipLevelDao() *internalVipLevelDao { return &internalVipLevelDao{ group: "default", table: "nl_vip_level", columns: vipLevelColumns, } } // DB retrieves and returns the underlying raw database management object of current DAO. func (dao *internalVipLevelDao) DB() gdb.DB { return g.DB(dao.group) } // Table returns the table name of current dao. func (dao *internalVipLevelDao) Table() string { return dao.table } // Columns returns the columns of current dao. func (dao *internalVipLevelDao) Columns() VipLevelColumns { return dao.columns } // Group returns the configuration group name of database of current dao. func (dao *internalVipLevelDao) Group() string { return dao.group } // Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation. func (dao *internalVipLevelDao) 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 *internalVipLevelDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) error { return dao.Ctx(ctx).Transaction(ctx, f) }