2026-09-15 16:37:39 +08:00
|
|
|
// Code generated by ent, DO NOT EDIT.
|
|
|
|
|
|
|
|
|
|
package attachment
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
// Label holds the string label denoting the attachment type in the database.
|
|
|
|
|
Label = "attachment"
|
|
|
|
|
// FieldID holds the string denoting the id field in the database.
|
|
|
|
|
FieldID = "id"
|
|
|
|
|
// FieldBizType holds the string denoting the biz_type field in the database.
|
|
|
|
|
FieldBizType = "biz_type"
|
|
|
|
|
// FieldBizID holds the string denoting the biz_id field in the database.
|
|
|
|
|
FieldBizID = "biz_id"
|
|
|
|
|
// FieldFileName holds the string denoting the file_name field in the database.
|
|
|
|
|
FieldFileName = "file_name"
|
|
|
|
|
// FieldFilePath holds the string denoting the file_path field in the database.
|
|
|
|
|
FieldFilePath = "file_path"
|
2026-09-19 10:54:15 +08:00
|
|
|
// FieldFileType holds the string denoting the file_type field in the database.
|
|
|
|
|
FieldFileType = "file_type"
|
|
|
|
|
// FieldFileExt holds the string denoting the file_ext field in the database.
|
|
|
|
|
FieldFileExt = "file_ext"
|
|
|
|
|
// FieldFileMd5 holds the string denoting the file_md5 field in the database.
|
|
|
|
|
FieldFileMd5 = "file_md5"
|
2026-09-15 16:37:39 +08:00
|
|
|
// FieldFileSize holds the string denoting the file_size field in the database.
|
|
|
|
|
FieldFileSize = "file_size"
|
|
|
|
|
// FieldMimeType holds the string denoting the mime_type field in the database.
|
|
|
|
|
FieldMimeType = "mime_type"
|
|
|
|
|
// FieldUploadedBy holds the string denoting the uploaded_by field in the database.
|
|
|
|
|
FieldUploadedBy = "uploaded_by"
|
2026-09-19 10:54:15 +08:00
|
|
|
// FieldArchived holds the string denoting the archived field in the database.
|
|
|
|
|
FieldArchived = "archived"
|
|
|
|
|
// FieldArchivedAt holds the string denoting the archived_at field in the database.
|
|
|
|
|
FieldArchivedAt = "archived_at"
|
|
|
|
|
// FieldDeleted holds the string denoting the deleted field in the database.
|
|
|
|
|
FieldDeleted = "deleted"
|
|
|
|
|
// FieldDeletedAt holds the string denoting the deleted_at field in the database.
|
|
|
|
|
FieldDeletedAt = "deleted_at"
|
|
|
|
|
// FieldDeletedBy holds the string denoting the deleted_by field in the database.
|
|
|
|
|
FieldDeletedBy = "deleted_by"
|
2026-09-15 16:37:39 +08:00
|
|
|
// FieldCreatedAt holds the string denoting the created_at field in the database.
|
|
|
|
|
FieldCreatedAt = "created_at"
|
|
|
|
|
// Table holds the table name of the attachment in the database.
|
|
|
|
|
Table = "attachments"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Columns holds all SQL columns for attachment fields.
|
|
|
|
|
var Columns = []string{
|
|
|
|
|
FieldID,
|
|
|
|
|
FieldBizType,
|
|
|
|
|
FieldBizID,
|
|
|
|
|
FieldFileName,
|
|
|
|
|
FieldFilePath,
|
2026-09-19 10:54:15 +08:00
|
|
|
FieldFileType,
|
|
|
|
|
FieldFileExt,
|
|
|
|
|
FieldFileMd5,
|
2026-09-15 16:37:39 +08:00
|
|
|
FieldFileSize,
|
|
|
|
|
FieldMimeType,
|
|
|
|
|
FieldUploadedBy,
|
2026-09-19 10:54:15 +08:00
|
|
|
FieldArchived,
|
|
|
|
|
FieldArchivedAt,
|
|
|
|
|
FieldDeleted,
|
|
|
|
|
FieldDeletedAt,
|
|
|
|
|
FieldDeletedBy,
|
2026-09-15 16:37:39 +08:00
|
|
|
FieldCreatedAt,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ValidColumn reports if the column name is valid (part of the table columns).
|
|
|
|
|
func ValidColumn(column string) bool {
|
|
|
|
|
for i := range Columns {
|
|
|
|
|
if column == Columns[i] {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var (
|
|
|
|
|
// DefaultFileSize holds the default value on creation for the "file_size" field.
|
|
|
|
|
DefaultFileSize int64
|
2026-09-19 10:54:15 +08:00
|
|
|
// DefaultArchived holds the default value on creation for the "archived" field.
|
|
|
|
|
DefaultArchived bool
|
|
|
|
|
// DefaultDeleted holds the default value on creation for the "deleted" field.
|
|
|
|
|
DefaultDeleted bool
|
2026-09-15 16:37:39 +08:00
|
|
|
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
|
|
|
|
|
DefaultCreatedAt func() int64
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// OrderOption defines the ordering options for the Attachment queries.
|
|
|
|
|
type OrderOption func(*sql.Selector)
|
|
|
|
|
|
|
|
|
|
// ByID orders the results by the id field.
|
|
|
|
|
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
|
return sql.OrderByField(FieldID, opts...).ToFunc()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ByBizType orders the results by the biz_type field.
|
|
|
|
|
func ByBizType(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
|
return sql.OrderByField(FieldBizType, opts...).ToFunc()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ByBizID orders the results by the biz_id field.
|
|
|
|
|
func ByBizID(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
|
return sql.OrderByField(FieldBizID, opts...).ToFunc()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ByFileName orders the results by the file_name field.
|
|
|
|
|
func ByFileName(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
|
return sql.OrderByField(FieldFileName, opts...).ToFunc()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ByFilePath orders the results by the file_path field.
|
|
|
|
|
func ByFilePath(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
|
return sql.OrderByField(FieldFilePath, opts...).ToFunc()
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-19 10:54:15 +08:00
|
|
|
// ByFileType orders the results by the file_type field.
|
|
|
|
|
func ByFileType(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
|
return sql.OrderByField(FieldFileType, opts...).ToFunc()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ByFileExt orders the results by the file_ext field.
|
|
|
|
|
func ByFileExt(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
|
return sql.OrderByField(FieldFileExt, opts...).ToFunc()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ByFileMd5 orders the results by the file_md5 field.
|
|
|
|
|
func ByFileMd5(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
|
return sql.OrderByField(FieldFileMd5, opts...).ToFunc()
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-15 16:37:39 +08:00
|
|
|
// ByFileSize orders the results by the file_size field.
|
|
|
|
|
func ByFileSize(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
|
return sql.OrderByField(FieldFileSize, opts...).ToFunc()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ByMimeType orders the results by the mime_type field.
|
|
|
|
|
func ByMimeType(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
|
return sql.OrderByField(FieldMimeType, opts...).ToFunc()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ByUploadedBy orders the results by the uploaded_by field.
|
|
|
|
|
func ByUploadedBy(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
|
return sql.OrderByField(FieldUploadedBy, opts...).ToFunc()
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-19 10:54:15 +08:00
|
|
|
// ByArchived orders the results by the archived field.
|
|
|
|
|
func ByArchived(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
|
return sql.OrderByField(FieldArchived, opts...).ToFunc()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ByArchivedAt orders the results by the archived_at field.
|
|
|
|
|
func ByArchivedAt(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
|
return sql.OrderByField(FieldArchivedAt, opts...).ToFunc()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ByDeleted orders the results by the deleted field.
|
|
|
|
|
func ByDeleted(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
|
return sql.OrderByField(FieldDeleted, opts...).ToFunc()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ByDeletedAt orders the results by the deleted_at field.
|
|
|
|
|
func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
|
return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ByDeletedBy orders the results by the deleted_by field.
|
|
|
|
|
func ByDeletedBy(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
|
return sql.OrderByField(FieldDeletedBy, opts...).ToFunc()
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-15 16:37:39 +08:00
|
|
|
// ByCreatedAt orders the results by the created_at field.
|
|
|
|
|
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
|
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
|
|
|
|
|
}
|