Первый прототип с основными возможностями
This commit is contained in:
88
ent/user/user.go
Normal file
88
ent/user/user.go
Normal file
@@ -0,0 +1,88 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package user
|
||||
|
||||
import (
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the user type in the database.
|
||||
Label = "user"
|
||||
// FieldID holds the string denoting the id field in the database.
|
||||
FieldID = "id"
|
||||
// FieldTelegramID holds the string denoting the telegram_id field in the database.
|
||||
FieldTelegramID = "telegram_id"
|
||||
// EdgeLinks holds the string denoting the links edge name in mutations.
|
||||
EdgeLinks = "links"
|
||||
// Table holds the table name of the user in the database.
|
||||
Table = "users"
|
||||
// LinksTable is the table that holds the links relation/edge. The primary key declared below.
|
||||
LinksTable = "user_links"
|
||||
// LinksInverseTable is the table name for the Link entity.
|
||||
// It exists in this package in order to avoid circular dependency with the "link" package.
|
||||
LinksInverseTable = "links"
|
||||
)
|
||||
|
||||
// Columns holds all SQL columns for user fields.
|
||||
var Columns = []string{
|
||||
FieldID,
|
||||
FieldTelegramID,
|
||||
}
|
||||
|
||||
var (
|
||||
// LinksPrimaryKey and LinksColumn2 are the table columns denoting the
|
||||
// primary key for the links relation (M2M).
|
||||
LinksPrimaryKey = []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 (
|
||||
// DefaultID holds the default value on creation for the "id" field.
|
||||
DefaultID func() uuid.UUID
|
||||
)
|
||||
|
||||
// OrderOption defines the ordering options for the User 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()
|
||||
}
|
||||
|
||||
// ByTelegramID orders the results by the telegram_id field.
|
||||
func ByTelegramID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldTelegramID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByLinksCount orders the results by links count.
|
||||
func ByLinksCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newLinksStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByLinks orders the results by links terms.
|
||||
func ByLinks(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newLinksStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
func newLinksStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(LinksInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2M, false, LinksTable, LinksPrimaryKey...),
|
||||
)
|
||||
}
|
||||
138
ent/user/where.go
Normal file
138
ent/user/where.go
Normal file
@@ -0,0 +1,138 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package user
|
||||
|
||||
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.User {
|
||||
return predicate.User(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDEQ applies the EQ predicate on the ID field.
|
||||
func IDEQ(id uuid.UUID) predicate.User {
|
||||
return predicate.User(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDNEQ applies the NEQ predicate on the ID field.
|
||||
func IDNEQ(id uuid.UUID) predicate.User {
|
||||
return predicate.User(sql.FieldNEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...uuid.UUID) predicate.User {
|
||||
return predicate.User(sql.FieldIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...uuid.UUID) predicate.User {
|
||||
return predicate.User(sql.FieldNotIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDGT applies the GT predicate on the ID field.
|
||||
func IDGT(id uuid.UUID) predicate.User {
|
||||
return predicate.User(sql.FieldGT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDGTE applies the GTE predicate on the ID field.
|
||||
func IDGTE(id uuid.UUID) predicate.User {
|
||||
return predicate.User(sql.FieldGTE(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLT applies the LT predicate on the ID field.
|
||||
func IDLT(id uuid.UUID) predicate.User {
|
||||
return predicate.User(sql.FieldLT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLTE applies the LTE predicate on the ID field.
|
||||
func IDLTE(id uuid.UUID) predicate.User {
|
||||
return predicate.User(sql.FieldLTE(FieldID, id))
|
||||
}
|
||||
|
||||
// TelegramID applies equality check predicate on the "telegram_id" field. It's identical to TelegramIDEQ.
|
||||
func TelegramID(v int64) predicate.User {
|
||||
return predicate.User(sql.FieldEQ(FieldTelegramID, v))
|
||||
}
|
||||
|
||||
// TelegramIDEQ applies the EQ predicate on the "telegram_id" field.
|
||||
func TelegramIDEQ(v int64) predicate.User {
|
||||
return predicate.User(sql.FieldEQ(FieldTelegramID, v))
|
||||
}
|
||||
|
||||
// TelegramIDNEQ applies the NEQ predicate on the "telegram_id" field.
|
||||
func TelegramIDNEQ(v int64) predicate.User {
|
||||
return predicate.User(sql.FieldNEQ(FieldTelegramID, v))
|
||||
}
|
||||
|
||||
// TelegramIDIn applies the In predicate on the "telegram_id" field.
|
||||
func TelegramIDIn(vs ...int64) predicate.User {
|
||||
return predicate.User(sql.FieldIn(FieldTelegramID, vs...))
|
||||
}
|
||||
|
||||
// TelegramIDNotIn applies the NotIn predicate on the "telegram_id" field.
|
||||
func TelegramIDNotIn(vs ...int64) predicate.User {
|
||||
return predicate.User(sql.FieldNotIn(FieldTelegramID, vs...))
|
||||
}
|
||||
|
||||
// TelegramIDGT applies the GT predicate on the "telegram_id" field.
|
||||
func TelegramIDGT(v int64) predicate.User {
|
||||
return predicate.User(sql.FieldGT(FieldTelegramID, v))
|
||||
}
|
||||
|
||||
// TelegramIDGTE applies the GTE predicate on the "telegram_id" field.
|
||||
func TelegramIDGTE(v int64) predicate.User {
|
||||
return predicate.User(sql.FieldGTE(FieldTelegramID, v))
|
||||
}
|
||||
|
||||
// TelegramIDLT applies the LT predicate on the "telegram_id" field.
|
||||
func TelegramIDLT(v int64) predicate.User {
|
||||
return predicate.User(sql.FieldLT(FieldTelegramID, v))
|
||||
}
|
||||
|
||||
// TelegramIDLTE applies the LTE predicate on the "telegram_id" field.
|
||||
func TelegramIDLTE(v int64) predicate.User {
|
||||
return predicate.User(sql.FieldLTE(FieldTelegramID, v))
|
||||
}
|
||||
|
||||
// HasLinks applies the HasEdge predicate on the "links" edge.
|
||||
func HasLinks() predicate.User {
|
||||
return predicate.User(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2M, false, LinksTable, LinksPrimaryKey...),
|
||||
)
|
||||
sqlgraph.HasNeighbors(s, step)
|
||||
})
|
||||
}
|
||||
|
||||
// HasLinksWith applies the HasEdge predicate on the "links" edge with a given conditions (other predicates).
|
||||
func HasLinksWith(preds ...predicate.Link) predicate.User {
|
||||
return predicate.User(func(s *sql.Selector) {
|
||||
step := newLinksStep()
|
||||
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.User) predicate.User {
|
||||
return predicate.User(sql.AndPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Or groups predicates with the OR operator between them.
|
||||
func Or(predicates ...predicate.User) predicate.User {
|
||||
return predicate.User(sql.OrPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Not applies the not operator on the given predicate.
|
||||
func Not(p predicate.User) predicate.User {
|
||||
return predicate.User(sql.NotPredicates(p))
|
||||
}
|
||||
Reference in New Issue
Block a user