Files
55ba2fa980 Adhere to node ID compliance with pyproject.toml (#156)
* Adhere to node ID compliance with pyproject.toml

* Address comments + Add tests

* Fix test

---------

Co-authored-by: James Kwon <[email protected]>
2025-01-27 20:34:03 -05:00

296 lines
11 KiB
Go

// Code generated by ent, DO NOT EDIT.
package node
import (
"fmt"
"registry-backend/ent/schema"
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
const (
// Label holds the string label denoting the node type in the database.
Label = "node"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldCreateTime holds the string denoting the create_time field in the database.
FieldCreateTime = "create_time"
// FieldUpdateTime holds the string denoting the update_time field in the database.
FieldUpdateTime = "update_time"
// FieldNormalizedID holds the string denoting the normalized_id field in the database.
FieldNormalizedID = "normalized_id"
// FieldPublisherID holds the string denoting the publisher_id field in the database.
FieldPublisherID = "publisher_id"
// FieldName holds the string denoting the name field in the database.
FieldName = "name"
// FieldDescription holds the string denoting the description field in the database.
FieldDescription = "description"
// FieldCategory holds the string denoting the category field in the database.
FieldCategory = "category"
// FieldAuthor holds the string denoting the author field in the database.
FieldAuthor = "author"
// FieldLicense holds the string denoting the license field in the database.
FieldLicense = "license"
// FieldRepositoryURL holds the string denoting the repository_url field in the database.
FieldRepositoryURL = "repository_url"
// FieldIconURL holds the string denoting the icon_url field in the database.
FieldIconURL = "icon_url"
// FieldTags holds the string denoting the tags field in the database.
FieldTags = "tags"
// FieldTotalInstall holds the string denoting the total_install field in the database.
FieldTotalInstall = "total_install"
// FieldTotalStar holds the string denoting the total_star field in the database.
FieldTotalStar = "total_star"
// FieldTotalReview holds the string denoting the total_review field in the database.
FieldTotalReview = "total_review"
// FieldStatus holds the string denoting the status field in the database.
FieldStatus = "status"
// FieldStatusDetail holds the string denoting the status_detail field in the database.
FieldStatusDetail = "status_detail"
// FieldLastAlgoliaIndexTime holds the string denoting the last_algolia_index_time field in the database.
FieldLastAlgoliaIndexTime = "last_algolia_index_time"
// EdgePublisher holds the string denoting the publisher edge name in mutations.
EdgePublisher = "publisher"
// EdgeVersions holds the string denoting the versions edge name in mutations.
EdgeVersions = "versions"
// EdgeReviews holds the string denoting the reviews edge name in mutations.
EdgeReviews = "reviews"
// Table holds the table name of the node in the database.
Table = "nodes"
// PublisherTable is the table that holds the publisher relation/edge.
PublisherTable = "nodes"
// PublisherInverseTable is the table name for the Publisher entity.
// It exists in this package in order to avoid circular dependency with the "publisher" package.
PublisherInverseTable = "publishers"
// PublisherColumn is the table column denoting the publisher relation/edge.
PublisherColumn = "publisher_id"
// VersionsTable is the table that holds the versions relation/edge.
VersionsTable = "node_versions"
// VersionsInverseTable is the table name for the NodeVersion entity.
// It exists in this package in order to avoid circular dependency with the "nodeversion" package.
VersionsInverseTable = "node_versions"
// VersionsColumn is the table column denoting the versions relation/edge.
VersionsColumn = "node_id"
// ReviewsTable is the table that holds the reviews relation/edge.
ReviewsTable = "node_reviews"
// ReviewsInverseTable is the table name for the NodeReview entity.
// It exists in this package in order to avoid circular dependency with the "nodereview" package.
ReviewsInverseTable = "node_reviews"
// ReviewsColumn is the table column denoting the reviews relation/edge.
ReviewsColumn = "node_id"
)
// Columns holds all SQL columns for node fields.
var Columns = []string{
FieldID,
FieldCreateTime,
FieldUpdateTime,
FieldNormalizedID,
FieldPublisherID,
FieldName,
FieldDescription,
FieldCategory,
FieldAuthor,
FieldLicense,
FieldRepositoryURL,
FieldIconURL,
FieldTags,
FieldTotalInstall,
FieldTotalStar,
FieldTotalReview,
FieldStatus,
FieldStatusDetail,
FieldLastAlgoliaIndexTime,
}
// 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 (
// DefaultCreateTime holds the default value on creation for the "create_time" field.
DefaultCreateTime func() time.Time
// DefaultUpdateTime holds the default value on creation for the "update_time" field.
DefaultUpdateTime func() time.Time
// UpdateDefaultUpdateTime holds the default value on update for the "update_time" field.
UpdateDefaultUpdateTime func() time.Time
// DefaultTags holds the default value on creation for the "tags" field.
DefaultTags []string
// DefaultTotalInstall holds the default value on creation for the "total_install" field.
DefaultTotalInstall int64
// DefaultTotalStar holds the default value on creation for the "total_star" field.
DefaultTotalStar int64
// DefaultTotalReview holds the default value on creation for the "total_review" field.
DefaultTotalReview int64
)
const DefaultStatus schema.NodeStatus = "active"
// StatusValidator is a validator for the "status" field enum values. It is called by the builders before save.
func StatusValidator(s schema.NodeStatus) error {
switch s {
case "active", "banned", "deleted":
return nil
default:
return fmt.Errorf("node: invalid enum value for status field: %q", s)
}
}
// OrderOption defines the ordering options for the Node 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()
}
// ByCreateTime orders the results by the create_time field.
func ByCreateTime(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreateTime, opts...).ToFunc()
}
// ByUpdateTime orders the results by the update_time field.
func ByUpdateTime(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUpdateTime, opts...).ToFunc()
}
// ByNormalizedID orders the results by the normalized_id field.
func ByNormalizedID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldNormalizedID, opts...).ToFunc()
}
// ByPublisherID orders the results by the publisher_id field.
func ByPublisherID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldPublisherID, opts...).ToFunc()
}
// ByName orders the results by the name field.
func ByName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldName, opts...).ToFunc()
}
// ByDescription orders the results by the description field.
func ByDescription(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDescription, opts...).ToFunc()
}
// ByCategory orders the results by the category field.
func ByCategory(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCategory, opts...).ToFunc()
}
// ByAuthor orders the results by the author field.
func ByAuthor(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldAuthor, opts...).ToFunc()
}
// ByLicense orders the results by the license field.
func ByLicense(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldLicense, opts...).ToFunc()
}
// ByRepositoryURL orders the results by the repository_url field.
func ByRepositoryURL(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldRepositoryURL, opts...).ToFunc()
}
// ByIconURL orders the results by the icon_url field.
func ByIconURL(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldIconURL, opts...).ToFunc()
}
// ByTotalInstall orders the results by the total_install field.
func ByTotalInstall(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldTotalInstall, opts...).ToFunc()
}
// ByTotalStar orders the results by the total_star field.
func ByTotalStar(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldTotalStar, opts...).ToFunc()
}
// ByTotalReview orders the results by the total_review field.
func ByTotalReview(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldTotalReview, opts...).ToFunc()
}
// ByStatus orders the results by the status field.
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldStatus, opts...).ToFunc()
}
// ByStatusDetail orders the results by the status_detail field.
func ByStatusDetail(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldStatusDetail, opts...).ToFunc()
}
// ByLastAlgoliaIndexTime orders the results by the last_algolia_index_time field.
func ByLastAlgoliaIndexTime(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldLastAlgoliaIndexTime, opts...).ToFunc()
}
// ByPublisherField orders the results by publisher field.
func ByPublisherField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newPublisherStep(), sql.OrderByField(field, opts...))
}
}
// ByVersionsCount orders the results by versions count.
func ByVersionsCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newVersionsStep(), opts...)
}
}
// ByVersions orders the results by versions terms.
func ByVersions(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newVersionsStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByReviewsCount orders the results by reviews count.
func ByReviewsCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newReviewsStep(), opts...)
}
}
// ByReviews orders the results by reviews terms.
func ByReviews(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newReviewsStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
func newPublisherStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(PublisherInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, PublisherTable, PublisherColumn),
)
}
func newVersionsStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(VersionsInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, VersionsTable, VersionsColumn),
)
}
func newReviewsStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(ReviewsInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, ReviewsTable, ReviewsColumn),
)
}