123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- // ==========================================================================
- // 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"
- )
- // AdminUserDao is the data access object for the table admin_user.
- type AdminUserDao 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 AdminUserColumns // columns contains all the column names of Table for convenient usage.
- }
- // AdminUserColumns defines and stores column names for the table admin_user.
- type AdminUserColumns struct {
- Id string //
- Username string // 用户名
- Password string // 密码
- LastLoginIp string // 最后登录IP
- LastLoginTime string // 最后登录时间
- Status string // 状态
- Description string // 描述
- CreateTime string // 创建时间
- UpdateTime string // 更新时间
- Phone string // 手机号
- Wxuserid string // 企业微信关联id
- }
- // adminUserColumns holds the columns for the table admin_user.
- var adminUserColumns = AdminUserColumns{
- Id: "id",
- Username: "username",
- Password: "password",
- LastLoginIp: "last_login_ip",
- LastLoginTime: "last_login_time",
- Status: "status",
- Description: "description",
- CreateTime: "create_time",
- UpdateTime: "update_time",
- Phone: "phone",
- Wxuserid: "wxuserid",
- }
- // NewAdminUserDao creates and returns a new DAO object for table data access.
- func NewAdminUserDao() *AdminUserDao {
- return &AdminUserDao{
- group: "cadmin",
- table: "admin_user",
- columns: adminUserColumns,
- }
- }
- // DB retrieves and returns the underlying raw database management object of the current DAO.
- func (dao *AdminUserDao) DB() gdb.DB {
- return g.DB(dao.group)
- }
- // Table returns the table name of the current DAO.
- func (dao *AdminUserDao) Table() string {
- return dao.table
- }
- // Columns returns all column names of the current DAO.
- func (dao *AdminUserDao) Columns() AdminUserColumns {
- return dao.columns
- }
- // Group returns the database configuration group name of the current DAO.
- func (dao *AdminUserDao) 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 *AdminUserDao) Ctx(ctx context.Context) *gdb.Model {
- return dao.DB().Model(dao.table).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 *AdminUserDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
- return dao.Ctx(ctx).Transaction(ctx, f)
- }
|