chore: init

This commit is contained in:
DevMiner 2024-08-11 03:51:22 +02:00
commit 320715f3e7
174 changed files with 42083 additions and 0 deletions

187
ent/follow/follow.go Normal file
View file

@ -0,0 +1,187 @@
// 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),
)
}

313
ent/follow/where.go Normal file
View file

@ -0,0 +1,313 @@
// Code generated by ent, DO NOT EDIT.
package follow
import (
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"github.com/google/uuid"
"github.com/lysand-org/versia-go/ent/predicate"
)
// ID filters vertices based on their ID field.
func ID(id uuid.UUID) predicate.Follow {
return predicate.Follow(sql.FieldEQ(FieldID, id))
}
// IDEQ applies the EQ predicate on the ID field.
func IDEQ(id uuid.UUID) predicate.Follow {
return predicate.Follow(sql.FieldEQ(FieldID, id))
}
// IDNEQ applies the NEQ predicate on the ID field.
func IDNEQ(id uuid.UUID) predicate.Follow {
return predicate.Follow(sql.FieldNEQ(FieldID, id))
}
// IDIn applies the In predicate on the ID field.
func IDIn(ids ...uuid.UUID) predicate.Follow {
return predicate.Follow(sql.FieldIn(FieldID, ids...))
}
// IDNotIn applies the NotIn predicate on the ID field.
func IDNotIn(ids ...uuid.UUID) predicate.Follow {
return predicate.Follow(sql.FieldNotIn(FieldID, ids...))
}
// IDGT applies the GT predicate on the ID field.
func IDGT(id uuid.UUID) predicate.Follow {
return predicate.Follow(sql.FieldGT(FieldID, id))
}
// IDGTE applies the GTE predicate on the ID field.
func IDGTE(id uuid.UUID) predicate.Follow {
return predicate.Follow(sql.FieldGTE(FieldID, id))
}
// IDLT applies the LT predicate on the ID field.
func IDLT(id uuid.UUID) predicate.Follow {
return predicate.Follow(sql.FieldLT(FieldID, id))
}
// IDLTE applies the LTE predicate on the ID field.
func IDLTE(id uuid.UUID) predicate.Follow {
return predicate.Follow(sql.FieldLTE(FieldID, id))
}
// IsRemote applies equality check predicate on the "isRemote" field. It's identical to IsRemoteEQ.
func IsRemote(v bool) predicate.Follow {
return predicate.Follow(sql.FieldEQ(FieldIsRemote, v))
}
// URI applies equality check predicate on the "uri" field. It's identical to URIEQ.
func URI(v string) predicate.Follow {
return predicate.Follow(sql.FieldEQ(FieldURI, v))
}
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
func CreatedAt(v time.Time) predicate.Follow {
return predicate.Follow(sql.FieldEQ(FieldCreatedAt, v))
}
// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.
func UpdatedAt(v time.Time) predicate.Follow {
return predicate.Follow(sql.FieldEQ(FieldUpdatedAt, v))
}
// IsRemoteEQ applies the EQ predicate on the "isRemote" field.
func IsRemoteEQ(v bool) predicate.Follow {
return predicate.Follow(sql.FieldEQ(FieldIsRemote, v))
}
// IsRemoteNEQ applies the NEQ predicate on the "isRemote" field.
func IsRemoteNEQ(v bool) predicate.Follow {
return predicate.Follow(sql.FieldNEQ(FieldIsRemote, v))
}
// URIEQ applies the EQ predicate on the "uri" field.
func URIEQ(v string) predicate.Follow {
return predicate.Follow(sql.FieldEQ(FieldURI, v))
}
// URINEQ applies the NEQ predicate on the "uri" field.
func URINEQ(v string) predicate.Follow {
return predicate.Follow(sql.FieldNEQ(FieldURI, v))
}
// URIIn applies the In predicate on the "uri" field.
func URIIn(vs ...string) predicate.Follow {
return predicate.Follow(sql.FieldIn(FieldURI, vs...))
}
// URINotIn applies the NotIn predicate on the "uri" field.
func URINotIn(vs ...string) predicate.Follow {
return predicate.Follow(sql.FieldNotIn(FieldURI, vs...))
}
// URIGT applies the GT predicate on the "uri" field.
func URIGT(v string) predicate.Follow {
return predicate.Follow(sql.FieldGT(FieldURI, v))
}
// URIGTE applies the GTE predicate on the "uri" field.
func URIGTE(v string) predicate.Follow {
return predicate.Follow(sql.FieldGTE(FieldURI, v))
}
// URILT applies the LT predicate on the "uri" field.
func URILT(v string) predicate.Follow {
return predicate.Follow(sql.FieldLT(FieldURI, v))
}
// URILTE applies the LTE predicate on the "uri" field.
func URILTE(v string) predicate.Follow {
return predicate.Follow(sql.FieldLTE(FieldURI, v))
}
// URIContains applies the Contains predicate on the "uri" field.
func URIContains(v string) predicate.Follow {
return predicate.Follow(sql.FieldContains(FieldURI, v))
}
// URIHasPrefix applies the HasPrefix predicate on the "uri" field.
func URIHasPrefix(v string) predicate.Follow {
return predicate.Follow(sql.FieldHasPrefix(FieldURI, v))
}
// URIHasSuffix applies the HasSuffix predicate on the "uri" field.
func URIHasSuffix(v string) predicate.Follow {
return predicate.Follow(sql.FieldHasSuffix(FieldURI, v))
}
// URIEqualFold applies the EqualFold predicate on the "uri" field.
func URIEqualFold(v string) predicate.Follow {
return predicate.Follow(sql.FieldEqualFold(FieldURI, v))
}
// URIContainsFold applies the ContainsFold predicate on the "uri" field.
func URIContainsFold(v string) predicate.Follow {
return predicate.Follow(sql.FieldContainsFold(FieldURI, v))
}
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
func CreatedAtEQ(v time.Time) predicate.Follow {
return predicate.Follow(sql.FieldEQ(FieldCreatedAt, v))
}
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
func CreatedAtNEQ(v time.Time) predicate.Follow {
return predicate.Follow(sql.FieldNEQ(FieldCreatedAt, v))
}
// CreatedAtIn applies the In predicate on the "created_at" field.
func CreatedAtIn(vs ...time.Time) predicate.Follow {
return predicate.Follow(sql.FieldIn(FieldCreatedAt, vs...))
}
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
func CreatedAtNotIn(vs ...time.Time) predicate.Follow {
return predicate.Follow(sql.FieldNotIn(FieldCreatedAt, vs...))
}
// CreatedAtGT applies the GT predicate on the "created_at" field.
func CreatedAtGT(v time.Time) predicate.Follow {
return predicate.Follow(sql.FieldGT(FieldCreatedAt, v))
}
// CreatedAtGTE applies the GTE predicate on the "created_at" field.
func CreatedAtGTE(v time.Time) predicate.Follow {
return predicate.Follow(sql.FieldGTE(FieldCreatedAt, v))
}
// CreatedAtLT applies the LT predicate on the "created_at" field.
func CreatedAtLT(v time.Time) predicate.Follow {
return predicate.Follow(sql.FieldLT(FieldCreatedAt, v))
}
// CreatedAtLTE applies the LTE predicate on the "created_at" field.
func CreatedAtLTE(v time.Time) predicate.Follow {
return predicate.Follow(sql.FieldLTE(FieldCreatedAt, v))
}
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
func UpdatedAtEQ(v time.Time) predicate.Follow {
return predicate.Follow(sql.FieldEQ(FieldUpdatedAt, v))
}
// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
func UpdatedAtNEQ(v time.Time) predicate.Follow {
return predicate.Follow(sql.FieldNEQ(FieldUpdatedAt, v))
}
// UpdatedAtIn applies the In predicate on the "updated_at" field.
func UpdatedAtIn(vs ...time.Time) predicate.Follow {
return predicate.Follow(sql.FieldIn(FieldUpdatedAt, vs...))
}
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
func UpdatedAtNotIn(vs ...time.Time) predicate.Follow {
return predicate.Follow(sql.FieldNotIn(FieldUpdatedAt, vs...))
}
// UpdatedAtGT applies the GT predicate on the "updated_at" field.
func UpdatedAtGT(v time.Time) predicate.Follow {
return predicate.Follow(sql.FieldGT(FieldUpdatedAt, v))
}
// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
func UpdatedAtGTE(v time.Time) predicate.Follow {
return predicate.Follow(sql.FieldGTE(FieldUpdatedAt, v))
}
// UpdatedAtLT applies the LT predicate on the "updated_at" field.
func UpdatedAtLT(v time.Time) predicate.Follow {
return predicate.Follow(sql.FieldLT(FieldUpdatedAt, v))
}
// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
func UpdatedAtLTE(v time.Time) predicate.Follow {
return predicate.Follow(sql.FieldLTE(FieldUpdatedAt, v))
}
// StatusEQ applies the EQ predicate on the "status" field.
func StatusEQ(v Status) predicate.Follow {
return predicate.Follow(sql.FieldEQ(FieldStatus, v))
}
// StatusNEQ applies the NEQ predicate on the "status" field.
func StatusNEQ(v Status) predicate.Follow {
return predicate.Follow(sql.FieldNEQ(FieldStatus, v))
}
// StatusIn applies the In predicate on the "status" field.
func StatusIn(vs ...Status) predicate.Follow {
return predicate.Follow(sql.FieldIn(FieldStatus, vs...))
}
// StatusNotIn applies the NotIn predicate on the "status" field.
func StatusNotIn(vs ...Status) predicate.Follow {
return predicate.Follow(sql.FieldNotIn(FieldStatus, vs...))
}
// HasFollower applies the HasEdge predicate on the "follower" edge.
func HasFollower() predicate.Follow {
return predicate.Follow(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.Edge(sqlgraph.M2O, false, FollowerTable, FollowerColumn),
)
sqlgraph.HasNeighbors(s, step)
})
}
// HasFollowerWith applies the HasEdge predicate on the "follower" edge with a given conditions (other predicates).
func HasFollowerWith(preds ...predicate.User) predicate.Follow {
return predicate.Follow(func(s *sql.Selector) {
step := newFollowerStep()
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})
})
}
// HasFollowee applies the HasEdge predicate on the "followee" edge.
func HasFollowee() predicate.Follow {
return predicate.Follow(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.Edge(sqlgraph.M2O, false, FolloweeTable, FolloweeColumn),
)
sqlgraph.HasNeighbors(s, step)
})
}
// HasFolloweeWith applies the HasEdge predicate on the "followee" edge with a given conditions (other predicates).
func HasFolloweeWith(preds ...predicate.User) predicate.Follow {
return predicate.Follow(func(s *sql.Selector) {
step := newFolloweeStep()
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})
})
}
// And groups predicates with the AND operator between them.
func And(predicates ...predicate.Follow) predicate.Follow {
return predicate.Follow(sql.AndPredicates(predicates...))
}
// Or groups predicates with the OR operator between them.
func Or(predicates ...predicate.Follow) predicate.Follow {
return predicate.Follow(sql.OrPredicates(predicates...))
}
// Not applies the not operator on the given predicate.
func Not(p predicate.Follow) predicate.Follow {
return predicate.Follow(sql.NotPredicates(p))
}