118 lines
4.7 KiB
Go
118 lines
4.7 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"
|
|
)
|
|
|
|
// ImTenantDao is the data access object for the table im_tenant.
|
|
type ImTenantDao 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 ImTenantColumns // columns contains all the column names of Table for convenient usage.
|
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
|
}
|
|
|
|
// ImTenantColumns defines and stores column names for the table im_tenant.
|
|
type ImTenantColumns struct {
|
|
Id string //
|
|
Code string //
|
|
Name string //
|
|
TenantDesc string //
|
|
MaxUsers string // 0表示ä¸é™åˆ¶
|
|
MaxGroups string // 0表示ä¸é™åˆ¶
|
|
MaxGroupMembers string // 0表示ä¸é™åˆ¶
|
|
RealnameReviewPolicy string // 实åå®¡æ ¸ç–略:0自动通过,1è½¬äººå·¥å®¡æ ¸
|
|
AliyunModerationEnabled string // 是å¦å¯ç”¨é˜¿é‡Œäº‘å†…å®¹å®¡æ ¸
|
|
LocalModerationEnabled string // 是å¦å¯ç”¨æœ¬åœ°å†…å®¹å®¡æ ¸
|
|
MessageEncryptionEnabled string // 是å¦å¯ç”¨æ¶ˆæ¯åР坆
|
|
DefaultPolicyGroupId string // 默认用户ç–略组
|
|
SecurityPolicyVersion string // å·²å‘布安全ç–略版本
|
|
GlobalFriendEnabled string // å…¨å±€åŠ å¥½å‹å¼€å…³
|
|
MessageCurfewEnabled string // 消æ¯å®µç¦å¼€å…³
|
|
State string //
|
|
CreatedAt string //
|
|
CreatedBy string //
|
|
UpdatedAt string //
|
|
UpdatedBy string //
|
|
}
|
|
|
|
// imTenantColumns holds the columns for the table im_tenant.
|
|
var imTenantColumns = ImTenantColumns{
|
|
Id: "id",
|
|
Code: "code",
|
|
Name: "name",
|
|
TenantDesc: "tenant_desc",
|
|
MaxUsers: "max_users",
|
|
MaxGroups: "max_groups",
|
|
MaxGroupMembers: "max_group_members",
|
|
RealnameReviewPolicy: "realname_review_policy",
|
|
AliyunModerationEnabled: "aliyun_moderation_enabled",
|
|
LocalModerationEnabled: "local_moderation_enabled",
|
|
MessageEncryptionEnabled: "message_encryption_enabled",
|
|
DefaultPolicyGroupId: "default_policy_group_id",
|
|
SecurityPolicyVersion: "security_policy_version",
|
|
GlobalFriendEnabled: "global_friend_enabled",
|
|
MessageCurfewEnabled: "message_curfew_enabled",
|
|
State: "state",
|
|
CreatedAt: "created_at",
|
|
CreatedBy: "created_by",
|
|
UpdatedAt: "updated_at",
|
|
UpdatedBy: "updated_by",
|
|
}
|
|
|
|
// NewImTenantDao creates and returns a new DAO object for table data access.
|
|
func NewImTenantDao(handlers ...gdb.ModelHandler) *ImTenantDao {
|
|
return &ImTenantDao{
|
|
group: "default",
|
|
table: "im_tenant",
|
|
columns: imTenantColumns,
|
|
handlers: handlers,
|
|
}
|
|
}
|
|
|
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
|
func (dao *ImTenantDao) DB() gdb.DB {
|
|
return g.DB(dao.group)
|
|
}
|
|
|
|
// Table returns the table name of the current DAO.
|
|
func (dao *ImTenantDao) Table() string {
|
|
return dao.table
|
|
}
|
|
|
|
// Columns returns all column names of the current DAO.
|
|
func (dao *ImTenantDao) Columns() ImTenantColumns {
|
|
return dao.columns
|
|
}
|
|
|
|
// Group returns the database configuration group name of the current DAO.
|
|
func (dao *ImTenantDao) 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 *ImTenantDao) 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 *ImTenantDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
|
}
|