Files
likedream/internal/ent/cpimage/cpimage.go
T
2025-11-06 16:27:41 +08:00

147 lines
5.2 KiB
Go

// ENT数据库文件,请勿编辑。
package cpimage
import (
"likedream-goframe/internal/framework/ent2"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"github.com/google/uuid"
)
const (
// Label holds the string label denoting the cpimage type in the database.
Label = "cp_image"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldCreateTime holds the string denoting the create_time field in the database.
FieldCreateTime = "create_time"
// FieldUpdateTime holds the string denoting the update_time field in the database.
FieldUpdateTime = "update_time"
// FieldImageID holds the string denoting the image_id field in the database.
FieldImageID = "image_id"
// FieldKey holds the string denoting the key field in the database.
FieldKey = "key"
// FieldUserID holds the string denoting the user_id field in the database.
FieldUserID = "user_id"
// FieldContentType holds the string denoting the content_type field in the database.
FieldContentType = "content_type"
// FieldContentLength holds the string denoting the content_length field in the database.
FieldContentLength = "content_length"
// EdgeUser holds the string denoting the user edge name in mutations.
EdgeUser = "user"
// Table holds the table name of the cpimage in the database.
Table = "cp_image"
// UserTable is the table that holds the user relation/edge.
UserTable = "cp_image"
// UserInverseTable is the table name for the SysUser entity.
// It exists in this package in order to avoid circular dependency with the "sysuser" package.
UserInverseTable = "sys_user"
// UserColumn is the table column denoting the user relation/edge.
UserColumn = "user_id"
)
// Columns holds all SQL columns for cpimage fields.
var Columns = []string{
FieldID,
FieldCreateTime,
FieldUpdateTime,
FieldImageID,
FieldKey,
FieldUserID,
FieldContentType,
FieldContentLength,
}
// 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
}
// Note that the variables below are initialized by the runtime
// package on the initialization of the application. Therefore,
// it should be imported in the main as follows:
//
// import _ "likedream-goframe/internal/ent/runtime"
var (
Hooks [1]ent.Hook
// DefaultCreateTime holds the default value on creation for the "create_time" field.
DefaultCreateTime func() *ent2.CustomTime
// DefaultUpdateTime holds the default value on creation for the "update_time" field.
DefaultUpdateTime func() *ent2.CustomTime
// DefaultImageID holds the default value on creation for the "image_id" field.
DefaultImageID func() uuid.UUID
// KeyValidator is a validator for the "key" field. It is called by the builders before save.
KeyValidator func(string) error
// UserIDValidator is a validator for the "user_id" field. It is called by the builders before save.
UserIDValidator func(int64) error
// ContentTypeValidator is a validator for the "content_type" field. It is called by the builders before save.
ContentTypeValidator func(string) error
// ContentLengthValidator is a validator for the "content_length" field. It is called by the builders before save.
ContentLengthValidator func(int64) error
)
// OrderOption defines the ordering options for the CpImage 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()
}
// ByCreateTime orders the results by the create_time field.
func ByCreateTime(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreateTime, opts...).ToFunc()
}
// ByUpdateTime orders the results by the update_time field.
func ByUpdateTime(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUpdateTime, opts...).ToFunc()
}
// ByImageID orders the results by the image_id field.
func ByImageID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldImageID, opts...).ToFunc()
}
// ByKey orders the results by the key field.
func ByKey(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldKey, opts...).ToFunc()
}
// ByUserID orders the results by the user_id field.
func ByUserID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUserID, opts...).ToFunc()
}
// ByContentType orders the results by the content_type field.
func ByContentType(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldContentType, opts...).ToFunc()
}
// ByContentLength orders the results by the content_length field.
func ByContentLength(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldContentLength, opts...).ToFunc()
}
// ByUserField orders the results by user field.
func ByUserField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newUserStep(), sql.OrderByField(field, opts...))
}
}
func newUserStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(UserInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, UserTable, UserColumn),
)
}