1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- // ==========================================================================
- // 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"
- )
- // AdminTokenDao is the data access object for the table admin_token.
- type AdminTokenDao 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 AdminTokenColumns // columns contains all the column names of Table for convenient usage.
- }
- // AdminTokenColumns defines and stores column names for the table admin_token.
- type AdminTokenColumns struct {
- Id string //
- Token string // token
- AdminUserId string // 用户ID
- ExpireTime string // 过期时间
- CreateTime string // 创建时间
- UpdateTime string // 更新时间
- }
- // adminTokenColumns holds the columns for the table admin_token.
- var adminTokenColumns = AdminTokenColumns{
- Id: "id",
- Token: "token",
- AdminUserId: "admin_user_id",
- ExpireTime: "expire_time",
- CreateTime: "create_time",
- UpdateTime: "update_time",
- }
- // NewAdminTokenDao creates and returns a new DAO object for table data access.
- func NewAdminTokenDao() *AdminTokenDao {
- return &AdminTokenDao{
- group: "cadmin",
- table: "admin_token",
- columns: adminTokenColumns,
- }
- }
- // DB retrieves and returns the underlying raw database management object of the current DAO.
- func (dao *AdminTokenDao) DB() gdb.DB {
- return g.DB(dao.group)
- }
- // Table returns the table name of the current DAO.
- func (dao *AdminTokenDao) Table() string {
- return dao.table
- }
- // Columns returns all column names of the current DAO.
- func (dao *AdminTokenDao) Columns() AdminTokenColumns {
- return dao.columns
- }
- // Group returns the database configuration group name of the current DAO.
- func (dao *AdminTokenDao) 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 *AdminTokenDao) 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 *AdminTokenDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
- return dao.Ctx(ctx).Transaction(ctx, f)
- }
|