Files
im_manager/server/internal/dao/internal/im_message_curfew_rules.go
T

124 lines
4.5 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"
)
// ImMessageCurfewRulesDao is the data access object for the table im_message_curfew_rules.
type ImMessageCurfewRulesDao 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 ImMessageCurfewRulesColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// ImMessageCurfewRulesColumns defines and stores column names for the table im_message_curfew_rules.
type ImMessageCurfewRulesColumns struct {
Id string //
TenantId string //
PolicyId string //
RuleCode string //
RuleName string //
DateType string // daily, weekday, weekend, custom
CustomDates string // YYYY-MM-DD values for custom date type
Weekdays string // ISO weekdays 1 through 7
Timezone string //
StartTime string //
EndTime string // Less than start_time means crossing midnight
Scope string // private_message or group_message
WhitelistUserIds string //
WhitelistGroupIds string //
Message string //
Status string // 1 enabled, 2 disabled
Sort string //
CreatedAt string //
CreatedBy string //
UpdatedAt string //
UpdatedBy string //
DeletedAt string //
DeletedBy string //
}
// imMessageCurfewRulesColumns holds the columns for the table im_message_curfew_rules.
var imMessageCurfewRulesColumns = ImMessageCurfewRulesColumns{
Id: "id",
TenantId: "tenant_id",
PolicyId: "policy_id",
RuleCode: "rule_code",
RuleName: "rule_name",
DateType: "date_type",
CustomDates: "custom_dates",
Weekdays: "weekdays",
Timezone: "timezone",
StartTime: "start_time",
EndTime: "end_time",
Scope: "scope",
WhitelistUserIds: "whitelist_user_ids",
WhitelistGroupIds: "whitelist_group_ids",
Message: "message",
Status: "status",
Sort: "sort",
CreatedAt: "created_at",
CreatedBy: "created_by",
UpdatedAt: "updated_at",
UpdatedBy: "updated_by",
DeletedAt: "deleted_at",
DeletedBy: "deleted_by",
}
// NewImMessageCurfewRulesDao creates and returns a new DAO object for table data access.
func NewImMessageCurfewRulesDao(handlers ...gdb.ModelHandler) *ImMessageCurfewRulesDao {
return &ImMessageCurfewRulesDao{
group: "default",
table: "im_message_curfew_rules",
columns: imMessageCurfewRulesColumns,
handlers: handlers,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
func (dao *ImMessageCurfewRulesDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
func (dao *ImMessageCurfewRulesDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
func (dao *ImMessageCurfewRulesDao) Columns() ImMessageCurfewRulesColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
func (dao *ImMessageCurfewRulesDao) 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 *ImMessageCurfewRulesDao) 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 *ImMessageCurfewRulesDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}