1 Star 0 Fork 0

BOBO/创想空间服务逻辑库

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
consts
enums
example
framework
boot
dao
logic
model
service
validate
hack
library
maps
.gitignore
LICENSE
go.mod
go.sum
克隆/下载
user.go 2.71 KB
一键复制 编辑 原始数据 按行查看 历史
// ==========================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. Created at 2024-06-24 17:05:55
// ==========================================================================
package internal
import (
"context"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
)
// UserDao is the data access object for table user.
type UserDao 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 UserColumns // columns contains all the column names of Table for convenient usage.
}
// UserColumns defines and stores column names for table user.
type UserColumns struct {
Id string // 用户ID
Account string // 账号
Mobile string // 手机号(加密)
Nickname string // 昵称
UniqueId string // 对外身份ID
Status string // 状态:0正常,1冻结,2待注销
UpdateAt string // 更新时间
CreateAt string // 注册时间
}
// userColumns holds the columns for table user.
var userColumns = UserColumns{
Id: "id",
Account: "account",
Mobile: "mobile",
Nickname: "nickname",
UniqueId: "unique_id",
Status: "status",
UpdateAt: "update_at",
CreateAt: "create_at",
}
// NewUserDao creates and returns a new DAO object for table data access.
func NewUserDao() *UserDao {
return &UserDao{
group: "default",
table: "user",
columns: userColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *UserDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *UserDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *UserDao) Columns() UserColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *UserDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *UserDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *UserDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/bobo-rs/creative-services.git
git@gitee.com:bobo-rs/creative-services.git
bobo-rs
creative-services
创想空间服务逻辑库
v1.0.0

搜索帮助