149 lines
5.0 KiB
Go
149 lines
5.0 KiB
Go
|
// Code generated by ent, DO NOT EDIT.
|
||
|
|
||
|
package transactions
|
||
|
|
||
|
import (
|
||
|
"entgo.io/ent/dialect/sql"
|
||
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||
|
)
|
||
|
|
||
|
const (
|
||
|
// Label holds the string label denoting the transactions type in the database.
|
||
|
Label = "transactions"
|
||
|
// FieldID holds the string denoting the id field in the database.
|
||
|
FieldID = "id"
|
||
|
// FieldType holds the string denoting the type field in the database.
|
||
|
FieldType = "type"
|
||
|
// FieldTimestamp holds the string denoting the timestamp field in the database.
|
||
|
FieldTimestamp = "timestamp"
|
||
|
// FieldComment holds the string denoting the comment field in the database.
|
||
|
FieldComment = "comment"
|
||
|
// FieldContent holds the string denoting the content field in the database.
|
||
|
FieldContent = "content"
|
||
|
// FieldHash holds the string denoting the hash field in the database.
|
||
|
FieldHash = "hash"
|
||
|
// FieldSignature holds the string denoting the signature field in the database.
|
||
|
FieldSignature = "signature"
|
||
|
// EdgeSigner holds the string denoting the signer edge name in mutations.
|
||
|
EdgeSigner = "Signer"
|
||
|
// EdgeBlock holds the string denoting the block edge name in mutations.
|
||
|
EdgeBlock = "Block"
|
||
|
// Table holds the table name of the transactions in the database.
|
||
|
Table = "transactions"
|
||
|
// SignerTable is the table that holds the Signer relation/edge. The primary key declared below.
|
||
|
SignerTable = "key_Signed"
|
||
|
// SignerInverseTable is the table name for the Key entity.
|
||
|
// It exists in this package in order to avoid circular dependency with the "key" package.
|
||
|
SignerInverseTable = "keys"
|
||
|
// BlockTable is the table that holds the Block relation/edge. The primary key declared below.
|
||
|
BlockTable = "blocks_MinedTxs"
|
||
|
// BlockInverseTable is the table name for the Blocks entity.
|
||
|
// It exists in this package in order to avoid circular dependency with the "blocks" package.
|
||
|
BlockInverseTable = "blocks"
|
||
|
)
|
||
|
|
||
|
// Columns holds all SQL columns for transactions fields.
|
||
|
var Columns = []string{
|
||
|
FieldID,
|
||
|
FieldType,
|
||
|
FieldTimestamp,
|
||
|
FieldComment,
|
||
|
FieldContent,
|
||
|
FieldHash,
|
||
|
FieldSignature,
|
||
|
}
|
||
|
|
||
|
var (
|
||
|
// SignerPrimaryKey and SignerColumn2 are the table columns denoting the
|
||
|
// primary key for the Signer relation (M2M).
|
||
|
SignerPrimaryKey = []string{"key_id", "transactions_id"}
|
||
|
// BlockPrimaryKey and BlockColumn2 are the table columns denoting the
|
||
|
// primary key for the Block relation (M2M).
|
||
|
BlockPrimaryKey = []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 Transactions 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()
|
||
|
}
|
||
|
|
||
|
// ByType orders the results by the type field.
|
||
|
func ByType(opts ...sql.OrderTermOption) OrderOption {
|
||
|
return sql.OrderByField(FieldType, opts...).ToFunc()
|
||
|
}
|
||
|
|
||
|
// ByTimestamp orders the results by the timestamp field.
|
||
|
func ByTimestamp(opts ...sql.OrderTermOption) OrderOption {
|
||
|
return sql.OrderByField(FieldTimestamp, opts...).ToFunc()
|
||
|
}
|
||
|
|
||
|
// ByComment orders the results by the comment field.
|
||
|
func ByComment(opts ...sql.OrderTermOption) OrderOption {
|
||
|
return sql.OrderByField(FieldComment, opts...).ToFunc()
|
||
|
}
|
||
|
|
||
|
// ByHash orders the results by the hash field.
|
||
|
func ByHash(opts ...sql.OrderTermOption) OrderOption {
|
||
|
return sql.OrderByField(FieldHash, opts...).ToFunc()
|
||
|
}
|
||
|
|
||
|
// BySignature orders the results by the signature field.
|
||
|
func BySignature(opts ...sql.OrderTermOption) OrderOption {
|
||
|
return sql.OrderByField(FieldSignature, opts...).ToFunc()
|
||
|
}
|
||
|
|
||
|
// BySignerCount orders the results by Signer count.
|
||
|
func BySignerCount(opts ...sql.OrderTermOption) OrderOption {
|
||
|
return func(s *sql.Selector) {
|
||
|
sqlgraph.OrderByNeighborsCount(s, newSignerStep(), opts...)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// BySigner orders the results by Signer terms.
|
||
|
func BySigner(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||
|
return func(s *sql.Selector) {
|
||
|
sqlgraph.OrderByNeighborTerms(s, newSignerStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// ByBlockCount orders the results by Block count.
|
||
|
func ByBlockCount(opts ...sql.OrderTermOption) OrderOption {
|
||
|
return func(s *sql.Selector) {
|
||
|
sqlgraph.OrderByNeighborsCount(s, newBlockStep(), opts...)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// ByBlock orders the results by Block terms.
|
||
|
func ByBlock(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||
|
return func(s *sql.Selector) {
|
||
|
sqlgraph.OrderByNeighborTerms(s, newBlockStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||
|
}
|
||
|
}
|
||
|
func newSignerStep() *sqlgraph.Step {
|
||
|
return sqlgraph.NewStep(
|
||
|
sqlgraph.From(Table, FieldID),
|
||
|
sqlgraph.To(SignerInverseTable, FieldID),
|
||
|
sqlgraph.Edge(sqlgraph.M2M, true, SignerTable, SignerPrimaryKey...),
|
||
|
)
|
||
|
}
|
||
|
func newBlockStep() *sqlgraph.Step {
|
||
|
return sqlgraph.NewStep(
|
||
|
sqlgraph.From(Table, FieldID),
|
||
|
sqlgraph.To(BlockInverseTable, FieldID),
|
||
|
sqlgraph.Edge(sqlgraph.M2M, true, BlockTable, BlockPrimaryKey...),
|
||
|
)
|
||
|
}
|