116 lines
3.8 KiB
Go
116 lines
3.8 KiB
Go
// ==========================================================================
|
|
// 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"
|
|
)
|
|
|
|
// ImSensitiveWordsDao is the data access object for the table im_sensitive_words.
|
|
type ImSensitiveWordsDao 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 ImSensitiveWordsColumns // columns contains all the column names of Table for convenient usage.
|
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
|
}
|
|
|
|
// ImSensitiveWordsColumns defines and stores column names for the table im_sensitive_words.
|
|
type ImSensitiveWordsColumns struct {
|
|
Id string //
|
|
TenantId string // 0 means global dictionary
|
|
GroupId string //
|
|
Word string //
|
|
WordHash string // SHA-256 of normalized word
|
|
MatchType string //
|
|
SceneJson string // Enabled scenes
|
|
Action string //
|
|
Replacement string //
|
|
RiskLevel string //
|
|
Priority string //
|
|
Status string // 1 enabled, 2 disabled
|
|
Remark string //
|
|
CreatedAt string //
|
|
CreatedBy string //
|
|
UpdatedAt string //
|
|
UpdatedBy string //
|
|
DeletedAt string //
|
|
DeletedBy string //
|
|
}
|
|
|
|
// imSensitiveWordsColumns holds the columns for the table im_sensitive_words.
|
|
var imSensitiveWordsColumns = ImSensitiveWordsColumns{
|
|
Id: "id",
|
|
TenantId: "tenant_id",
|
|
GroupId: "group_id",
|
|
Word: "word",
|
|
WordHash: "word_hash",
|
|
MatchType: "match_type",
|
|
SceneJson: "scene_json",
|
|
Action: "action",
|
|
Replacement: "replacement",
|
|
RiskLevel: "risk_level",
|
|
Priority: "priority",
|
|
Status: "status",
|
|
Remark: "remark",
|
|
CreatedAt: "created_at",
|
|
CreatedBy: "created_by",
|
|
UpdatedAt: "updated_at",
|
|
UpdatedBy: "updated_by",
|
|
DeletedAt: "deleted_at",
|
|
DeletedBy: "deleted_by",
|
|
}
|
|
|
|
// NewImSensitiveWordsDao creates and returns a new DAO object for table data access.
|
|
func NewImSensitiveWordsDao(handlers ...gdb.ModelHandler) *ImSensitiveWordsDao {
|
|
return &ImSensitiveWordsDao{
|
|
group: "default",
|
|
table: "im_sensitive_words",
|
|
columns: imSensitiveWordsColumns,
|
|
handlers: handlers,
|
|
}
|
|
}
|
|
|
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
|
func (dao *ImSensitiveWordsDao) DB() gdb.DB {
|
|
return g.DB(dao.group)
|
|
}
|
|
|
|
// Table returns the table name of the current DAO.
|
|
func (dao *ImSensitiveWordsDao) Table() string {
|
|
return dao.table
|
|
}
|
|
|
|
// Columns returns all column names of the current DAO.
|
|
func (dao *ImSensitiveWordsDao) Columns() ImSensitiveWordsColumns {
|
|
return dao.columns
|
|
}
|
|
|
|
// Group returns the database configuration group name of the current DAO.
|
|
func (dao *ImSensitiveWordsDao) 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 *ImSensitiveWordsDao) Ctx(ctx context.Context) *gdb.Model {
|
|
model := dao.DB().Model(dao.table)
|
|
for _, handler := range dao.handlers {
|
|
model = handler(model)
|
|
}
|
|
return model.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 *ImSensitiveWordsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
|
}
|