// Code generated by ent, DO NOT EDIT. package subject import ( "time" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "github.com/google/uuid" ) const ( // Label holds the string label denoting the subject type in the database. Label = "subject" // FieldID holds the string denoting the id field in the database. FieldID = "id" // FieldCreatedAt holds the string denoting the created_at field in the database. FieldCreatedAt = "created_at" // FieldName holds the string denoting the name field in the database. FieldName = "name" // EdgeSubjectDigests holds the string denoting the subject_digests edge name in mutations. EdgeSubjectDigests = "subject_digests" // EdgeStatement holds the string denoting the statement edge name in mutations. EdgeStatement = "statement" // Table holds the table name of the subject in the database. Table = "subjects" // SubjectDigestsTable is the table that holds the subject_digests relation/edge. SubjectDigestsTable = "subject_digests" // SubjectDigestsInverseTable is the table name for the SubjectDigest entity. // It exists in this package in order to avoid circular dependency with the "subjectdigest" package. SubjectDigestsInverseTable = "subject_digests" // SubjectDigestsColumn is the table column denoting the subject_digests relation/edge. SubjectDigestsColumn = "subject_subject_digests" // StatementTable is the table that holds the statement relation/edge. StatementTable = "subjects" // StatementInverseTable is the table name for the Statement entity. // It exists in this package in order to avoid circular dependency with the "statement" package. StatementInverseTable = "statements" // StatementColumn is the table column denoting the statement relation/edge. StatementColumn = "statement_subjects" ) // Columns holds all SQL columns for subject fields. var Columns = []string{ FieldID, FieldCreatedAt, FieldName, } // ForeignKeys holds the SQL foreign-keys that are owned by the "subjects" // table and are not defined as standalone fields in the schema. var ForeignKeys = []string{ "statement_subjects", } // 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 } } for i := range ForeignKeys { if column == ForeignKeys[i] { return true } } return false } var ( // DefaultCreatedAt holds the default value on creation for the "created_at" field. DefaultCreatedAt func() time.Time // NameValidator is a validator for the "name" field. It is called by the builders before save. NameValidator func(string) error // DefaultID holds the default value on creation for the "id" field. DefaultID func() uuid.UUID ) // OrderOption defines the ordering options for the Subject 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() } // ByCreatedAt orders the results by the created_at field. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldCreatedAt, opts...).ToFunc() } // ByName orders the results by the name field. func ByName(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldName, opts...).ToFunc() } // BySubjectDigestsCount orders the results by subject_digests count. func BySubjectDigestsCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborsCount(s, newSubjectDigestsStep(), opts...) } } // BySubjectDigests orders the results by subject_digests terms. func BySubjectDigests(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newSubjectDigestsStep(), append([]sql.OrderTerm{term}, terms...)...) } } // ByStatementField orders the results by statement field. func ByStatementField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newStatementStep(), sql.OrderByField(field, opts...)) } } func newSubjectDigestsStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(SubjectDigestsInverseTable, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, SubjectDigestsTable, SubjectDigestsColumn), ) } func newStatementStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(StatementInverseTable, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, StatementTable, StatementColumn), ) }