// Code generated by ent, DO NOT EDIT. package documentblock import ( "time" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" ) const ( // Label holds the string label denoting the documentblock type in the database. Label = "document_block" // FieldID holds the string denoting the id field in the database. FieldID = "id" // FieldContent holds the string denoting the content field in the database. FieldContent = "content" // FieldOrder holds the string denoting the order field in the database. FieldOrder = "order" // FieldDocumentID holds the string denoting the document_id field in the database. FieldDocumentID = "document_id" // FieldUserID holds the string denoting the user_id field in the database. FieldUserID = "user_id" // FieldCreatedAt holds the string denoting the created_at field in the database. FieldCreatedAt = "created_at" // FieldUpdatedAt holds the string denoting the updated_at field in the database. FieldUpdatedAt = "updated_at" // EdgeDocument holds the string denoting the document edge name in mutations. EdgeDocument = "document" // Table holds the table name of the documentblock in the database. Table = "document_blocks" // DocumentTable is the table that holds the document relation/edge. DocumentTable = "documents" // DocumentInverseTable is the table name for the Document entity. // It exists in this package in order to avoid circular dependency with the "document" package. DocumentInverseTable = "documents" // DocumentColumn is the table column denoting the document relation/edge. DocumentColumn = "document_block_document" ) // Columns holds all SQL columns for documentblock fields. var Columns = []string{ FieldID, FieldContent, FieldOrder, FieldDocumentID, FieldUserID, FieldCreatedAt, FieldUpdatedAt, } // 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 ( // DefaultCreatedAt holds the default value on creation for the "created_at" field. DefaultCreatedAt func() time.Time // DefaultUpdatedAt holds the default value on creation for the "updated_at" field. DefaultUpdatedAt func() time.Time ) // OrderOption defines the ordering options for the DocumentBlock 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() } // ByContent orders the results by the content field. func ByContent(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldContent, opts...).ToFunc() } // ByOrder orders the results by the order field. func ByOrder(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldOrder, opts...).ToFunc() } // ByDocumentID orders the results by the document_id field. func ByDocumentID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldDocumentID, opts...).ToFunc() } // ByUserID orders the results by the user_id field. func ByUserID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldUserID, opts...).ToFunc() } // ByCreatedAt orders the results by the created_at field. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldCreatedAt, opts...).ToFunc() } // ByUpdatedAt orders the results by the updated_at field. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc() } // ByDocumentCount orders the results by document count. func ByDocumentCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborsCount(s, newDocumentStep(), opts...) } } // ByDocument orders the results by document terms. func ByDocument(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newDocumentStep(), append([]sql.OrderTerm{term}, terms...)...) } } func newDocumentStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(DocumentInverseTable, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, DocumentTable, DocumentColumn), ) }