versia-go/ent/servermetadata/servermetadata.go
2024-08-13 01:18:14 +02:00

186 lines
6.8 KiB
Go

// Code generated by ent, DO NOT EDIT.
package servermetadata
import (
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"github.com/google/uuid"
"github.com/lysand-org/versia-go/pkg/lysand"
)
const (
// Label holds the string label denoting the servermetadata type in the database.
Label = "server_metadata"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldIsRemote holds the string denoting the isremote field in the database.
FieldIsRemote = "is_remote"
// FieldURI holds the string denoting the uri field in the database.
FieldURI = "uri"
// FieldExtensions holds the string denoting the extensions field in the database.
FieldExtensions = "extensions"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt = "created_at"
// FieldUpdatedAt holds the string denoting the updated_at field in the database.
FieldUpdatedAt = "updated_at"
// FieldName holds the string denoting the name field in the database.
FieldName = "name"
// FieldDescription holds the string denoting the description field in the database.
FieldDescription = "description"
// FieldVersion holds the string denoting the version field in the database.
FieldVersion = "version"
// FieldSupportedExtensions holds the string denoting the supportedextensions field in the database.
FieldSupportedExtensions = "supported_extensions"
// EdgeFollower holds the string denoting the follower edge name in mutations.
EdgeFollower = "follower"
// EdgeFollowee holds the string denoting the followee edge name in mutations.
EdgeFollowee = "followee"
// Table holds the table name of the servermetadata in the database.
Table = "server_metadata"
// FollowerTable is the table that holds the follower relation/edge.
FollowerTable = "server_metadata"
// FollowerInverseTable is the table name for the User entity.
// It exists in this package in order to avoid circular dependency with the "user" package.
FollowerInverseTable = "users"
// FollowerColumn is the table column denoting the follower relation/edge.
FollowerColumn = "server_metadata_follower"
// FolloweeTable is the table that holds the followee relation/edge.
FolloweeTable = "server_metadata"
// FolloweeInverseTable is the table name for the User entity.
// It exists in this package in order to avoid circular dependency with the "user" package.
FolloweeInverseTable = "users"
// FolloweeColumn is the table column denoting the followee relation/edge.
FolloweeColumn = "server_metadata_followee"
)
// Columns holds all SQL columns for servermetadata fields.
var Columns = []string{
FieldID,
FieldIsRemote,
FieldURI,
FieldExtensions,
FieldCreatedAt,
FieldUpdatedAt,
FieldName,
FieldDescription,
FieldVersion,
FieldSupportedExtensions,
}
// ForeignKeys holds the SQL foreign-keys that are owned by the "server_metadata"
// table and are not defined as standalone fields in the schema.
var ForeignKeys = []string{
"server_metadata_follower",
"server_metadata_followee",
}
// 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
}
}
for i := range ForeignKeys {
if column == ForeignKeys[i] {
return true
}
}
return false
}
var (
// URIValidator is a validator for the "uri" field. It is called by the builders before save.
URIValidator func(string) error
// DefaultExtensions holds the default value on creation for the "extensions" field.
DefaultExtensions lysand.Extensions
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt func() time.Time
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
DefaultUpdatedAt func() time.Time
// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
UpdateDefaultUpdatedAt func() time.Time
// NameValidator is a validator for the "name" field. It is called by the builders before save.
NameValidator func(string) error
// VersionValidator is a validator for the "version" field. It is called by the builders before save.
VersionValidator func(string) error
// DefaultSupportedExtensions holds the default value on creation for the "supportedExtensions" field.
DefaultSupportedExtensions []string
// DefaultID holds the default value on creation for the "id" field.
DefaultID func() uuid.UUID
)
// OrderOption defines the ordering options for the ServerMetadata 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()
}
// ByIsRemote orders the results by the isRemote field.
func ByIsRemote(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldIsRemote, opts...).ToFunc()
}
// ByURI orders the results by the uri field.
func ByURI(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldURI, opts...).ToFunc()
}
// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}
// ByUpdatedAt orders the results by the updated_at field.
func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
}
// ByName orders the results by the name field.
func ByName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldName, opts...).ToFunc()
}
// ByDescription orders the results by the description field.
func ByDescription(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDescription, opts...).ToFunc()
}
// ByVersion orders the results by the version field.
func ByVersion(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldVersion, opts...).ToFunc()
}
// ByFollowerField orders the results by follower field.
func ByFollowerField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newFollowerStep(), sql.OrderByField(field, opts...))
}
}
// ByFolloweeField orders the results by followee field.
func ByFolloweeField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newFolloweeStep(), sql.OrderByField(field, opts...))
}
}
func newFollowerStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(FollowerInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, false, FollowerTable, FollowerColumn),
)
}
func newFolloweeStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(FolloweeInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, false, FolloweeTable, FolloweeColumn),
)
}