Files
nl-video-api/internal/dao/attachment.go
2025-08-03 00:11:15 +08:00

89 lines
2.8 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 dao
import (
"context"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
)
// internalAttachmentDao is internal type for wrapping internal DAO implements.
type internalAttachmentDao 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 AttachmentColumns // columns contains all the column names of Table for convenient usage.
}
// AttachmentColumns defines and stores column names for table nl_attachment.
type AttachmentColumns struct {
Id string // 附件ID
Name string // 文件名
Path string // 文件路径
Url string // 访问URL
Size string // 文件大小(字节)
MimeType string // 文件类型
Extension string // 文件扩展名
UserId string // 上传用户ID
Status string // 状态0禁用1启用
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
}
// attachmentColumns holds the columns for table nl_attachment.
var attachmentColumns = AttachmentColumns{
Id: "id",
Name: "name",
Path: "path",
Url: "url",
Size: "size",
MimeType: "mime_type",
Extension: "extension",
UserId: "user_id",
Status: "status",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
}
// NewAttachmentDao creates and returns a new DAO object for table data access.
func NewAttachmentDao() *internalAttachmentDao {
return &internalAttachmentDao{
group: "default",
table: "nl_attachment",
columns: attachmentColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *internalAttachmentDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *internalAttachmentDao) Table() string {
return dao.table
}
// Columns returns the columns of current dao.
func (dao *internalAttachmentDao) Columns() AttachmentColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *internalAttachmentDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *internalAttachmentDao) 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 *internalAttachmentDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) error {
return dao.Ctx(ctx).Transaction(ctx, f)
}