mirror of
https://github.com/versia-pub/versia-go.git
synced 2025-12-06 06:28:18 +01:00
188 lines
6.1 KiB
Go
188 lines
6.1 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package follow
|
|
|
|
import (
|
|
"fmt"
|
|
"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 follow type in the database.
|
|
Label = "follow"
|
|
// 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"
|
|
// FieldStatus holds the string denoting the status field in the database.
|
|
FieldStatus = "status"
|
|
// 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 follow in the database.
|
|
Table = "follows"
|
|
// FollowerTable is the table that holds the follower relation/edge.
|
|
FollowerTable = "follows"
|
|
// 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 = "follow_follower"
|
|
// FolloweeTable is the table that holds the followee relation/edge.
|
|
FolloweeTable = "follows"
|
|
// 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 = "follow_followee"
|
|
)
|
|
|
|
// Columns holds all SQL columns for follow fields.
|
|
var Columns = []string{
|
|
FieldID,
|
|
FieldIsRemote,
|
|
FieldURI,
|
|
FieldExtensions,
|
|
FieldCreatedAt,
|
|
FieldUpdatedAt,
|
|
FieldStatus,
|
|
}
|
|
|
|
// ForeignKeys holds the SQL foreign-keys that are owned by the "follows"
|
|
// table and are not defined as standalone fields in the schema.
|
|
var ForeignKeys = []string{
|
|
"follow_follower",
|
|
"follow_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
|
|
// DefaultID holds the default value on creation for the "id" field.
|
|
DefaultID func() uuid.UUID
|
|
)
|
|
|
|
// Status defines the type for the "status" enum field.
|
|
type Status string
|
|
|
|
// StatusPending is the default value of the Status enum.
|
|
const DefaultStatus = StatusPending
|
|
|
|
// Status values.
|
|
const (
|
|
StatusPending Status = "pending"
|
|
StatusAccepted Status = "accepted"
|
|
)
|
|
|
|
func (s Status) String() string {
|
|
return string(s)
|
|
}
|
|
|
|
// StatusValidator is a validator for the "status" field enum values. It is called by the builders before save.
|
|
func StatusValidator(s Status) error {
|
|
switch s {
|
|
case StatusPending, StatusAccepted:
|
|
return nil
|
|
default:
|
|
return fmt.Errorf("follow: invalid enum value for status field: %q", s)
|
|
}
|
|
}
|
|
|
|
// OrderOption defines the ordering options for the Follow 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()
|
|
}
|
|
|
|
// ByStatus orders the results by the status field.
|
|
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldStatus, 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),
|
|
)
|
|
}
|