// Code generated by ent, DO NOT EDIT. package blocks import ( "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" ) const ( // Label holds the string label denoting the blocks type in the database. Label = "blocks" // FieldID holds the string denoting the id field in the database. FieldID = "id" // FieldHash holds the string denoting the hash field in the database. FieldHash = "hash" // FieldLength holds the string denoting the length field in the database. FieldLength = "length" // FieldPreviousHash holds the string denoting the previoushash field in the database. FieldPreviousHash = "previous_hash" // EdgeCaster holds the string denoting the caster edge name in mutations. EdgeCaster = "Caster" // EdgeMinedTxs holds the string denoting the minedtxs edge name in mutations. EdgeMinedTxs = "MinedTxs" // Table holds the table name of the blocks in the database. Table = "blocks" // CasterTable is the table that holds the Caster relation/edge. CasterTable = "validators" // CasterInverseTable is the table name for the Validators entity. // It exists in this package in order to avoid circular dependency with the "validators" package. CasterInverseTable = "validators" // CasterColumn is the table column denoting the Caster relation/edge. CasterColumn = "blocks_caster" // MinedTxsTable is the table that holds the MinedTxs relation/edge. The primary key declared below. MinedTxsTable = "blocks_MinedTxs" // MinedTxsInverseTable is the table name for the Transactions entity. // It exists in this package in order to avoid circular dependency with the "transactions" package. MinedTxsInverseTable = "transactions" ) // Columns holds all SQL columns for blocks fields. var Columns = []string{ FieldID, FieldHash, FieldLength, FieldPreviousHash, } var ( // MinedTxsPrimaryKey and MinedTxsColumn2 are the table columns denoting the // primary key for the MinedTxs relation (M2M). MinedTxsPrimaryKey = []string{"blocks_id", "transactions_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 Blocks 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() } // ByHash orders the results by the hash field. func ByHash(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldHash, opts...).ToFunc() } // ByLength orders the results by the length field. func ByLength(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldLength, opts...).ToFunc() } // ByPreviousHash orders the results by the previousHash field. func ByPreviousHash(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldPreviousHash, opts...).ToFunc() } // ByCasterCount orders the results by Caster count. func ByCasterCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborsCount(s, newCasterStep(), opts...) } } // ByCaster orders the results by Caster terms. func ByCaster(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newCasterStep(), append([]sql.OrderTerm{term}, terms...)...) } } // ByMinedTxsCount orders the results by MinedTxs count. func ByMinedTxsCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborsCount(s, newMinedTxsStep(), opts...) } } // ByMinedTxs orders the results by MinedTxs terms. func ByMinedTxs(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newMinedTxsStep(), append([]sql.OrderTerm{term}, terms...)...) } } func newCasterStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(CasterInverseTable, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, CasterTable, CasterColumn), ) } func newMinedTxsStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(MinedTxsInverseTable, FieldID), sqlgraph.Edge(sqlgraph.M2M, false, MinedTxsTable, MinedTxsPrimaryKey...), ) }