89 lines
2.8 KiB
Go
89 lines
2.8 KiB
Go
// =================================================================================
|
||
// 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)
|
||
}
|