mirror of
https://github.com/hanzoui/registry-backend.git
synced 2026-10-30 20:30:45 +00:00
119 lines
3.8 KiB
Go
119 lines
3.8 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package nodereview
|
|
|
|
import (
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
const (
|
|
// Label holds the string label denoting the nodereview type in the database.
|
|
Label = "node_review"
|
|
// FieldID holds the string denoting the id field in the database.
|
|
FieldID = "id"
|
|
// FieldNodeID holds the string denoting the node_id field in the database.
|
|
FieldNodeID = "node_id"
|
|
// FieldUserID holds the string denoting the user_id field in the database.
|
|
FieldUserID = "user_id"
|
|
// FieldStar holds the string denoting the star field in the database.
|
|
FieldStar = "star"
|
|
// EdgeUser holds the string denoting the user edge name in mutations.
|
|
EdgeUser = "user"
|
|
// EdgeNode holds the string denoting the node edge name in mutations.
|
|
EdgeNode = "node"
|
|
// Table holds the table name of the nodereview in the database.
|
|
Table = "node_reviews"
|
|
// UserTable is the table that holds the user relation/edge.
|
|
UserTable = "node_reviews"
|
|
// 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"
|
|
// UserColumn is the table column denoting the user relation/edge.
|
|
UserColumn = "user_id"
|
|
// NodeTable is the table that holds the node relation/edge.
|
|
NodeTable = "node_reviews"
|
|
// NodeInverseTable is the table name for the Node entity.
|
|
// It exists in this package in order to avoid circular dependency with the "node" package.
|
|
NodeInverseTable = "nodes"
|
|
// NodeColumn is the table column denoting the node relation/edge.
|
|
NodeColumn = "node_id"
|
|
)
|
|
|
|
// Columns holds all SQL columns for nodereview fields.
|
|
var Columns = []string{
|
|
FieldID,
|
|
FieldNodeID,
|
|
FieldUserID,
|
|
FieldStar,
|
|
}
|
|
|
|
// 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 (
|
|
// DefaultStar holds the default value on creation for the "star" field.
|
|
DefaultStar int
|
|
// DefaultID holds the default value on creation for the "id" field.
|
|
DefaultID func() uuid.UUID
|
|
)
|
|
|
|
// OrderOption defines the ordering options for the NodeReview 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()
|
|
}
|
|
|
|
// ByNodeID orders the results by the node_id field.
|
|
func ByNodeID(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldNodeID, opts...).ToFunc()
|
|
}
|
|
|
|
// ByUserID orders the results by the user_id field.
|
|
func ByUserID(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldUserID, opts...).ToFunc()
|
|
}
|
|
|
|
// ByStar orders the results by the star field.
|
|
func ByStar(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldStar, opts...).ToFunc()
|
|
}
|
|
|
|
// ByUserField orders the results by user field.
|
|
func ByUserField(field string, opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newUserStep(), sql.OrderByField(field, opts...))
|
|
}
|
|
}
|
|
|
|
// ByNodeField orders the results by node field.
|
|
func ByNodeField(field string, opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newNodeStep(), sql.OrderByField(field, opts...))
|
|
}
|
|
}
|
|
func newUserStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(UserInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, UserTable, UserColumn),
|
|
)
|
|
}
|
|
func newNodeStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(NodeInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, NodeTable, NodeColumn),
|
|
)
|
|
}
|