Первый прототип с основными возможностями
This commit is contained in:
98
ent/link/link.go
Normal file
98
ent/link/link.go
Normal file
@@ -0,0 +1,98 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package link
|
||||
|
||||
import (
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the link type in the database.
|
||||
Label = "link"
|
||||
// FieldID holds the string denoting the id field in the database.
|
||||
FieldID = "id"
|
||||
// FieldKey holds the string denoting the key field in the database.
|
||||
FieldKey = "key"
|
||||
// FieldOriginalURL holds the string denoting the original_url field in the database.
|
||||
FieldOriginalURL = "original_url"
|
||||
// EdgeOwner holds the string denoting the owner edge name in mutations.
|
||||
EdgeOwner = "owner"
|
||||
// Table holds the table name of the link in the database.
|
||||
Table = "links"
|
||||
// OwnerTable is the table that holds the owner relation/edge. The primary key declared below.
|
||||
OwnerTable = "user_links"
|
||||
// OwnerInverseTable is the table name for the User entity.
|
||||
// It exists in this package in order to avoid circular dependency with the "user" package.
|
||||
OwnerInverseTable = "users"
|
||||
)
|
||||
|
||||
// Columns holds all SQL columns for link fields.
|
||||
var Columns = []string{
|
||||
FieldID,
|
||||
FieldKey,
|
||||
FieldOriginalURL,
|
||||
}
|
||||
|
||||
var (
|
||||
// OwnerPrimaryKey and OwnerColumn2 are the table columns denoting the
|
||||
// primary key for the owner relation (M2M).
|
||||
OwnerPrimaryKey = []string{"user_id", "link_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 (
|
||||
// OriginalURLValidator is a validator for the "original_url" field. It is called by the builders before save.
|
||||
OriginalURLValidator func(string) error
|
||||
// DefaultID holds the default value on creation for the "id" field.
|
||||
DefaultID func() uuid.UUID
|
||||
)
|
||||
|
||||
// OrderOption defines the ordering options for the Link 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()
|
||||
}
|
||||
|
||||
// ByKey orders the results by the key field.
|
||||
func ByKey(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldKey, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByOriginalURL orders the results by the original_url field.
|
||||
func ByOriginalURL(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldOriginalURL, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByOwnerCount orders the results by owner count.
|
||||
func ByOwnerCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newOwnerStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByOwner orders the results by owner terms.
|
||||
func ByOwner(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newOwnerStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
func newOwnerStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(OwnerInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2M, true, OwnerTable, OwnerPrimaryKey...),
|
||||
)
|
||||
}
|
||||
233
ent/link/where.go
Normal file
233
ent/link/where.go
Normal file
@@ -0,0 +1,233 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package link
|
||||
|
||||
import (
|
||||
"code.gurenya.net/carlsmei/muninn-aio/ent/predicate"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// ID filters vertices based on their ID field.
|
||||
func ID(id uuid.UUID) predicate.Link {
|
||||
return predicate.Link(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDEQ applies the EQ predicate on the ID field.
|
||||
func IDEQ(id uuid.UUID) predicate.Link {
|
||||
return predicate.Link(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDNEQ applies the NEQ predicate on the ID field.
|
||||
func IDNEQ(id uuid.UUID) predicate.Link {
|
||||
return predicate.Link(sql.FieldNEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...uuid.UUID) predicate.Link {
|
||||
return predicate.Link(sql.FieldIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...uuid.UUID) predicate.Link {
|
||||
return predicate.Link(sql.FieldNotIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDGT applies the GT predicate on the ID field.
|
||||
func IDGT(id uuid.UUID) predicate.Link {
|
||||
return predicate.Link(sql.FieldGT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDGTE applies the GTE predicate on the ID field.
|
||||
func IDGTE(id uuid.UUID) predicate.Link {
|
||||
return predicate.Link(sql.FieldGTE(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLT applies the LT predicate on the ID field.
|
||||
func IDLT(id uuid.UUID) predicate.Link {
|
||||
return predicate.Link(sql.FieldLT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLTE applies the LTE predicate on the ID field.
|
||||
func IDLTE(id uuid.UUID) predicate.Link {
|
||||
return predicate.Link(sql.FieldLTE(FieldID, id))
|
||||
}
|
||||
|
||||
// Key applies equality check predicate on the "key" field. It's identical to KeyEQ.
|
||||
func Key(v string) predicate.Link {
|
||||
return predicate.Link(sql.FieldEQ(FieldKey, v))
|
||||
}
|
||||
|
||||
// OriginalURL applies equality check predicate on the "original_url" field. It's identical to OriginalURLEQ.
|
||||
func OriginalURL(v string) predicate.Link {
|
||||
return predicate.Link(sql.FieldEQ(FieldOriginalURL, v))
|
||||
}
|
||||
|
||||
// KeyEQ applies the EQ predicate on the "key" field.
|
||||
func KeyEQ(v string) predicate.Link {
|
||||
return predicate.Link(sql.FieldEQ(FieldKey, v))
|
||||
}
|
||||
|
||||
// KeyNEQ applies the NEQ predicate on the "key" field.
|
||||
func KeyNEQ(v string) predicate.Link {
|
||||
return predicate.Link(sql.FieldNEQ(FieldKey, v))
|
||||
}
|
||||
|
||||
// KeyIn applies the In predicate on the "key" field.
|
||||
func KeyIn(vs ...string) predicate.Link {
|
||||
return predicate.Link(sql.FieldIn(FieldKey, vs...))
|
||||
}
|
||||
|
||||
// KeyNotIn applies the NotIn predicate on the "key" field.
|
||||
func KeyNotIn(vs ...string) predicate.Link {
|
||||
return predicate.Link(sql.FieldNotIn(FieldKey, vs...))
|
||||
}
|
||||
|
||||
// KeyGT applies the GT predicate on the "key" field.
|
||||
func KeyGT(v string) predicate.Link {
|
||||
return predicate.Link(sql.FieldGT(FieldKey, v))
|
||||
}
|
||||
|
||||
// KeyGTE applies the GTE predicate on the "key" field.
|
||||
func KeyGTE(v string) predicate.Link {
|
||||
return predicate.Link(sql.FieldGTE(FieldKey, v))
|
||||
}
|
||||
|
||||
// KeyLT applies the LT predicate on the "key" field.
|
||||
func KeyLT(v string) predicate.Link {
|
||||
return predicate.Link(sql.FieldLT(FieldKey, v))
|
||||
}
|
||||
|
||||
// KeyLTE applies the LTE predicate on the "key" field.
|
||||
func KeyLTE(v string) predicate.Link {
|
||||
return predicate.Link(sql.FieldLTE(FieldKey, v))
|
||||
}
|
||||
|
||||
// KeyContains applies the Contains predicate on the "key" field.
|
||||
func KeyContains(v string) predicate.Link {
|
||||
return predicate.Link(sql.FieldContains(FieldKey, v))
|
||||
}
|
||||
|
||||
// KeyHasPrefix applies the HasPrefix predicate on the "key" field.
|
||||
func KeyHasPrefix(v string) predicate.Link {
|
||||
return predicate.Link(sql.FieldHasPrefix(FieldKey, v))
|
||||
}
|
||||
|
||||
// KeyHasSuffix applies the HasSuffix predicate on the "key" field.
|
||||
func KeyHasSuffix(v string) predicate.Link {
|
||||
return predicate.Link(sql.FieldHasSuffix(FieldKey, v))
|
||||
}
|
||||
|
||||
// KeyEqualFold applies the EqualFold predicate on the "key" field.
|
||||
func KeyEqualFold(v string) predicate.Link {
|
||||
return predicate.Link(sql.FieldEqualFold(FieldKey, v))
|
||||
}
|
||||
|
||||
// KeyContainsFold applies the ContainsFold predicate on the "key" field.
|
||||
func KeyContainsFold(v string) predicate.Link {
|
||||
return predicate.Link(sql.FieldContainsFold(FieldKey, v))
|
||||
}
|
||||
|
||||
// OriginalURLEQ applies the EQ predicate on the "original_url" field.
|
||||
func OriginalURLEQ(v string) predicate.Link {
|
||||
return predicate.Link(sql.FieldEQ(FieldOriginalURL, v))
|
||||
}
|
||||
|
||||
// OriginalURLNEQ applies the NEQ predicate on the "original_url" field.
|
||||
func OriginalURLNEQ(v string) predicate.Link {
|
||||
return predicate.Link(sql.FieldNEQ(FieldOriginalURL, v))
|
||||
}
|
||||
|
||||
// OriginalURLIn applies the In predicate on the "original_url" field.
|
||||
func OriginalURLIn(vs ...string) predicate.Link {
|
||||
return predicate.Link(sql.FieldIn(FieldOriginalURL, vs...))
|
||||
}
|
||||
|
||||
// OriginalURLNotIn applies the NotIn predicate on the "original_url" field.
|
||||
func OriginalURLNotIn(vs ...string) predicate.Link {
|
||||
return predicate.Link(sql.FieldNotIn(FieldOriginalURL, vs...))
|
||||
}
|
||||
|
||||
// OriginalURLGT applies the GT predicate on the "original_url" field.
|
||||
func OriginalURLGT(v string) predicate.Link {
|
||||
return predicate.Link(sql.FieldGT(FieldOriginalURL, v))
|
||||
}
|
||||
|
||||
// OriginalURLGTE applies the GTE predicate on the "original_url" field.
|
||||
func OriginalURLGTE(v string) predicate.Link {
|
||||
return predicate.Link(sql.FieldGTE(FieldOriginalURL, v))
|
||||
}
|
||||
|
||||
// OriginalURLLT applies the LT predicate on the "original_url" field.
|
||||
func OriginalURLLT(v string) predicate.Link {
|
||||
return predicate.Link(sql.FieldLT(FieldOriginalURL, v))
|
||||
}
|
||||
|
||||
// OriginalURLLTE applies the LTE predicate on the "original_url" field.
|
||||
func OriginalURLLTE(v string) predicate.Link {
|
||||
return predicate.Link(sql.FieldLTE(FieldOriginalURL, v))
|
||||
}
|
||||
|
||||
// OriginalURLContains applies the Contains predicate on the "original_url" field.
|
||||
func OriginalURLContains(v string) predicate.Link {
|
||||
return predicate.Link(sql.FieldContains(FieldOriginalURL, v))
|
||||
}
|
||||
|
||||
// OriginalURLHasPrefix applies the HasPrefix predicate on the "original_url" field.
|
||||
func OriginalURLHasPrefix(v string) predicate.Link {
|
||||
return predicate.Link(sql.FieldHasPrefix(FieldOriginalURL, v))
|
||||
}
|
||||
|
||||
// OriginalURLHasSuffix applies the HasSuffix predicate on the "original_url" field.
|
||||
func OriginalURLHasSuffix(v string) predicate.Link {
|
||||
return predicate.Link(sql.FieldHasSuffix(FieldOriginalURL, v))
|
||||
}
|
||||
|
||||
// OriginalURLEqualFold applies the EqualFold predicate on the "original_url" field.
|
||||
func OriginalURLEqualFold(v string) predicate.Link {
|
||||
return predicate.Link(sql.FieldEqualFold(FieldOriginalURL, v))
|
||||
}
|
||||
|
||||
// OriginalURLContainsFold applies the ContainsFold predicate on the "original_url" field.
|
||||
func OriginalURLContainsFold(v string) predicate.Link {
|
||||
return predicate.Link(sql.FieldContainsFold(FieldOriginalURL, v))
|
||||
}
|
||||
|
||||
// HasOwner applies the HasEdge predicate on the "owner" edge.
|
||||
func HasOwner() predicate.Link {
|
||||
return predicate.Link(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2M, true, OwnerTable, OwnerPrimaryKey...),
|
||||
)
|
||||
sqlgraph.HasNeighbors(s, step)
|
||||
})
|
||||
}
|
||||
|
||||
// HasOwnerWith applies the HasEdge predicate on the "owner" edge with a given conditions (other predicates).
|
||||
func HasOwnerWith(preds ...predicate.User) predicate.Link {
|
||||
return predicate.Link(func(s *sql.Selector) {
|
||||
step := newOwnerStep()
|
||||
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.Link) predicate.Link {
|
||||
return predicate.Link(sql.AndPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Or groups predicates with the OR operator between them.
|
||||
func Or(predicates ...predicate.Link) predicate.Link {
|
||||
return predicate.Link(sql.OrPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Not applies the not operator on the given predicate.
|
||||
func Not(p predicate.Link) predicate.Link {
|
||||
return predicate.Link(sql.NotPredicates(p))
|
||||
}
|
||||
Reference in New Issue
Block a user