snapshot of https://github.com/ent/ent.git (master, 2026-09-15; blobs > 131072B omitted)
Some checks failed
Atlas CI Public / lint (push) Failing after 13s
Atlas CI Public / sync (push) Has been skipped

This commit is contained in:
upstream-mirror
2026-09-15 22:12:36 +05:00
commit 4b3ad0b611
2680 changed files with 719472 additions and 0 deletions

View File

@@ -0,0 +1,659 @@
// Copyright 2019-present Facebook Inc. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.
// Code generated by ent, DO NOT EDIT.
package tweet
import (
"context"
"fmt"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/entc/integration/edgeschema/ent/predicate"
"github.com/google/uuid"
)
// Mutation represents an operation that mutates the Tweet nodes in the graph.
type Mutation struct {
op ent.Op
typ string
text *string
clearedFields map[string]struct{}
liked_users map[int]struct{}
removedliked_users map[int]struct{}
clearedliked_users bool
user map[int]struct{}
removeduser map[int]struct{}
cleareduser bool
tags map[int]struct{}
removedtags map[int]struct{}
clearedtags bool
tweet_user map[int]struct{}
removedtweet_user map[int]struct{}
clearedtweet_user bool
tweet_tags map[uuid.UUID]struct{}
removedtweet_tags map[uuid.UUID]struct{}
clearedtweet_tags bool
predicates []predicate.Tweet
}
// NewMutation creates a new Mutation for the Tweet entity.
func NewMutation(op ent.Op) *Mutation {
return &Mutation{
op: op,
typ: "Tweet",
clearedFields: make(map[string]struct{}),
}
}
// Predicates returns the list of predicates set on the mutation.
func (m *Mutation) Predicates() []predicate.Tweet {
return m.predicates
}
// SetText sets the "text" field.
func (m *Mutation) SetText(s string) {
m.text = &s
}
// Text returns the value of the "text" field in the mutation.
func (m *Mutation) Text() (r string, exists bool) {
v := m.text
if v == nil {
return
}
return *v, true
}
// ResetText resets all changes to the "text" field.
func (m *Mutation) ResetText() {
m.text = nil
}
// AddLikedUserIDs adds the "liked_users" edge to the User entity by ids.
func (m *Mutation) AddLikedUserIDs(ids ...int) {
if m.liked_users == nil {
m.liked_users = make(map[int]struct{})
}
for i := range ids {
m.liked_users[ids[i]] = struct{}{}
}
}
// ClearLikedUsers clears the "liked_users" edge to the User entity.
func (m *Mutation) ClearLikedUsers() {
m.clearedliked_users = true
}
// LikedUsersCleared reports if the "liked_users" edge to the User entity was cleared.
func (m *Mutation) LikedUsersCleared() bool {
return m.clearedliked_users
}
// RemoveLikedUserIDs removes the "liked_users" edge to the User entity by IDs.
func (m *Mutation) RemoveLikedUserIDs(ids ...int) {
if m.removedliked_users == nil {
m.removedliked_users = make(map[int]struct{})
}
for i := range ids {
delete(m.liked_users, ids[i])
m.removedliked_users[ids[i]] = struct{}{}
}
}
// RemovedLikedUsers returns the removed IDs of the "liked_users" edge to the User entity.
func (m *Mutation) RemovedLikedUsersIDs() (ids []int) {
for id := range m.removedliked_users {
ids = append(ids, id)
}
return
}
// LikedUsersIDs returns the "liked_users" edge IDs in the mutation.
func (m *Mutation) LikedUsersIDs() (ids []int) {
for id := range m.liked_users {
ids = append(ids, id)
}
return
}
// ResetLikedUsers resets all changes to the "liked_users" edge.
func (m *Mutation) ResetLikedUsers() {
m.liked_users = nil
m.clearedliked_users = false
m.removedliked_users = nil
}
// AddUserIDs adds the "user" edge to the User entity by ids.
func (m *Mutation) AddUserIDs(ids ...int) {
if m.user == nil {
m.user = make(map[int]struct{})
}
for i := range ids {
m.user[ids[i]] = struct{}{}
}
}
// ClearUser clears the "user" edge to the User entity.
func (m *Mutation) ClearUser() {
m.cleareduser = true
}
// UserCleared reports if the "user" edge to the User entity was cleared.
func (m *Mutation) UserCleared() bool {
return m.cleareduser
}
// RemoveUserIDs removes the "user" edge to the User entity by IDs.
func (m *Mutation) RemoveUserIDs(ids ...int) {
if m.removeduser == nil {
m.removeduser = make(map[int]struct{})
}
for i := range ids {
delete(m.user, ids[i])
m.removeduser[ids[i]] = struct{}{}
}
}
// RemovedUser returns the removed IDs of the "user" edge to the User entity.
func (m *Mutation) RemovedUserIDs() (ids []int) {
for id := range m.removeduser {
ids = append(ids, id)
}
return
}
// UserIDs returns the "user" edge IDs in the mutation.
func (m *Mutation) UserIDs() (ids []int) {
for id := range m.user {
ids = append(ids, id)
}
return
}
// ResetUser resets all changes to the "user" edge.
func (m *Mutation) ResetUser() {
m.user = nil
m.cleareduser = false
m.removeduser = nil
}
// AddTagIDs adds the "tags" edge to the Tag entity by ids.
func (m *Mutation) AddTagIDs(ids ...int) {
if m.tags == nil {
m.tags = make(map[int]struct{})
}
for i := range ids {
m.tags[ids[i]] = struct{}{}
}
}
// ClearTags clears the "tags" edge to the Tag entity.
func (m *Mutation) ClearTags() {
m.clearedtags = true
}
// TagsCleared reports if the "tags" edge to the Tag entity was cleared.
func (m *Mutation) TagsCleared() bool {
return m.clearedtags
}
// RemoveTagIDs removes the "tags" edge to the Tag entity by IDs.
func (m *Mutation) RemoveTagIDs(ids ...int) {
if m.removedtags == nil {
m.removedtags = make(map[int]struct{})
}
for i := range ids {
delete(m.tags, ids[i])
m.removedtags[ids[i]] = struct{}{}
}
}
// RemovedTags returns the removed IDs of the "tags" edge to the Tag entity.
func (m *Mutation) RemovedTagsIDs() (ids []int) {
for id := range m.removedtags {
ids = append(ids, id)
}
return
}
// TagsIDs returns the "tags" edge IDs in the mutation.
func (m *Mutation) TagsIDs() (ids []int) {
for id := range m.tags {
ids = append(ids, id)
}
return
}
// ResetTags resets all changes to the "tags" edge.
func (m *Mutation) ResetTags() {
m.tags = nil
m.clearedtags = false
m.removedtags = nil
}
// AddTweetUserIDs adds the "tweet_user" edge to the UserTweet entity by ids.
func (m *Mutation) AddTweetUserIDs(ids ...int) {
if m.tweet_user == nil {
m.tweet_user = make(map[int]struct{})
}
for i := range ids {
m.tweet_user[ids[i]] = struct{}{}
}
}
// ClearTweetUser clears the "tweet_user" edge to the UserTweet entity.
func (m *Mutation) ClearTweetUser() {
m.clearedtweet_user = true
}
// TweetUserCleared reports if the "tweet_user" edge to the UserTweet entity was cleared.
func (m *Mutation) TweetUserCleared() bool {
return m.clearedtweet_user
}
// RemoveTweetUserIDs removes the "tweet_user" edge to the UserTweet entity by IDs.
func (m *Mutation) RemoveTweetUserIDs(ids ...int) {
if m.removedtweet_user == nil {
m.removedtweet_user = make(map[int]struct{})
}
for i := range ids {
delete(m.tweet_user, ids[i])
m.removedtweet_user[ids[i]] = struct{}{}
}
}
// RemovedTweetUser returns the removed IDs of the "tweet_user" edge to the UserTweet entity.
func (m *Mutation) RemovedTweetUserIDs() (ids []int) {
for id := range m.removedtweet_user {
ids = append(ids, id)
}
return
}
// TweetUserIDs returns the "tweet_user" edge IDs in the mutation.
func (m *Mutation) TweetUserIDs() (ids []int) {
for id := range m.tweet_user {
ids = append(ids, id)
}
return
}
// ResetTweetUser resets all changes to the "tweet_user" edge.
func (m *Mutation) ResetTweetUser() {
m.tweet_user = nil
m.clearedtweet_user = false
m.removedtweet_user = nil
}
// AddTweetTagIDs adds the "tweet_tags" edge to the TweetTag entity by ids.
func (m *Mutation) AddTweetTagIDs(ids ...uuid.UUID) {
if m.tweet_tags == nil {
m.tweet_tags = make(map[uuid.UUID]struct{})
}
for i := range ids {
m.tweet_tags[ids[i]] = struct{}{}
}
}
// ClearTweetTags clears the "tweet_tags" edge to the TweetTag entity.
func (m *Mutation) ClearTweetTags() {
m.clearedtweet_tags = true
}
// TweetTagsCleared reports if the "tweet_tags" edge to the TweetTag entity was cleared.
func (m *Mutation) TweetTagsCleared() bool {
return m.clearedtweet_tags
}
// RemoveTweetTagIDs removes the "tweet_tags" edge to the TweetTag entity by IDs.
func (m *Mutation) RemoveTweetTagIDs(ids ...uuid.UUID) {
if m.removedtweet_tags == nil {
m.removedtweet_tags = make(map[uuid.UUID]struct{})
}
for i := range ids {
delete(m.tweet_tags, ids[i])
m.removedtweet_tags[ids[i]] = struct{}{}
}
}
// RemovedTweetTags returns the removed IDs of the "tweet_tags" edge to the TweetTag entity.
func (m *Mutation) RemovedTweetTagsIDs() (ids []uuid.UUID) {
for id := range m.removedtweet_tags {
ids = append(ids, id)
}
return
}
// TweetTagsIDs returns the "tweet_tags" edge IDs in the mutation.
func (m *Mutation) TweetTagsIDs() (ids []uuid.UUID) {
for id := range m.tweet_tags {
ids = append(ids, id)
}
return
}
// ResetTweetTags resets all changes to the "tweet_tags" edge.
func (m *Mutation) ResetTweetTags() {
m.tweet_tags = nil
m.clearedtweet_tags = false
m.removedtweet_tags = nil
}
// Where appends a list predicates to the Mutation builder.
func (m *Mutation) Where(ps ...predicate.Tweet) {
m.predicates = append(m.predicates, ps...)
}
// WhereP appends storage-level predicates to the Mutation builder. Using this method,
// users can use type-assertion to append predicates that do not depend on any generated package.
func (m *Mutation) WhereP(ps ...func(*sql.Selector)) {
p := make([]predicate.Tweet, len(ps))
for i := range ps {
p[i] = ps[i]
}
m.Where(p...)
}
// Op returns the operation name.
func (m *Mutation) Op() ent.Op {
return m.op
}
// SetOp allows setting the mutation operation.
func (m *Mutation) SetOp(op ent.Op) {
m.op = op
}
// Type returns the node type of this mutation (Tweet).
func (m *Mutation) Type() string {
return m.typ
}
// Fields returns all fields that were changed during this mutation. Note that in
// order to get all numeric fields that were incremented/decremented, call
// AddedFields().
func (m *Mutation) Fields() []string {
fields := make([]string, 0, 1)
if m.text != nil {
fields = append(fields, FieldText)
}
return fields
}
// Field returns the value of a field with the given name. The second boolean
// return value indicates that this field was not set, or was not defined in the
// schema.
func (m *Mutation) Field(name string) (ent.Value, bool) {
switch name {
case FieldText:
return m.Text()
}
return nil, false
}
// OldField returns the old value of the field from the database. An error is
// returned if the mutation operation is not UpdateOne, or the query to the
// database failed.
func (m *Mutation) OldField(ctx context.Context, name string) (ent.Value, error) {
return nil, fmt.Errorf("unknown Tweet field %s", name)
}
// SetField sets the value of a field with the given name. It returns an error if
// the field is not defined in the schema, or if the type mismatched the field
// type.
func (m *Mutation) SetField(name string, value ent.Value) error {
switch name {
case FieldText:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetText(v)
return nil
}
return fmt.Errorf("unknown Tweet field %s", name)
}
// AddedFields returns all numeric fields that were incremented/decremented during
// this mutation.
func (m *Mutation) AddedFields() []string {
return nil
}
// AddedField returns the numeric value that was incremented/decremented on a field
// with the given name. The second boolean return value indicates that this field
// was not set, or was not defined in the schema.
func (m *Mutation) AddedField(name string) (ent.Value, bool) {
return nil, false
}
// AddField adds the value to the field with the given name. It returns an error if
// the field is not defined in the schema, or if the type mismatched the field
// type.
func (m *Mutation) AddField(name string, value ent.Value) error {
switch name {
}
return fmt.Errorf("unknown Tweet numeric field %s", name)
}
// ClearedFields returns all nullable fields that were cleared during this
// mutation.
func (m *Mutation) ClearedFields() []string {
return nil
}
// FieldCleared returns a boolean indicating if a field with the given name was
// cleared in this mutation.
func (m *Mutation) FieldCleared(name string) bool {
_, ok := m.clearedFields[name]
return ok
}
// ClearField clears the value of the field with the given name. It returns an
// error if the field is not defined in the schema.
func (m *Mutation) ClearField(name string) error {
return fmt.Errorf("unknown Tweet nullable field %s", name)
}
// ResetField resets all changes in the mutation for the field with the given name.
// It returns an error if the field is not defined in the schema.
func (m *Mutation) ResetField(name string) error {
switch name {
case FieldText:
m.ResetText()
return nil
}
return fmt.Errorf("unknown Tweet field %s", name)
}
// AddedEdges returns all edge names that were set/added in this mutation.
func (m *Mutation) AddedEdges() []string {
edges := make([]string, 0, 5)
if m.liked_users != nil {
edges = append(edges, EdgeLikedUsers)
}
if m.user != nil {
edges = append(edges, EdgeUser)
}
if m.tags != nil {
edges = append(edges, EdgeTags)
}
if m.tweet_user != nil {
edges = append(edges, EdgeTweetUser)
}
if m.tweet_tags != nil {
edges = append(edges, EdgeTweetTags)
}
return edges
}
// AddedIDs returns all IDs (to other nodes) that were added for the given edge
// name in this mutation.
func (m *Mutation) AddedIDs(name string) []ent.Value {
switch name {
case EdgeLikedUsers:
ids := make([]ent.Value, 0, len(m.liked_users))
for id := range m.liked_users {
ids = append(ids, id)
}
return ids
case EdgeUser:
ids := make([]ent.Value, 0, len(m.user))
for id := range m.user {
ids = append(ids, id)
}
return ids
case EdgeTags:
ids := make([]ent.Value, 0, len(m.tags))
for id := range m.tags {
ids = append(ids, id)
}
return ids
case EdgeTweetUser:
ids := make([]ent.Value, 0, len(m.tweet_user))
for id := range m.tweet_user {
ids = append(ids, id)
}
return ids
case EdgeTweetTags:
ids := make([]ent.Value, 0, len(m.tweet_tags))
for id := range m.tweet_tags {
ids = append(ids, id)
}
return ids
}
return nil
}
// RemovedEdges returns all edge names that were removed in this mutation.
func (m *Mutation) RemovedEdges() []string {
edges := make([]string, 0, 5)
if m.removedliked_users != nil {
edges = append(edges, EdgeLikedUsers)
}
if m.removeduser != nil {
edges = append(edges, EdgeUser)
}
if m.removedtags != nil {
edges = append(edges, EdgeTags)
}
if m.removedtweet_user != nil {
edges = append(edges, EdgeTweetUser)
}
if m.removedtweet_tags != nil {
edges = append(edges, EdgeTweetTags)
}
return edges
}
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
// the given name in this mutation.
func (m *Mutation) RemovedIDs(name string) []ent.Value {
switch name {
case EdgeLikedUsers:
ids := make([]ent.Value, 0, len(m.removedliked_users))
for id := range m.removedliked_users {
ids = append(ids, id)
}
return ids
case EdgeUser:
ids := make([]ent.Value, 0, len(m.removeduser))
for id := range m.removeduser {
ids = append(ids, id)
}
return ids
case EdgeTags:
ids := make([]ent.Value, 0, len(m.removedtags))
for id := range m.removedtags {
ids = append(ids, id)
}
return ids
case EdgeTweetUser:
ids := make([]ent.Value, 0, len(m.removedtweet_user))
for id := range m.removedtweet_user {
ids = append(ids, id)
}
return ids
case EdgeTweetTags:
ids := make([]ent.Value, 0, len(m.removedtweet_tags))
for id := range m.removedtweet_tags {
ids = append(ids, id)
}
return ids
}
return nil
}
// ClearedEdges returns all edge names that were cleared in this mutation.
func (m *Mutation) ClearedEdges() []string {
edges := make([]string, 0, 5)
if m.clearedliked_users {
edges = append(edges, EdgeLikedUsers)
}
if m.cleareduser {
edges = append(edges, EdgeUser)
}
if m.clearedtags {
edges = append(edges, EdgeTags)
}
if m.clearedtweet_user {
edges = append(edges, EdgeTweetUser)
}
if m.clearedtweet_tags {
edges = append(edges, EdgeTweetTags)
}
return edges
}
// EdgeCleared returns a boolean which indicates if the edge with the given name
// was cleared in this mutation.
func (m *Mutation) EdgeCleared(name string) bool {
switch name {
case EdgeLikedUsers:
return m.clearedliked_users
case EdgeUser:
return m.cleareduser
case EdgeTags:
return m.clearedtags
case EdgeTweetUser:
return m.clearedtweet_user
case EdgeTweetTags:
return m.clearedtweet_tags
}
return false
}
// ClearEdge clears the value of the edge with the given name. It returns an error
// if that edge is not defined in the schema.
func (m *Mutation) ClearEdge(name string) error {
switch name {
}
return fmt.Errorf("unknown Tweet unique edge %s", name)
}
// ResetEdge resets all changes to the edge with the given name in this mutation.
// It returns an error if the edge is not defined in the schema.
func (m *Mutation) ResetEdge(name string) error {
switch name {
case EdgeLikedUsers:
m.ResetLikedUsers()
return nil
case EdgeUser:
m.ResetUser()
return nil
case EdgeTags:
m.ResetTags()
return nil
case EdgeTweetUser:
m.ResetTweetUser()
return nil
case EdgeTweetTags:
m.ResetTweetTags()
return nil
}
return fmt.Errorf("unknown Tweet edge %s", name)
}

View File

@@ -0,0 +1,238 @@
// Copyright 2019-present Facebook Inc. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.
// Code generated by ent, DO NOT EDIT.
package tweet
import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
const (
// Label holds the string label denoting the tweet type in the database.
Label = "tweet"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldText holds the string denoting the text field in the database.
FieldText = "text"
// EdgeLikedUsers holds the string denoting the liked_users edge name in mutations.
EdgeLikedUsers = "liked_users"
// EdgeUser holds the string denoting the user edge name in mutations.
EdgeUser = "user"
// EdgeTags holds the string denoting the tags edge name in mutations.
EdgeTags = "tags"
// EdgeLikes holds the string denoting the likes edge name in mutations.
EdgeLikes = "likes"
// EdgeTweetUser holds the string denoting the tweet_user edge name in mutations.
EdgeTweetUser = "tweet_user"
// EdgeTweetTags holds the string denoting the tweet_tags edge name in mutations.
EdgeTweetTags = "tweet_tags"
// Table holds the table name of the tweet in the database.
Table = "tweets"
// LikedUsersTable is the table that holds the liked_users relation/edge. The primary key declared below.
LikedUsersTable = "tweet_likes"
// LikedUsersInverseTable is the table name for the User entity.
// It exists in this package in order to avoid circular dependency with the "user" package.
LikedUsersInverseTable = "users"
// UserTable is the table that holds the user relation/edge. The primary key declared below.
UserTable = "user_tweets"
// UserInverseTable is the table name for the User entity.
// It exists in this package in order to avoid circular dependency with the "user" package.
UserInverseTable = "users"
// TagsTable is the table that holds the tags relation/edge. The primary key declared below.
TagsTable = "tweet_tags"
// TagsInverseTable is the table name for the Tag entity.
// It exists in this package in order to avoid circular dependency with the "tag" package.
TagsInverseTable = "tags"
// LikesTable is the table that holds the likes relation/edge.
LikesTable = "tweet_likes"
// LikesInverseTable is the table name for the TweetLike entity.
// It exists in this package in order to avoid circular dependency with the "tweetlike" package.
LikesInverseTable = "tweet_likes"
// LikesColumn is the table column denoting the likes relation/edge.
LikesColumn = "tweet_id"
// TweetUserTable is the table that holds the tweet_user relation/edge.
TweetUserTable = "user_tweets"
// TweetUserInverseTable is the table name for the UserTweet entity.
// It exists in this package in order to avoid circular dependency with the "usertweet" package.
TweetUserInverseTable = "user_tweets"
// TweetUserColumn is the table column denoting the tweet_user relation/edge.
TweetUserColumn = "tweet_id"
// TweetTagsTable is the table that holds the tweet_tags relation/edge.
TweetTagsTable = "tweet_tags"
// TweetTagsInverseTable is the table name for the TweetTag entity.
// It exists in this package in order to avoid circular dependency with the "tweettag" package.
TweetTagsInverseTable = "tweet_tags"
// TweetTagsColumn is the table column denoting the tweet_tags relation/edge.
TweetTagsColumn = "tweet_id"
)
// Columns holds all SQL columns for tweet fields.
var Columns = []string{
FieldID,
FieldText,
}
var (
// LikedUsersPrimaryKey and LikedUsersColumn2 are the table columns denoting the
// primary key for the liked_users relation (M2M).
LikedUsersPrimaryKey = []string{"user_id", "tweet_id"}
// UserPrimaryKey and UserColumn2 are the table columns denoting the
// primary key for the user relation (M2M).
UserPrimaryKey = []string{"user_id", "tweet_id"}
// TagsPrimaryKey and TagsColumn2 are the table columns denoting the
// primary key for the tags relation (M2M).
TagsPrimaryKey = []string{"tag_id", "tweet_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
}
// OrderOption defines the ordering options for the Tweet 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()
}
// ByText orders the results by the text field.
func ByText(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldText, opts...).ToFunc()
}
// ByLikedUsersCount orders the results by liked_users count.
func ByLikedUsersCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newLikedUsersStep(), opts...)
}
}
// ByLikedUsers orders the results by liked_users terms.
func ByLikedUsers(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newLikedUsersStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByUserCount orders the results by user count.
func ByUserCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newUserStep(), opts...)
}
}
// ByUser orders the results by user terms.
func ByUser(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newUserStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByTagsCount orders the results by tags count.
func ByTagsCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newTagsStep(), opts...)
}
}
// ByTags orders the results by tags terms.
func ByTags(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newTagsStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByLikesCount orders the results by likes count.
func ByLikesCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newLikesStep(), opts...)
}
}
// ByLikes orders the results by likes terms.
func ByLikes(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newLikesStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByTweetUserCount orders the results by tweet_user count.
func ByTweetUserCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newTweetUserStep(), opts...)
}
}
// ByTweetUser orders the results by tweet_user terms.
func ByTweetUser(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newTweetUserStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByTweetTagsCount orders the results by tweet_tags count.
func ByTweetTagsCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newTweetTagsStep(), opts...)
}
}
// ByTweetTags orders the results by tweet_tags terms.
func ByTweetTags(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newTweetTagsStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
func newLikedUsersStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(LikedUsersInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2M, true, LikedUsersTable, LikedUsersPrimaryKey...),
)
}
func newUserStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(UserInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2M, true, UserTable, UserPrimaryKey...),
)
}
func newTagsStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(TagsInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2M, true, TagsTable, TagsPrimaryKey...),
)
}
func newLikesStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(LikesInverseTable, LikesColumn),
sqlgraph.Edge(sqlgraph.O2M, true, LikesTable, LikesColumn),
)
}
func newTweetUserStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(TweetUserInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, TweetUserTable, TweetUserColumn),
)
}
func newTweetTagsStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(TweetTagsInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, TweetTagsTable, TweetTagsColumn),
)
}

View File

@@ -0,0 +1,281 @@
// Copyright 2019-present Facebook Inc. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.
// Code generated by ent, DO NOT EDIT.
package tweet
import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/entc/integration/edgeschema/ent/predicate"
)
// ID filters vertices based on their ID field.
func ID(id int) predicate.Tweet {
return predicate.Tweet(sql.FieldEQ(FieldID, id))
}
// IDEQ applies the EQ predicate on the ID field.
func IDEQ(id int) predicate.Tweet {
return predicate.Tweet(sql.FieldEQ(FieldID, id))
}
// IDNEQ applies the NEQ predicate on the ID field.
func IDNEQ(id int) predicate.Tweet {
return predicate.Tweet(sql.FieldNEQ(FieldID, id))
}
// IDIn applies the In predicate on the ID field.
func IDIn(ids ...int) predicate.Tweet {
return predicate.Tweet(sql.FieldIn(FieldID, ids...))
}
// IDNotIn applies the NotIn predicate on the ID field.
func IDNotIn(ids ...int) predicate.Tweet {
return predicate.Tweet(sql.FieldNotIn(FieldID, ids...))
}
// IDGT applies the GT predicate on the ID field.
func IDGT(id int) predicate.Tweet {
return predicate.Tweet(sql.FieldGT(FieldID, id))
}
// IDGTE applies the GTE predicate on the ID field.
func IDGTE(id int) predicate.Tweet {
return predicate.Tweet(sql.FieldGTE(FieldID, id))
}
// IDLT applies the LT predicate on the ID field.
func IDLT(id int) predicate.Tweet {
return predicate.Tweet(sql.FieldLT(FieldID, id))
}
// IDLTE applies the LTE predicate on the ID field.
func IDLTE(id int) predicate.Tweet {
return predicate.Tweet(sql.FieldLTE(FieldID, id))
}
// Text applies equality check predicate on the "text" field. It's identical to TextEQ.
func Text(v string) predicate.Tweet {
return predicate.Tweet(sql.FieldEQ(FieldText, v))
}
// TextEQ applies the EQ predicate on the "text" field.
func TextEQ(v string) predicate.Tweet {
return predicate.Tweet(sql.FieldEQ(FieldText, v))
}
// TextNEQ applies the NEQ predicate on the "text" field.
func TextNEQ(v string) predicate.Tweet {
return predicate.Tweet(sql.FieldNEQ(FieldText, v))
}
// TextIn applies the In predicate on the "text" field.
func TextIn(vs ...string) predicate.Tweet {
return predicate.Tweet(sql.FieldIn(FieldText, vs...))
}
// TextNotIn applies the NotIn predicate on the "text" field.
func TextNotIn(vs ...string) predicate.Tweet {
return predicate.Tweet(sql.FieldNotIn(FieldText, vs...))
}
// TextGT applies the GT predicate on the "text" field.
func TextGT(v string) predicate.Tweet {
return predicate.Tweet(sql.FieldGT(FieldText, v))
}
// TextGTE applies the GTE predicate on the "text" field.
func TextGTE(v string) predicate.Tweet {
return predicate.Tweet(sql.FieldGTE(FieldText, v))
}
// TextLT applies the LT predicate on the "text" field.
func TextLT(v string) predicate.Tweet {
return predicate.Tweet(sql.FieldLT(FieldText, v))
}
// TextLTE applies the LTE predicate on the "text" field.
func TextLTE(v string) predicate.Tweet {
return predicate.Tweet(sql.FieldLTE(FieldText, v))
}
// TextContains applies the Contains predicate on the "text" field.
func TextContains(v string) predicate.Tweet {
return predicate.Tweet(sql.FieldContains(FieldText, v))
}
// TextHasPrefix applies the HasPrefix predicate on the "text" field.
func TextHasPrefix(v string) predicate.Tweet {
return predicate.Tweet(sql.FieldHasPrefix(FieldText, v))
}
// TextHasSuffix applies the HasSuffix predicate on the "text" field.
func TextHasSuffix(v string) predicate.Tweet {
return predicate.Tweet(sql.FieldHasSuffix(FieldText, v))
}
// TextEqualFold applies the EqualFold predicate on the "text" field.
func TextEqualFold(v string) predicate.Tweet {
return predicate.Tweet(sql.FieldEqualFold(FieldText, v))
}
// TextContainsFold applies the ContainsFold predicate on the "text" field.
func TextContainsFold(v string) predicate.Tweet {
return predicate.Tweet(sql.FieldContainsFold(FieldText, v))
}
// HasLikedUsers applies the HasEdge predicate on the "liked_users" edge.
func HasLikedUsers() predicate.Tweet {
return predicate.Tweet(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.Edge(sqlgraph.M2M, true, LikedUsersTable, LikedUsersPrimaryKey...),
)
sqlgraph.HasNeighbors(s, step)
})
}
// HasLikedUsersWith applies the HasEdge predicate on the "liked_users" edge with a given conditions (other predicates).
func HasLikedUsersWith(preds ...predicate.User) predicate.Tweet {
return predicate.Tweet(func(s *sql.Selector) {
step := newLikedUsersStep()
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})
})
}
// HasUser applies the HasEdge predicate on the "user" edge.
func HasUser() predicate.Tweet {
return predicate.Tweet(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.Edge(sqlgraph.M2M, true, UserTable, UserPrimaryKey...),
)
sqlgraph.HasNeighbors(s, step)
})
}
// HasUserWith applies the HasEdge predicate on the "user" edge with a given conditions (other predicates).
func HasUserWith(preds ...predicate.User) predicate.Tweet {
return predicate.Tweet(func(s *sql.Selector) {
step := newUserStep()
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})
})
}
// HasTags applies the HasEdge predicate on the "tags" edge.
func HasTags() predicate.Tweet {
return predicate.Tweet(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.Edge(sqlgraph.M2M, true, TagsTable, TagsPrimaryKey...),
)
sqlgraph.HasNeighbors(s, step)
})
}
// HasTagsWith applies the HasEdge predicate on the "tags" edge with a given conditions (other predicates).
func HasTagsWith(preds ...predicate.Tag) predicate.Tweet {
return predicate.Tweet(func(s *sql.Selector) {
step := newTagsStep()
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})
})
}
// HasLikes applies the HasEdge predicate on the "likes" edge.
func HasLikes() predicate.Tweet {
return predicate.Tweet(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, LikesTable, LikesColumn),
)
sqlgraph.HasNeighbors(s, step)
})
}
// HasLikesWith applies the HasEdge predicate on the "likes" edge with a given conditions (other predicates).
func HasLikesWith(preds ...predicate.TweetLike) predicate.Tweet {
return predicate.Tweet(func(s *sql.Selector) {
step := newLikesStep()
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})
})
}
// HasTweetUser applies the HasEdge predicate on the "tweet_user" edge.
func HasTweetUser() predicate.Tweet {
return predicate.Tweet(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, TweetUserTable, TweetUserColumn),
)
sqlgraph.HasNeighbors(s, step)
})
}
// HasTweetUserWith applies the HasEdge predicate on the "tweet_user" edge with a given conditions (other predicates).
func HasTweetUserWith(preds ...predicate.UserTweet) predicate.Tweet {
return predicate.Tweet(func(s *sql.Selector) {
step := newTweetUserStep()
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})
})
}
// HasTweetTags applies the HasEdge predicate on the "tweet_tags" edge.
func HasTweetTags() predicate.Tweet {
return predicate.Tweet(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, TweetTagsTable, TweetTagsColumn),
)
sqlgraph.HasNeighbors(s, step)
})
}
// HasTweetTagsWith applies the HasEdge predicate on the "tweet_tags" edge with a given conditions (other predicates).
func HasTweetTagsWith(preds ...predicate.TweetTag) predicate.Tweet {
return predicate.Tweet(func(s *sql.Selector) {
step := newTweetTagsStep()
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.Tweet) predicate.Tweet {
return predicate.Tweet(sql.AndPredicates(predicates...))
}
// Or groups predicates with the OR operator between them.
func Or(predicates ...predicate.Tweet) predicate.Tweet {
return predicate.Tweet(sql.OrPredicates(predicates...))
}
// Not applies the not operator on the given predicate.
func Not(p predicate.Tweet) predicate.Tweet {
return predicate.Tweet(sql.NotPredicates(p))
}