Debian Codegraph @

ent/dsse/dsse.go

raw
1 // Code generated by ent, DO NOT EDIT.
2
3 package dsse
4
5 import (
6 "time"
7
8 "entgo.io/ent/dialect/sql"
9 "entgo.io/ent/dialect/sql/sqlgraph"
10 "github.com/google/uuid"
11 )
12
13 const (
14 // Label holds the string label denoting the dsse type in the database.
15 Label = "dsse"
16 // FieldID holds the string denoting the id field in the database.
17 FieldID = "id"
18 // FieldCreatedAt holds the string denoting the created_at field in the database.
19 FieldCreatedAt = "created_at"
20 // FieldGitoidSha256 holds the string denoting the gitoid_sha256 field in the database.
21 FieldGitoidSha256 = "gitoid_sha256"
22 // FieldPayloadType holds the string denoting the payload_type field in the database.
23 FieldPayloadType = "payload_type"
24 // EdgeStatement holds the string denoting the statement edge name in mutations.
25 EdgeStatement = "statement"
26 // EdgeSignatures holds the string denoting the signatures edge name in mutations.
27 EdgeSignatures = "signatures"
28 // EdgePayloadDigests holds the string denoting the payload_digests edge name in mutations.
29 EdgePayloadDigests = "payload_digests"
30 // Table holds the table name of the dsse in the database.
31 Table = "dsses"
32 // StatementTable is the table that holds the statement relation/edge.
33 StatementTable = "dsses"
34 // StatementInverseTable is the table name for the Statement entity.
35 // It exists in this package in order to avoid circular dependency with the "statement" package.
36 StatementInverseTable = "statements"
37 // StatementColumn is the table column denoting the statement relation/edge.
38 StatementColumn = "dsse_statement"
39 // SignaturesTable is the table that holds the signatures relation/edge.
40 SignaturesTable = "signatures"
41 // SignaturesInverseTable is the table name for the Signature entity.
42 // It exists in this package in order to avoid circular dependency with the "signature" package.
43 SignaturesInverseTable = "signatures"
44 // SignaturesColumn is the table column denoting the signatures relation/edge.
45 SignaturesColumn = "dsse_signatures"
46 // PayloadDigestsTable is the table that holds the payload_digests relation/edge.
47 PayloadDigestsTable = "payload_digests"
48 // PayloadDigestsInverseTable is the table name for the PayloadDigest entity.
49 // It exists in this package in order to avoid circular dependency with the "payloaddigest" package.
50 PayloadDigestsInverseTable = "payload_digests"
51 // PayloadDigestsColumn is the table column denoting the payload_digests relation/edge.
52 PayloadDigestsColumn = "dsse_payload_digests"
53 )
54
55 // Columns holds all SQL columns for dsse fields.
56 var Columns = []string{
57 FieldID,
58 FieldCreatedAt,
59 FieldGitoidSha256,
60 FieldPayloadType,
61 }
62
63 // ForeignKeys holds the SQL foreign-keys that are owned by the "dsses"
64 // table and are not defined as standalone fields in the schema.
65 var ForeignKeys = []string{
66 "dsse_statement",
67 }
68
69 // ValidColumn reports if the column name is valid (part of the table columns).
70 func ValidColumn(column string) bool {
71 for i := range Columns {
72 if column == Columns[i] {
73 return true
74 }
75 }
76 for i := range ForeignKeys {
77 if column == ForeignKeys[i] {
78 return true
79 }
80 }
81 return false
82 }
83
84 var (
85 // DefaultCreatedAt holds the default value on creation for the "created_at" field.
86 DefaultCreatedAt func() time.Time
87 // GitoidSha256Validator is a validator for the "gitoid_sha256" field. It is called by the builders before save.
88 GitoidSha256Validator func(string) error
89 // PayloadTypeValidator is a validator for the "payload_type" field. It is called by the builders before save.
90 PayloadTypeValidator func(string) error
91 // DefaultID holds the default value on creation for the "id" field.
92 DefaultID func() uuid.UUID
93 )
94
95 // OrderOption defines the ordering options for the Dsse queries.
96 type OrderOption func(*sql.Selector)
97
98 // ByID orders the results by the id field.
99 func ByID(opts ...sql.OrderTermOption) OrderOption {
100 return sql.OrderByField(FieldID, opts...).ToFunc()
101 }
102
103 // ByCreatedAt orders the results by the created_at field.
104 func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
105 return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
106 }
107
108 // ByGitoidSha256 orders the results by the gitoid_sha256 field.
109 func ByGitoidSha256(opts ...sql.OrderTermOption) OrderOption {
110 return sql.OrderByField(FieldGitoidSha256, opts...).ToFunc()
111 }
112
113 // ByPayloadType orders the results by the payload_type field.
114 func ByPayloadType(opts ...sql.OrderTermOption) OrderOption {
115 return sql.OrderByField(FieldPayloadType, opts...).ToFunc()
116 }
117
118 // ByStatementField orders the results by statement field.
119 func ByStatementField(field string, opts ...sql.OrderTermOption) OrderOption {
120 return func(s *sql.Selector) {
121 sqlgraph.OrderByNeighborTerms(s, newStatementStep(), sql.OrderByField(field, opts...))
122 }
123 }
124
125 // BySignaturesCount orders the results by signatures count.
126 func BySignaturesCount(opts ...sql.OrderTermOption) OrderOption {
127 return func(s *sql.Selector) {
128 sqlgraph.OrderByNeighborsCount(s, newSignaturesStep(), opts...)
129 }
130 }
131
132 // BySignatures orders the results by signatures terms.
133 func BySignatures(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
134 return func(s *sql.Selector) {
135 sqlgraph.OrderByNeighborTerms(s, newSignaturesStep(), append([]sql.OrderTerm{term}, terms...)...)
136 }
137 }
138
139 // ByPayloadDigestsCount orders the results by payload_digests count.
140 func ByPayloadDigestsCount(opts ...sql.OrderTermOption) OrderOption {
141 return func(s *sql.Selector) {
142 sqlgraph.OrderByNeighborsCount(s, newPayloadDigestsStep(), opts...)
143 }
144 }
145
146 // ByPayloadDigests orders the results by payload_digests terms.
147 func ByPayloadDigests(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
148 return func(s *sql.Selector) {
149 sqlgraph.OrderByNeighborTerms(s, newPayloadDigestsStep(), append([]sql.OrderTerm{term}, terms...)...)
150 }
151 }
152 func newStatementStep() *sqlgraph.Step {
153 return sqlgraph.NewStep(
154 sqlgraph.From(Table, FieldID),
155 sqlgraph.To(StatementInverseTable, FieldID),
156 sqlgraph.Edge(sqlgraph.M2O, false, StatementTable, StatementColumn),
157 )
158 }
159 func newSignaturesStep() *sqlgraph.Step {
160 return sqlgraph.NewStep(
161 sqlgraph.From(Table, FieldID),
162 sqlgraph.To(SignaturesInverseTable, FieldID),
163 sqlgraph.Edge(sqlgraph.O2M, false, SignaturesTable, SignaturesColumn),
164 )
165 }
166 func newPayloadDigestsStep() *sqlgraph.Step {
167 return sqlgraph.NewStep(
168 sqlgraph.From(Table, FieldID),
169 sqlgraph.To(PayloadDigestsInverseTable, FieldID),
170 sqlgraph.Edge(sqlgraph.O2M, false, PayloadDigestsTable, PayloadDigestsColumn),
171 )
172 }