Files
arenax-server/internal/dao/internal/notices.go
2025-05-29 16:23:14 +08:00

94 lines
3.1 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// ==========================================================================
// 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"
)
// NoticesDao is the data access object for the table notices.
type NoticesDao 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 NoticesColumns // columns contains all the column names of Table for convenient usage.
}
// NoticesColumns defines and stores column names for the table notices.
type NoticesColumns struct {
Id string // 通知ID
Title string // 通知标题
Content string // 通知内容
Type string // 通知类型1=系统公告2=活动通知3=维护通知
Status string // 状态0=关闭1=发布
VisibleTo string // 可见范围1=所有人2=仅门店3=仅用户
MerchantId string // 所属商户ID
StoreId string // 所属门店ID
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
DeletedAt string // 软删除时间戳
}
// noticesColumns holds the columns for the table notices.
var noticesColumns = NoticesColumns{
Id: "id",
Title: "title",
Content: "content",
Type: "type",
Status: "status",
VisibleTo: "visible_to",
MerchantId: "merchant_id",
StoreId: "store_id",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
}
// NewNoticesDao creates and returns a new DAO object for table data access.
func NewNoticesDao() *NoticesDao {
return &NoticesDao{
group: "default",
table: "notices",
columns: noticesColumns,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
func (dao *NoticesDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
func (dao *NoticesDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
func (dao *NoticesDao) Columns() NoticesColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
func (dao *NoticesDao) 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 *NoticesDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).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 *NoticesDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}