Files
upstream-mirror 4b3ad0b611
Some checks failed
Atlas CI Public / lint (push) Failing after 13s
Atlas CI Public / sync (push) Has been skipped
snapshot of https://github.com/ent/ent.git (master, 2026-09-15; blobs > 131072B omitted)
2026-09-15 22:12:36 +05:00

239 lines
8.7 KiB
Go

// 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),
)
}