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