versia-go/ent/image/image.go

61 lines
1.6 KiB
Go
Raw Normal View History

2024-08-11 03:51:22 +02:00
// Code generated by ent, DO NOT EDIT.
package image
import (
"entgo.io/ent/dialect/sql"
)
const (
// Label holds the string label denoting the image type in the database.
Label = "image"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldURL holds the string denoting the url field in the database.
FieldURL = "url"
// FieldMimeType holds the string denoting the mimetype field in the database.
FieldMimeType = "mime_type"
// Table holds the table name of the image in the database.
Table = "images"
)
// Columns holds all SQL columns for image fields.
var Columns = []string{
FieldID,
FieldURL,
FieldMimeType,
}
// 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
}
2024-08-20 22:43:26 +02:00
var (
// URLValidator is a validator for the "url" field. It is called by the builders before save.
URLValidator func(string) error
)
2024-08-11 03:51:22 +02:00
// OrderOption defines the ordering options for the Image 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()
}
// ByURL orders the results by the url field.
func ByURL(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldURL, opts...).ToFunc()
}
// ByMimeType orders the results by the mimeType field.
func ByMimeType(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldMimeType, opts...).ToFunc()
}