| 1 |
// Code generated by ent, DO NOT EDIT. |
| 2 |
|
| 3 |
package attestationcollection |
| 4 |
|
| 5 |
import ( |
| 6 |
"entgo.io/ent/dialect/sql" |
| 7 |
"entgo.io/ent/dialect/sql/sqlgraph" |
| 8 |
"github.com/google/uuid" |
| 9 |
) |
| 10 |
|
| 11 |
const ( |
| 12 |
// Label holds the string label denoting the attestationcollection type in the database. |
| 13 |
Label = "attestation_collection" |
| 14 |
// FieldID holds the string denoting the id field in the database. |
| 15 |
FieldID = "id" |
| 16 |
// FieldName holds the string denoting the name field in the database. |
| 17 |
FieldName = "name" |
| 18 |
// EdgeAttestations holds the string denoting the attestations edge name in mutations. |
| 19 |
EdgeAttestations = "attestations" |
| 20 |
// EdgeStatement holds the string denoting the statement edge name in mutations. |
| 21 |
EdgeStatement = "statement" |
| 22 |
// Table holds the table name of the attestationcollection in the database. |
| 23 |
Table = "attestation_collections" |
| 24 |
// AttestationsTable is the table that holds the attestations relation/edge. |
| 25 |
AttestationsTable = "attestations" |
| 26 |
// AttestationsInverseTable is the table name for the Attestation entity. |
| 27 |
// It exists in this package in order to avoid circular dependency with the "attestation" package. |
| 28 |
AttestationsInverseTable = "attestations" |
| 29 |
// AttestationsColumn is the table column denoting the attestations relation/edge. |
| 30 |
AttestationsColumn = "attestation_collection_attestations" |
| 31 |
// StatementTable is the table that holds the statement relation/edge. |
| 32 |
StatementTable = "attestation_collections" |
| 33 |
// StatementInverseTable is the table name for the Statement entity. |
| 34 |
// It exists in this package in order to avoid circular dependency with the "statement" package. |
| 35 |
StatementInverseTable = "statements" |
| 36 |
// StatementColumn is the table column denoting the statement relation/edge. |
| 37 |
StatementColumn = "statement_attestation_collections" |
| 38 |
) |
| 39 |
|
| 40 |
// Columns holds all SQL columns for attestationcollection fields. |
| 41 |
var Columns = []string{ |
| 42 |
FieldID, |
| 43 |
FieldName, |
| 44 |
} |
| 45 |
|
| 46 |
// ForeignKeys holds the SQL foreign-keys that are owned by the "attestation_collections" |
| 47 |
// table and are not defined as standalone fields in the schema. |
| 48 |
var ForeignKeys = []string{ |
| 49 |
"statement_attestation_collections", |
| 50 |
} |
| 51 |
|
| 52 |
// ValidColumn reports if the column name is valid (part of the table columns). |
| 53 |
func ValidColumn(column string) bool { |
| 54 |
for i := range Columns { |
| 55 |
if column == Columns[i] { |
| 56 |
return true |
| 57 |
} |
| 58 |
} |
| 59 |
for i := range ForeignKeys { |
| 60 |
if column == ForeignKeys[i] { |
| 61 |
return true |
| 62 |
} |
| 63 |
} |
| 64 |
return false |
| 65 |
} |
| 66 |
|
| 67 |
var ( |
| 68 |
// NameValidator is a validator for the "name" field. It is called by the builders before save. |
| 69 |
NameValidator func(string) error |
| 70 |
// DefaultID holds the default value on creation for the "id" field. |
| 71 |
DefaultID func() uuid.UUID |
| 72 |
) |
| 73 |
|
| 74 |
// OrderOption defines the ordering options for the AttestationCollection queries. |
| 75 |
type OrderOption func(*sql.Selector) |
| 76 |
|
| 77 |
// ByID orders the results by the id field. |
| 78 |
func ByID(opts ...sql.OrderTermOption) OrderOption { |
| 79 |
return sql.OrderByField(FieldID, opts...).ToFunc() |
| 80 |
} |
| 81 |
|
| 82 |
// ByName orders the results by the name field. |
| 83 |
func ByName(opts ...sql.OrderTermOption) OrderOption { |
| 84 |
return sql.OrderByField(FieldName, opts...).ToFunc() |
| 85 |
} |
| 86 |
|
| 87 |
// ByAttestationsCount orders the results by attestations count. |
| 88 |
func ByAttestationsCount(opts ...sql.OrderTermOption) OrderOption { |
| 89 |
return func(s *sql.Selector) { |
| 90 |
sqlgraph.OrderByNeighborsCount(s, newAttestationsStep(), opts...) |
| 91 |
} |
| 92 |
} |
| 93 |
|
| 94 |
// ByAttestations orders the results by attestations terms. |
| 95 |
func ByAttestations(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { |
| 96 |
return func(s *sql.Selector) { |
| 97 |
sqlgraph.OrderByNeighborTerms(s, newAttestationsStep(), append([]sql.OrderTerm{term}, terms...)...) |
| 98 |
} |
| 99 |
} |
| 100 |
|
| 101 |
// ByStatementField orders the results by statement field. |
| 102 |
func ByStatementField(field string, opts ...sql.OrderTermOption) OrderOption { |
| 103 |
return func(s *sql.Selector) { |
| 104 |
sqlgraph.OrderByNeighborTerms(s, newStatementStep(), sql.OrderByField(field, opts...)) |
| 105 |
} |
| 106 |
} |
| 107 |
func newAttestationsStep() *sqlgraph.Step { |
| 108 |
return sqlgraph.NewStep( |
| 109 |
sqlgraph.From(Table, FieldID), |
| 110 |
sqlgraph.To(AttestationsInverseTable, FieldID), |
| 111 |
sqlgraph.Edge(sqlgraph.O2M, false, AttestationsTable, AttestationsColumn), |
| 112 |
) |
| 113 |
} |
| 114 |
func newStatementStep() *sqlgraph.Step { |
| 115 |
return sqlgraph.NewStep( |
| 116 |
sqlgraph.From(Table, FieldID), |
| 117 |
sqlgraph.To(StatementInverseTable, FieldID), |
| 118 |
sqlgraph.Edge(sqlgraph.O2O, true, StatementTable, StatementColumn), |
| 119 |
) |
| 120 |
} |