83 lines
2.5 KiB
Go
83 lines
2.5 KiB
Go
// =================================================================================
|
|
// 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"
|
|
)
|
|
|
|
// internalUserLogDao is internal type for wrapping internal DAO implements.
|
|
type internalUserLogDao 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 UserLogColumns // columns contains all the column names of Table for convenient usage.
|
|
}
|
|
|
|
// UserLogColumns defines and stores column names for table nl_user_log.
|
|
type UserLogColumns struct {
|
|
Id string // 日志ID
|
|
UserId string // 用户ID
|
|
Action string // 操作动作
|
|
Module string // 操作模块
|
|
Content string // 操作内容
|
|
Ip string // IP地址
|
|
UserAgent string // 用户代理
|
|
CreatedAt string // 创建时间
|
|
}
|
|
|
|
// userLogColumns holds the columns for table nl_user_log.
|
|
var userLogColumns = UserLogColumns{
|
|
Id: "id",
|
|
UserId: "user_id",
|
|
Action: "action",
|
|
Module: "module",
|
|
Content: "content",
|
|
Ip: "ip",
|
|
UserAgent: "user_agent",
|
|
CreatedAt: "created_at",
|
|
}
|
|
|
|
// NewUserLogDao creates and returns a new DAO object for table data access.
|
|
func NewUserLogDao() *internalUserLogDao {
|
|
return &internalUserLogDao{
|
|
group: "default",
|
|
table: "nl_user_log",
|
|
columns: userLogColumns,
|
|
}
|
|
}
|
|
|
|
// DB retrieves and returns the underlying raw database management object of current DAO.
|
|
func (dao *internalUserLogDao) DB() gdb.DB {
|
|
return g.DB(dao.group)
|
|
}
|
|
|
|
// Table returns the table name of current dao.
|
|
func (dao *internalUserLogDao) Table() string {
|
|
return dao.table
|
|
}
|
|
|
|
// Columns returns the columns of current dao.
|
|
func (dao *internalUserLogDao) Columns() UserLogColumns {
|
|
return dao.columns
|
|
}
|
|
|
|
// Group returns the configuration group name of database of current dao.
|
|
func (dao *internalUserLogDao) Group() string {
|
|
return dao.group
|
|
}
|
|
|
|
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
|
func (dao *internalUserLogDao) 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 *internalUserLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) error {
|
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
|
}
|