| 1 |
// Code generated by ent, DO NOT EDIT. |
| 2 |
|
| 3 |
package statement |
| 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 statement type in the database. |
| 13 |
Label = "statement" |
| 14 |
// FieldID holds the string denoting the id field in the database. |
| 15 |
FieldID = "id" |
| 16 |
// FieldPredicate holds the string denoting the predicate field in the database. |
| 17 |
FieldPredicate = "predicate" |
| 18 |
// EdgeSubjects holds the string denoting the subjects edge name in mutations. |
| 19 |
EdgeSubjects = "subjects" |
| 20 |
// EdgePolicy holds the string denoting the policy edge name in mutations. |
| 21 |
EdgePolicy = "policy" |
| 22 |
// EdgeAttestationCollections holds the string denoting the attestation_collections edge name in mutations. |
| 23 |
EdgeAttestationCollections = "attestation_collections" |
| 24 |
// EdgeDsse holds the string denoting the dsse edge name in mutations. |
| 25 |
EdgeDsse = "dsse" |
| 26 |
// Table holds the table name of the statement in the database. |
| 27 |
Table = "statements" |
| 28 |
// SubjectsTable is the table that holds the subjects relation/edge. |
| 29 |
SubjectsTable = "subjects" |
| 30 |
// SubjectsInverseTable is the table name for the Subject entity. |
| 31 |
// It exists in this package in order to avoid circular dependency with the "subject" package. |
| 32 |
SubjectsInverseTable = "subjects" |
| 33 |
// SubjectsColumn is the table column denoting the subjects relation/edge. |
| 34 |
SubjectsColumn = "statement_subjects" |
| 35 |
// PolicyTable is the table that holds the policy relation/edge. |
| 36 |
PolicyTable = "attestation_policies" |
| 37 |
// PolicyInverseTable is the table name for the AttestationPolicy entity. |
| 38 |
// It exists in this package in order to avoid circular dependency with the "attestationpolicy" package. |
| 39 |
PolicyInverseTable = "attestation_policies" |
| 40 |
// PolicyColumn is the table column denoting the policy relation/edge. |
| 41 |
PolicyColumn = "statement_policy" |
| 42 |
// AttestationCollectionsTable is the table that holds the attestation_collections relation/edge. |
| 43 |
AttestationCollectionsTable = "attestation_collections" |
| 44 |
// AttestationCollectionsInverseTable is the table name for the AttestationCollection entity. |
| 45 |
// It exists in this package in order to avoid circular dependency with the "attestationcollection" package. |
| 46 |
AttestationCollectionsInverseTable = "attestation_collections" |
| 47 |
// AttestationCollectionsColumn is the table column denoting the attestation_collections relation/edge. |
| 48 |
AttestationCollectionsColumn = "statement_attestation_collections" |
| 49 |
// DsseTable is the table that holds the dsse relation/edge. |
| 50 |
DsseTable = "dsses" |
| 51 |
// DsseInverseTable is the table name for the Dsse entity. |
| 52 |
// It exists in this package in order to avoid circular dependency with the "dsse" package. |
| 53 |
DsseInverseTable = "dsses" |
| 54 |
// DsseColumn is the table column denoting the dsse relation/edge. |
| 55 |
DsseColumn = "dsse_statement" |
| 56 |
) |
| 57 |
|
| 58 |
// Columns holds all SQL columns for statement fields. |
| 59 |
var Columns = []string{ |
| 60 |
FieldID, |
| 61 |
FieldPredicate, |
| 62 |
} |
| 63 |
|
| 64 |
// ValidColumn reports if the column name is valid (part of the table columns). |
| 65 |
func ValidColumn(column string) bool { |
| 66 |
for i := range Columns { |
| 67 |
if column == Columns[i] { |
| 68 |
return true |
| 69 |
} |
| 70 |
} |
| 71 |
return false |
| 72 |
} |
| 73 |
|
| 74 |
var ( |
| 75 |
// PredicateValidator is a validator for the "predicate" field. It is called by the builders before save. |
| 76 |
PredicateValidator func(string) error |
| 77 |
// DefaultID holds the default value on creation for the "id" field. |
| 78 |
DefaultID func() uuid.UUID |
| 79 |
) |
| 80 |
|
| 81 |
// OrderOption defines the ordering options for the Statement queries. |
| 82 |
type OrderOption func(*sql.Selector) |
| 83 |
|
| 84 |
// ByID orders the results by the id field. |
| 85 |
func ByID(opts ...sql.OrderTermOption) OrderOption { |
| 86 |
return sql.OrderByField(FieldID, opts...).ToFunc() |
| 87 |
} |
| 88 |
|
| 89 |
// ByPredicate orders the results by the predicate field. |
| 90 |
func ByPredicate(opts ...sql.OrderTermOption) OrderOption { |
| 91 |
return sql.OrderByField(FieldPredicate, opts...).ToFunc() |
| 92 |
} |
| 93 |
|
| 94 |
// BySubjectsCount orders the results by subjects count. |
| 95 |
func BySubjectsCount(opts ...sql.OrderTermOption) OrderOption { |
| 96 |
return func(s *sql.Selector) { |
| 97 |
sqlgraph.OrderByNeighborsCount(s, newSubjectsStep(), opts...) |
| 98 |
} |
| 99 |
} |
| 100 |
|
| 101 |
// BySubjects orders the results by subjects terms. |
| 102 |
func BySubjects(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { |
| 103 |
return func(s *sql.Selector) { |
| 104 |
sqlgraph.OrderByNeighborTerms(s, newSubjectsStep(), append([]sql.OrderTerm{term}, terms...)...) |
| 105 |
} |
| 106 |
} |
| 107 |
|
| 108 |
// ByPolicyField orders the results by policy field. |
| 109 |
func ByPolicyField(field string, opts ...sql.OrderTermOption) OrderOption { |
| 110 |
return func(s *sql.Selector) { |
| 111 |
sqlgraph.OrderByNeighborTerms(s, newPolicyStep(), sql.OrderByField(field, opts...)) |
| 112 |
} |
| 113 |
} |
| 114 |
|
| 115 |
// ByAttestationCollectionsField orders the results by attestation_collections field. |
| 116 |
func ByAttestationCollectionsField(field string, opts ...sql.OrderTermOption) OrderOption { |
| 117 |
return func(s *sql.Selector) { |
| 118 |
sqlgraph.OrderByNeighborTerms(s, newAttestationCollectionsStep(), sql.OrderByField(field, opts...)) |
| 119 |
} |
| 120 |
} |
| 121 |
|
| 122 |
// ByDsseCount orders the results by dsse count. |
| 123 |
func ByDsseCount(opts ...sql.OrderTermOption) OrderOption { |
| 124 |
return func(s *sql.Selector) { |
| 125 |
sqlgraph.OrderByNeighborsCount(s, newDsseStep(), opts...) |
| 126 |
} |
| 127 |
} |
| 128 |
|
| 129 |
// ByDsse orders the results by dsse terms. |
| 130 |
func ByDsse(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { |
| 131 |
return func(s *sql.Selector) { |
| 132 |
sqlgraph.OrderByNeighborTerms(s, newDsseStep(), append([]sql.OrderTerm{term}, terms...)...) |
| 133 |
} |
| 134 |
} |
| 135 |
func newSubjectsStep() *sqlgraph.Step { |
| 136 |
return sqlgraph.NewStep( |
| 137 |
sqlgraph.From(Table, FieldID), |
| 138 |
sqlgraph.To(SubjectsInverseTable, FieldID), |
| 139 |
sqlgraph.Edge(sqlgraph.O2M, false, SubjectsTable, SubjectsColumn), |
| 140 |
) |
| 141 |
} |
| 142 |
func newPolicyStep() *sqlgraph.Step { |
| 143 |
return sqlgraph.NewStep( |
| 144 |
sqlgraph.From(Table, FieldID), |
| 145 |
sqlgraph.To(PolicyInverseTable, FieldID), |
| 146 |
sqlgraph.Edge(sqlgraph.O2O, false, PolicyTable, PolicyColumn), |
| 147 |
) |
| 148 |
} |
| 149 |
func newAttestationCollectionsStep() *sqlgraph.Step { |
| 150 |
return sqlgraph.NewStep( |
| 151 |
sqlgraph.From(Table, FieldID), |
| 152 |
sqlgraph.To(AttestationCollectionsInverseTable, FieldID), |
| 153 |
sqlgraph.Edge(sqlgraph.O2O, false, AttestationCollectionsTable, AttestationCollectionsColumn), |
| 154 |
) |
| 155 |
} |
| 156 |
func newDsseStep() *sqlgraph.Step { |
| 157 |
return sqlgraph.NewStep( |
| 158 |
sqlgraph.From(Table, FieldID), |
| 159 |
sqlgraph.To(DsseInverseTable, FieldID), |
| 160 |
sqlgraph.Edge(sqlgraph.O2M, true, DsseTable, DsseColumn), |
| 161 |
) |
| 162 |
} |