versia-go/ent/instancemetadata/instancemetadata.go

333 lines
14 KiB
Go
Raw Permalink Normal View History

2024-08-20 22:43:26 +02:00
// Code generated by ent, DO NOT EDIT.
package instancemetadata
import (
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"github.com/google/uuid"
2024-08-28 00:25:25 +02:00
"github.com/versia-pub/versia-go/pkg/versia"
2024-08-20 22:43:26 +02:00
)
const (
// Label holds the string label denoting the instancemetadata type in the database.
Label = "instance_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"
// FieldHost holds the string denoting the host field in the database.
FieldHost = "host"
// FieldPublicKey holds the string denoting the publickey field in the database.
FieldPublicKey = "public_key"
// FieldPublicKeyAlgorithm holds the string denoting the publickeyalgorithm field in the database.
FieldPublicKeyAlgorithm = "public_key_algorithm"
// FieldPrivateKey holds the string denoting the privatekey field in the database.
FieldPrivateKey = "private_key"
// FieldSoftwareName holds the string denoting the softwarename field in the database.
FieldSoftwareName = "software_name"
// FieldSoftwareVersion holds the string denoting the softwareversion field in the database.
FieldSoftwareVersion = "software_version"
// FieldSharedInboxURI holds the string denoting the sharedinboxuri field in the database.
FieldSharedInboxURI = "shared_inbox_uri"
// FieldModeratorsURI holds the string denoting the moderatorsuri field in the database.
FieldModeratorsURI = "moderators_uri"
// FieldAdminsURI holds the string denoting the adminsuri field in the database.
FieldAdminsURI = "admins_uri"
// FieldLogoEndpoint holds the string denoting the logoendpoint field in the database.
FieldLogoEndpoint = "logo_endpoint"
// FieldLogoMimeType holds the string denoting the logomimetype field in the database.
FieldLogoMimeType = "logo_mime_type"
// FieldBannerEndpoint holds the string denoting the bannerendpoint field in the database.
FieldBannerEndpoint = "banner_endpoint"
// FieldBannerMimeType holds the string denoting the bannermimetype field in the database.
FieldBannerMimeType = "banner_mime_type"
// FieldSupportedVersions holds the string denoting the supportedversions field in the database.
FieldSupportedVersions = "supported_versions"
// FieldSupportedExtensions holds the string denoting the supportedextensions field in the database.
FieldSupportedExtensions = "supported_extensions"
// EdgeUsers holds the string denoting the users edge name in mutations.
EdgeUsers = "users"
// EdgeModerators holds the string denoting the moderators edge name in mutations.
EdgeModerators = "moderators"
// EdgeAdmins holds the string denoting the admins edge name in mutations.
EdgeAdmins = "admins"
// Table holds the table name of the instancemetadata in the database.
Table = "instance_metadata"
// UsersTable is the table that holds the users relation/edge. The primary key declared below.
UsersTable = "instance_metadata_users"
// UsersInverseTable is the table name for the User entity.
// It exists in this package in order to avoid circular dependency with the "user" package.
UsersInverseTable = "users"
// ModeratorsTable is the table that holds the moderators relation/edge. The primary key declared below.
ModeratorsTable = "instance_metadata_moderators"
// ModeratorsInverseTable is the table name for the User entity.
// It exists in this package in order to avoid circular dependency with the "user" package.
ModeratorsInverseTable = "users"
// AdminsTable is the table that holds the admins relation/edge. The primary key declared below.
AdminsTable = "instance_metadata_admins"
// AdminsInverseTable is the table name for the User entity.
// It exists in this package in order to avoid circular dependency with the "user" package.
AdminsInverseTable = "users"
)
// Columns holds all SQL columns for instancemetadata fields.
var Columns = []string{
FieldID,
FieldIsRemote,
FieldURI,
FieldExtensions,
FieldCreatedAt,
FieldUpdatedAt,
FieldName,
FieldDescription,
FieldHost,
FieldPublicKey,
FieldPublicKeyAlgorithm,
FieldPrivateKey,
FieldSoftwareName,
FieldSoftwareVersion,
FieldSharedInboxURI,
FieldModeratorsURI,
FieldAdminsURI,
FieldLogoEndpoint,
FieldLogoMimeType,
FieldBannerEndpoint,
FieldBannerMimeType,
FieldSupportedVersions,
FieldSupportedExtensions,
}
var (
// UsersPrimaryKey and UsersColumn2 are the table columns denoting the
// primary key for the users relation (M2M).
UsersPrimaryKey = []string{"instance_metadata_id", "user_id"}
// ModeratorsPrimaryKey and ModeratorsColumn2 are the table columns denoting the
// primary key for the moderators relation (M2M).
ModeratorsPrimaryKey = []string{"instance_metadata_id", "user_id"}
// AdminsPrimaryKey and AdminsColumn2 are the table columns denoting the
// primary key for the admins relation (M2M).
AdminsPrimaryKey = []string{"instance_metadata_id", "user_id"}
)
// 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 (
// 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.
2024-08-22 23:03:38 +02:00
DefaultExtensions versia.Extensions
2024-08-20 22:43:26 +02:00
// 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
// HostValidator is a validator for the "host" field. It is called by the builders before save.
HostValidator func(string) error
// SoftwareNameValidator is a validator for the "softwareName" field. It is called by the builders before save.
SoftwareNameValidator func(string) error
// SoftwareVersionValidator is a validator for the "softwareVersion" field. It is called by the builders before save.
SoftwareVersionValidator func(string) error
// SharedInboxURIValidator is a validator for the "sharedInboxURI" field. It is called by the builders before save.
SharedInboxURIValidator func(string) error
// ModeratorsURIValidator is a validator for the "moderatorsURI" field. It is called by the builders before save.
ModeratorsURIValidator func(string) error
// AdminsURIValidator is a validator for the "adminsURI" field. It is called by the builders before save.
AdminsURIValidator func(string) error
// LogoEndpointValidator is a validator for the "logoEndpoint" field. It is called by the builders before save.
LogoEndpointValidator func(string) error
// LogoMimeTypeValidator is a validator for the "logoMimeType" field. It is called by the builders before save.
LogoMimeTypeValidator func(string) error
// BannerEndpointValidator is a validator for the "bannerEndpoint" field. It is called by the builders before save.
BannerEndpointValidator func(string) error
// BannerMimeTypeValidator is a validator for the "bannerMimeType" field. It is called by the builders before save.
BannerMimeTypeValidator func(string) error
// DefaultSupportedVersions holds the default value on creation for the "supportedVersions" field.
DefaultSupportedVersions []string
// 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 InstanceMetadata 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()
}
// ByHost orders the results by the host field.
func ByHost(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldHost, opts...).ToFunc()
}
// ByPublicKeyAlgorithm orders the results by the publicKeyAlgorithm field.
func ByPublicKeyAlgorithm(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldPublicKeyAlgorithm, opts...).ToFunc()
}
// BySoftwareName orders the results by the softwareName field.
func BySoftwareName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldSoftwareName, opts...).ToFunc()
}
// BySoftwareVersion orders the results by the softwareVersion field.
func BySoftwareVersion(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldSoftwareVersion, opts...).ToFunc()
}
// BySharedInboxURI orders the results by the sharedInboxURI field.
func BySharedInboxURI(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldSharedInboxURI, opts...).ToFunc()
}
// ByModeratorsURI orders the results by the moderatorsURI field.
func ByModeratorsURI(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldModeratorsURI, opts...).ToFunc()
}
// ByAdminsURI orders the results by the adminsURI field.
func ByAdminsURI(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldAdminsURI, opts...).ToFunc()
}
// ByLogoEndpoint orders the results by the logoEndpoint field.
func ByLogoEndpoint(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldLogoEndpoint, opts...).ToFunc()
}
// ByLogoMimeType orders the results by the logoMimeType field.
func ByLogoMimeType(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldLogoMimeType, opts...).ToFunc()
}
// ByBannerEndpoint orders the results by the bannerEndpoint field.
func ByBannerEndpoint(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldBannerEndpoint, opts...).ToFunc()
}
// ByBannerMimeType orders the results by the bannerMimeType field.
func ByBannerMimeType(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldBannerMimeType, opts...).ToFunc()
}
// ByUsersCount orders the results by users count.
func ByUsersCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newUsersStep(), opts...)
}
}
// ByUsers orders the results by users terms.
func ByUsers(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newUsersStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByModeratorsCount orders the results by moderators count.
func ByModeratorsCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newModeratorsStep(), opts...)
}
}
// ByModerators orders the results by moderators terms.
func ByModerators(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newModeratorsStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByAdminsCount orders the results by admins count.
func ByAdminsCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newAdminsStep(), opts...)
}
}
// ByAdmins orders the results by admins terms.
func ByAdmins(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newAdminsStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
func newUsersStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(UsersInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2M, false, UsersTable, UsersPrimaryKey...),
)
}
func newModeratorsStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(ModeratorsInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2M, false, ModeratorsTable, ModeratorsPrimaryKey...),
)
}
func newAdminsStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(AdminsInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2M, false, AdminsTable, AdminsPrimaryKey...),
)
}