// Code generated by ent, DO NOT EDIT.

package usersignedtransaction

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 usersignedtransaction type in the database.
	Label = "user_signed_transaction"
	// 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"
	// FieldTransaction holds the string denoting the transaction field in the database.
	FieldTransaction = "transaction"
	// FieldUserSignature holds the string denoting the user_signature field in the database.
	FieldUserSignature = "user_signature"
	// FieldSigningCommitments holds the string denoting the signing_commitments field in the database.
	FieldSigningCommitments = "signing_commitments"
	// FieldUserSignatureCommitment holds the string denoting the user_signature_commitment field in the database.
	FieldUserSignatureCommitment = "user_signature_commitment"
	// EdgeTreeNode holds the string denoting the tree_node edge name in mutations.
	EdgeTreeNode = "tree_node"
	// EdgePreimageRequest holds the string denoting the preimage_request edge name in mutations.
	EdgePreimageRequest = "preimage_request"
	// Table holds the table name of the usersignedtransaction in the database.
	Table = "user_signed_transactions"
	// TreeNodeTable is the table that holds the tree_node relation/edge.
	TreeNodeTable = "user_signed_transactions"
	// TreeNodeInverseTable is the table name for the TreeNode entity.
	// It exists in this package in order to avoid circular dependency with the "treenode" package.
	TreeNodeInverseTable = "tree_nodes"
	// TreeNodeColumn is the table column denoting the tree_node relation/edge.
	TreeNodeColumn = "user_signed_transaction_tree_node"
	// PreimageRequestTable is the table that holds the preimage_request relation/edge.
	PreimageRequestTable = "user_signed_transactions"
	// PreimageRequestInverseTable is the table name for the PreimageRequest entity.
	// It exists in this package in order to avoid circular dependency with the "preimagerequest" package.
	PreimageRequestInverseTable = "preimage_requests"
	// PreimageRequestColumn is the table column denoting the preimage_request relation/edge.
	PreimageRequestColumn = "user_signed_transaction_preimage_request"
)

// Columns holds all SQL columns for usersignedtransaction fields.
var Columns = []string{
	FieldID,
	FieldCreateTime,
	FieldUpdateTime,
	FieldTransaction,
	FieldUserSignature,
	FieldSigningCommitments,
	FieldUserSignatureCommitment,
}

// ForeignKeys holds the SQL foreign-keys that are owned by the "user_signed_transactions"
// table and are not defined as standalone fields in the schema.
var ForeignKeys = []string{
	"user_signed_transaction_tree_node",
	"user_signed_transaction_preimage_request",
}

// 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 (
	// 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
	// TransactionValidator is a validator for the "transaction" field. It is called by the builders before save.
	TransactionValidator func([]byte) error
	// UserSignatureValidator is a validator for the "user_signature" field. It is called by the builders before save.
	UserSignatureValidator func([]byte) error
	// SigningCommitmentsValidator is a validator for the "signing_commitments" field. It is called by the builders before save.
	SigningCommitmentsValidator func([]byte) error
	// UserSignatureCommitmentValidator is a validator for the "user_signature_commitment" field. It is called by the builders before save.
	UserSignatureCommitmentValidator func([]byte) error
	// DefaultID holds the default value on creation for the "id" field.
	DefaultID func() uuid.UUID
)

// OrderOption defines the ordering options for the UserSignedTransaction 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()
}

// ByTreeNodeField orders the results by tree_node field.
func ByTreeNodeField(field string, opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newTreeNodeStep(), sql.OrderByField(field, opts...))
	}
}

// ByPreimageRequestField orders the results by preimage_request field.
func ByPreimageRequestField(field string, opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newPreimageRequestStep(), sql.OrderByField(field, opts...))
	}
}
func newTreeNodeStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(TreeNodeInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.M2O, false, TreeNodeTable, TreeNodeColumn),
	)
}
func newPreimageRequestStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(PreimageRequestInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.M2O, false, PreimageRequestTable, PreimageRequestColumn),
	)
}
