| 1 |
// Code generated by ent, DO NOT EDIT. |
| 2 |
|
| 3 |
package ent |
| 4 |
|
| 5 |
import ( |
| 6 |
"errors" |
| 7 |
"fmt" |
| 8 |
"time" |
| 9 |
|
| 10 |
"github.com/google/uuid" |
| 11 |
"github.com/in-toto/archivista/ent/attestation" |
| 12 |
"github.com/in-toto/archivista/ent/attestationcollection" |
| 13 |
"github.com/in-toto/archivista/ent/attestationpolicy" |
| 14 |
"github.com/in-toto/archivista/ent/dsse" |
| 15 |
"github.com/in-toto/archivista/ent/payloaddigest" |
| 16 |
"github.com/in-toto/archivista/ent/predicate" |
| 17 |
"github.com/in-toto/archivista/ent/signature" |
| 18 |
"github.com/in-toto/archivista/ent/statement" |
| 19 |
"github.com/in-toto/archivista/ent/subject" |
| 20 |
"github.com/in-toto/archivista/ent/subjectdigest" |
| 21 |
"github.com/in-toto/archivista/ent/timestamp" |
| 22 |
) |
| 23 |
|
| 24 |
// AttestationWhereInput represents a where input for filtering Attestation queries. |
| 25 |
type AttestationWhereInput struct { |
| 26 |
Predicates []predicate.Attestation `json:"-"` |
| 27 |
Not *AttestationWhereInput `json:"not,omitempty"` |
| 28 |
Or []*AttestationWhereInput `json:"or,omitempty"` |
| 29 |
And []*AttestationWhereInput `json:"and,omitempty"` |
| 30 |
|
| 31 |
// "id" field predicates. |
| 32 |
ID *uuid.UUID `json:"id,omitempty"` |
| 33 |
IDNEQ *uuid.UUID `json:"idNEQ,omitempty"` |
| 34 |
IDIn []uuid.UUID `json:"idIn,omitempty"` |
| 35 |
IDNotIn []uuid.UUID `json:"idNotIn,omitempty"` |
| 36 |
IDGT *uuid.UUID `json:"idGT,omitempty"` |
| 37 |
IDGTE *uuid.UUID `json:"idGTE,omitempty"` |
| 38 |
IDLT *uuid.UUID `json:"idLT,omitempty"` |
| 39 |
IDLTE *uuid.UUID `json:"idLTE,omitempty"` |
| 40 |
|
| 41 |
// "type" field predicates. |
| 42 |
Type *string `json:"type,omitempty"` |
| 43 |
TypeNEQ *string `json:"typeNEQ,omitempty"` |
| 44 |
TypeIn []string `json:"typeIn,omitempty"` |
| 45 |
TypeNotIn []string `json:"typeNotIn,omitempty"` |
| 46 |
TypeGT *string `json:"typeGT,omitempty"` |
| 47 |
TypeGTE *string `json:"typeGTE,omitempty"` |
| 48 |
TypeLT *string `json:"typeLT,omitempty"` |
| 49 |
TypeLTE *string `json:"typeLTE,omitempty"` |
| 50 |
TypeContains *string `json:"typeContains,omitempty"` |
| 51 |
TypeHasPrefix *string `json:"typeHasPrefix,omitempty"` |
| 52 |
TypeHasSuffix *string `json:"typeHasSuffix,omitempty"` |
| 53 |
TypeEqualFold *string `json:"typeEqualFold,omitempty"` |
| 54 |
TypeContainsFold *string `json:"typeContainsFold,omitempty"` |
| 55 |
|
| 56 |
// "attestation_collection" edge predicates. |
| 57 |
HasAttestationCollection *bool `json:"hasAttestationCollection,omitempty"` |
| 58 |
HasAttestationCollectionWith []*AttestationCollectionWhereInput `json:"hasAttestationCollectionWith,omitempty"` |
| 59 |
} |
| 60 |
|
| 61 |
// AddPredicates adds custom predicates to the where input to be used during the filtering phase. |
| 62 |
func (i *AttestationWhereInput) AddPredicates(predicates ...predicate.Attestation) { |
| 63 |
i.Predicates = append(i.Predicates, predicates...) |
| 64 |
} |
| 65 |
|
| 66 |
// Filter applies the AttestationWhereInput filter on the AttestationQuery builder. |
| 67 |
func (i *AttestationWhereInput) Filter(q *AttestationQuery) (*AttestationQuery, error) { |
| 68 |
if i == nil { |
| 69 |
return q, nil |
| 70 |
} |
| 71 |
p, err := i.P() |
| 72 |
if err != nil { |
| 73 |
if err == ErrEmptyAttestationWhereInput { |
| 74 |
return q, nil |
| 75 |
} |
| 76 |
return nil, err |
| 77 |
} |
| 78 |
return q.Where(p), nil |
| 79 |
} |
| 80 |
|
| 81 |
// ErrEmptyAttestationWhereInput is returned in case the AttestationWhereInput is empty. |
| 82 |
var ErrEmptyAttestationWhereInput = errors.New("ent: empty predicate AttestationWhereInput") |
| 83 |
|
| 84 |
// P returns a predicate for filtering attestations. |
| 85 |
// An error is returned if the input is empty or invalid. |
| 86 |
func (i *AttestationWhereInput) P() (predicate.Attestation, error) { |
| 87 |
var predicates []predicate.Attestation |
| 88 |
if i.Not != nil { |
| 89 |
p, err := i.Not.P() |
| 90 |
if err != nil { |
| 91 |
return nil, fmt.Errorf("%w: field 'not'", err) |
| 92 |
} |
| 93 |
predicates = append(predicates, attestation.Not(p)) |
| 94 |
} |
| 95 |
switch n := len(i.Or); { |
| 96 |
case n == 1: |
| 97 |
p, err := i.Or[0].P() |
| 98 |
if err != nil { |
| 99 |
return nil, fmt.Errorf("%w: field 'or'", err) |
| 100 |
} |
| 101 |
predicates = append(predicates, p) |
| 102 |
case n > 1: |
| 103 |
or := make([]predicate.Attestation, 0, n) |
| 104 |
for _, w := range i.Or { |
| 105 |
p, err := w.P() |
| 106 |
if err != nil { |
| 107 |
return nil, fmt.Errorf("%w: field 'or'", err) |
| 108 |
} |
| 109 |
or = append(or, p) |
| 110 |
} |
| 111 |
predicates = append(predicates, attestation.Or(or...)) |
| 112 |
} |
| 113 |
switch n := len(i.And); { |
| 114 |
case n == 1: |
| 115 |
p, err := i.And[0].P() |
| 116 |
if err != nil { |
| 117 |
return nil, fmt.Errorf("%w: field 'and'", err) |
| 118 |
} |
| 119 |
predicates = append(predicates, p) |
| 120 |
case n > 1: |
| 121 |
and := make([]predicate.Attestation, 0, n) |
| 122 |
for _, w := range i.And { |
| 123 |
p, err := w.P() |
| 124 |
if err != nil { |
| 125 |
return nil, fmt.Errorf("%w: field 'and'", err) |
| 126 |
} |
| 127 |
and = append(and, p) |
| 128 |
} |
| 129 |
predicates = append(predicates, attestation.And(and...)) |
| 130 |
} |
| 131 |
predicates = append(predicates, i.Predicates...) |
| 132 |
if i.ID != nil { |
| 133 |
predicates = append(predicates, attestation.IDEQ(*i.ID)) |
| 134 |
} |
| 135 |
if i.IDNEQ != nil { |
| 136 |
predicates = append(predicates, attestation.IDNEQ(*i.IDNEQ)) |
| 137 |
} |
| 138 |
if len(i.IDIn) > 0 { |
| 139 |
predicates = append(predicates, attestation.IDIn(i.IDIn...)) |
| 140 |
} |
| 141 |
if len(i.IDNotIn) > 0 { |
| 142 |
predicates = append(predicates, attestation.IDNotIn(i.IDNotIn...)) |
| 143 |
} |
| 144 |
if i.IDGT != nil { |
| 145 |
predicates = append(predicates, attestation.IDGT(*i.IDGT)) |
| 146 |
} |
| 147 |
if i.IDGTE != nil { |
| 148 |
predicates = append(predicates, attestation.IDGTE(*i.IDGTE)) |
| 149 |
} |
| 150 |
if i.IDLT != nil { |
| 151 |
predicates = append(predicates, attestation.IDLT(*i.IDLT)) |
| 152 |
} |
| 153 |
if i.IDLTE != nil { |
| 154 |
predicates = append(predicates, attestation.IDLTE(*i.IDLTE)) |
| 155 |
} |
| 156 |
if i.Type != nil { |
| 157 |
predicates = append(predicates, attestation.TypeEQ(*i.Type)) |
| 158 |
} |
| 159 |
if i.TypeNEQ != nil { |
| 160 |
predicates = append(predicates, attestation.TypeNEQ(*i.TypeNEQ)) |
| 161 |
} |
| 162 |
if len(i.TypeIn) > 0 { |
| 163 |
predicates = append(predicates, attestation.TypeIn(i.TypeIn...)) |
| 164 |
} |
| 165 |
if len(i.TypeNotIn) > 0 { |
| 166 |
predicates = append(predicates, attestation.TypeNotIn(i.TypeNotIn...)) |
| 167 |
} |
| 168 |
if i.TypeGT != nil { |
| 169 |
predicates = append(predicates, attestation.TypeGT(*i.TypeGT)) |
| 170 |
} |
| 171 |
if i.TypeGTE != nil { |
| 172 |
predicates = append(predicates, attestation.TypeGTE(*i.TypeGTE)) |
| 173 |
} |
| 174 |
if i.TypeLT != nil { |
| 175 |
predicates = append(predicates, attestation.TypeLT(*i.TypeLT)) |
| 176 |
} |
| 177 |
if i.TypeLTE != nil { |
| 178 |
predicates = append(predicates, attestation.TypeLTE(*i.TypeLTE)) |
| 179 |
} |
| 180 |
if i.TypeContains != nil { |
| 181 |
predicates = append(predicates, attestation.TypeContains(*i.TypeContains)) |
| 182 |
} |
| 183 |
if i.TypeHasPrefix != nil { |
| 184 |
predicates = append(predicates, attestation.TypeHasPrefix(*i.TypeHasPrefix)) |
| 185 |
} |
| 186 |
if i.TypeHasSuffix != nil { |
| 187 |
predicates = append(predicates, attestation.TypeHasSuffix(*i.TypeHasSuffix)) |
| 188 |
} |
| 189 |
if i.TypeEqualFold != nil { |
| 190 |
predicates = append(predicates, attestation.TypeEqualFold(*i.TypeEqualFold)) |
| 191 |
} |
| 192 |
if i.TypeContainsFold != nil { |
| 193 |
predicates = append(predicates, attestation.TypeContainsFold(*i.TypeContainsFold)) |
| 194 |
} |
| 195 |
|
| 196 |
if i.HasAttestationCollection != nil { |
| 197 |
p := attestation.HasAttestationCollection() |
| 198 |
if !*i.HasAttestationCollection { |
| 199 |
p = attestation.Not(p) |
| 200 |
} |
| 201 |
predicates = append(predicates, p) |
| 202 |
} |
| 203 |
if len(i.HasAttestationCollectionWith) > 0 { |
| 204 |
with := make([]predicate.AttestationCollection, 0, len(i.HasAttestationCollectionWith)) |
| 205 |
for _, w := range i.HasAttestationCollectionWith { |
| 206 |
p, err := w.P() |
| 207 |
if err != nil { |
| 208 |
return nil, fmt.Errorf("%w: field 'HasAttestationCollectionWith'", err) |
| 209 |
} |
| 210 |
with = append(with, p) |
| 211 |
} |
| 212 |
predicates = append(predicates, attestation.HasAttestationCollectionWith(with...)) |
| 213 |
} |
| 214 |
switch len(predicates) { |
| 215 |
case 0: |
| 216 |
return nil, ErrEmptyAttestationWhereInput |
| 217 |
case 1: |
| 218 |
return predicates[0], nil |
| 219 |
default: |
| 220 |
return attestation.And(predicates...), nil |
| 221 |
} |
| 222 |
} |
| 223 |
|
| 224 |
// AttestationCollectionWhereInput represents a where input for filtering AttestationCollection queries. |
| 225 |
type AttestationCollectionWhereInput struct { |
| 226 |
Predicates []predicate.AttestationCollection `json:"-"` |
| 227 |
Not *AttestationCollectionWhereInput `json:"not,omitempty"` |
| 228 |
Or []*AttestationCollectionWhereInput `json:"or,omitempty"` |
| 229 |
And []*AttestationCollectionWhereInput `json:"and,omitempty"` |
| 230 |
|
| 231 |
// "id" field predicates. |
| 232 |
ID *uuid.UUID `json:"id,omitempty"` |
| 233 |
IDNEQ *uuid.UUID `json:"idNEQ,omitempty"` |
| 234 |
IDIn []uuid.UUID `json:"idIn,omitempty"` |
| 235 |
IDNotIn []uuid.UUID `json:"idNotIn,omitempty"` |
| 236 |
IDGT *uuid.UUID `json:"idGT,omitempty"` |
| 237 |
IDGTE *uuid.UUID `json:"idGTE,omitempty"` |
| 238 |
IDLT *uuid.UUID `json:"idLT,omitempty"` |
| 239 |
IDLTE *uuid.UUID `json:"idLTE,omitempty"` |
| 240 |
|
| 241 |
// "name" field predicates. |
| 242 |
Name *string `json:"name,omitempty"` |
| 243 |
NameNEQ *string `json:"nameNEQ,omitempty"` |
| 244 |
NameIn []string `json:"nameIn,omitempty"` |
| 245 |
NameNotIn []string `json:"nameNotIn,omitempty"` |
| 246 |
NameGT *string `json:"nameGT,omitempty"` |
| 247 |
NameGTE *string `json:"nameGTE,omitempty"` |
| 248 |
NameLT *string `json:"nameLT,omitempty"` |
| 249 |
NameLTE *string `json:"nameLTE,omitempty"` |
| 250 |
NameContains *string `json:"nameContains,omitempty"` |
| 251 |
NameHasPrefix *string `json:"nameHasPrefix,omitempty"` |
| 252 |
NameHasSuffix *string `json:"nameHasSuffix,omitempty"` |
| 253 |
NameEqualFold *string `json:"nameEqualFold,omitempty"` |
| 254 |
NameContainsFold *string `json:"nameContainsFold,omitempty"` |
| 255 |
|
| 256 |
// "attestations" edge predicates. |
| 257 |
HasAttestations *bool `json:"hasAttestations,omitempty"` |
| 258 |
HasAttestationsWith []*AttestationWhereInput `json:"hasAttestationsWith,omitempty"` |
| 259 |
|
| 260 |
// "statement" edge predicates. |
| 261 |
HasStatement *bool `json:"hasStatement,omitempty"` |
| 262 |
HasStatementWith []*StatementWhereInput `json:"hasStatementWith,omitempty"` |
| 263 |
} |
| 264 |
|
| 265 |
// AddPredicates adds custom predicates to the where input to be used during the filtering phase. |
| 266 |
func (i *AttestationCollectionWhereInput) AddPredicates(predicates ...predicate.AttestationCollection) { |
| 267 |
i.Predicates = append(i.Predicates, predicates...) |
| 268 |
} |
| 269 |
|
| 270 |
// Filter applies the AttestationCollectionWhereInput filter on the AttestationCollectionQuery builder. |
| 271 |
func (i *AttestationCollectionWhereInput) Filter(q *AttestationCollectionQuery) (*AttestationCollectionQuery, error) { |
| 272 |
if i == nil { |
| 273 |
return q, nil |
| 274 |
} |
| 275 |
p, err := i.P() |
| 276 |
if err != nil { |
| 277 |
if err == ErrEmptyAttestationCollectionWhereInput { |
| 278 |
return q, nil |
| 279 |
} |
| 280 |
return nil, err |
| 281 |
} |
| 282 |
return q.Where(p), nil |
| 283 |
} |
| 284 |
|
| 285 |
// ErrEmptyAttestationCollectionWhereInput is returned in case the AttestationCollectionWhereInput is empty. |
| 286 |
var ErrEmptyAttestationCollectionWhereInput = errors.New("ent: empty predicate AttestationCollectionWhereInput") |
| 287 |
|
| 288 |
// P returns a predicate for filtering attestationcollections. |
| 289 |
// An error is returned if the input is empty or invalid. |
| 290 |
func (i *AttestationCollectionWhereInput) P() (predicate.AttestationCollection, error) { |
| 291 |
var predicates []predicate.AttestationCollection |
| 292 |
if i.Not != nil { |
| 293 |
p, err := i.Not.P() |
| 294 |
if err != nil { |
| 295 |
return nil, fmt.Errorf("%w: field 'not'", err) |
| 296 |
} |
| 297 |
predicates = append(predicates, attestationcollection.Not(p)) |
| 298 |
} |
| 299 |
switch n := len(i.Or); { |
| 300 |
case n == 1: |
| 301 |
p, err := i.Or[0].P() |
| 302 |
if err != nil { |
| 303 |
return nil, fmt.Errorf("%w: field 'or'", err) |
| 304 |
} |
| 305 |
predicates = append(predicates, p) |
| 306 |
case n > 1: |
| 307 |
or := make([]predicate.AttestationCollection, 0, n) |
| 308 |
for _, w := range i.Or { |
| 309 |
p, err := w.P() |
| 310 |
if err != nil { |
| 311 |
return nil, fmt.Errorf("%w: field 'or'", err) |
| 312 |
} |
| 313 |
or = append(or, p) |
| 314 |
} |
| 315 |
predicates = append(predicates, attestationcollection.Or(or...)) |
| 316 |
} |
| 317 |
switch n := len(i.And); { |
| 318 |
case n == 1: |
| 319 |
p, err := i.And[0].P() |
| 320 |
if err != nil { |
| 321 |
return nil, fmt.Errorf("%w: field 'and'", err) |
| 322 |
} |
| 323 |
predicates = append(predicates, p) |
| 324 |
case n > 1: |
| 325 |
and := make([]predicate.AttestationCollection, 0, n) |
| 326 |
for _, w := range i.And { |
| 327 |
p, err := w.P() |
| 328 |
if err != nil { |
| 329 |
return nil, fmt.Errorf("%w: field 'and'", err) |
| 330 |
} |
| 331 |
and = append(and, p) |
| 332 |
} |
| 333 |
predicates = append(predicates, attestationcollection.And(and...)) |
| 334 |
} |
| 335 |
predicates = append(predicates, i.Predicates...) |
| 336 |
if i.ID != nil { |
| 337 |
predicates = append(predicates, attestationcollection.IDEQ(*i.ID)) |
| 338 |
} |
| 339 |
if i.IDNEQ != nil { |
| 340 |
predicates = append(predicates, attestationcollection.IDNEQ(*i.IDNEQ)) |
| 341 |
} |
| 342 |
if len(i.IDIn) > 0 { |
| 343 |
predicates = append(predicates, attestationcollection.IDIn(i.IDIn...)) |
| 344 |
} |
| 345 |
if len(i.IDNotIn) > 0 { |
| 346 |
predicates = append(predicates, attestationcollection.IDNotIn(i.IDNotIn...)) |
| 347 |
} |
| 348 |
if i.IDGT != nil { |
| 349 |
predicates = append(predicates, attestationcollection.IDGT(*i.IDGT)) |
| 350 |
} |
| 351 |
if i.IDGTE != nil { |
| 352 |
predicates = append(predicates, attestationcollection.IDGTE(*i.IDGTE)) |
| 353 |
} |
| 354 |
if i.IDLT != nil { |
| 355 |
predicates = append(predicates, attestationcollection.IDLT(*i.IDLT)) |
| 356 |
} |
| 357 |
if i.IDLTE != nil { |
| 358 |
predicates = append(predicates, attestationcollection.IDLTE(*i.IDLTE)) |
| 359 |
} |
| 360 |
if i.Name != nil { |
| 361 |
predicates = append(predicates, attestationcollection.NameEQ(*i.Name)) |
| 362 |
} |
| 363 |
if i.NameNEQ != nil { |
| 364 |
predicates = append(predicates, attestationcollection.NameNEQ(*i.NameNEQ)) |
| 365 |
} |
| 366 |
if len(i.NameIn) > 0 { |
| 367 |
predicates = append(predicates, attestationcollection.NameIn(i.NameIn...)) |
| 368 |
} |
| 369 |
if len(i.NameNotIn) > 0 { |
| 370 |
predicates = append(predicates, attestationcollection.NameNotIn(i.NameNotIn...)) |
| 371 |
} |
| 372 |
if i.NameGT != nil { |
| 373 |
predicates = append(predicates, attestationcollection.NameGT(*i.NameGT)) |
| 374 |
} |
| 375 |
if i.NameGTE != nil { |
| 376 |
predicates = append(predicates, attestationcollection.NameGTE(*i.NameGTE)) |
| 377 |
} |
| 378 |
if i.NameLT != nil { |
| 379 |
predicates = append(predicates, attestationcollection.NameLT(*i.NameLT)) |
| 380 |
} |
| 381 |
if i.NameLTE != nil { |
| 382 |
predicates = append(predicates, attestationcollection.NameLTE(*i.NameLTE)) |
| 383 |
} |
| 384 |
if i.NameContains != nil { |
| 385 |
predicates = append(predicates, attestationcollection.NameContains(*i.NameContains)) |
| 386 |
} |
| 387 |
if i.NameHasPrefix != nil { |
| 388 |
predicates = append(predicates, attestationcollection.NameHasPrefix(*i.NameHasPrefix)) |
| 389 |
} |
| 390 |
if i.NameHasSuffix != nil { |
| 391 |
predicates = append(predicates, attestationcollection.NameHasSuffix(*i.NameHasSuffix)) |
| 392 |
} |
| 393 |
if i.NameEqualFold != nil { |
| 394 |
predicates = append(predicates, attestationcollection.NameEqualFold(*i.NameEqualFold)) |
| 395 |
} |
| 396 |
if i.NameContainsFold != nil { |
| 397 |
predicates = append(predicates, attestationcollection.NameContainsFold(*i.NameContainsFold)) |
| 398 |
} |
| 399 |
|
| 400 |
if i.HasAttestations != nil { |
| 401 |
p := attestationcollection.HasAttestations() |
| 402 |
if !*i.HasAttestations { |
| 403 |
p = attestationcollection.Not(p) |
| 404 |
} |
| 405 |
predicates = append(predicates, p) |
| 406 |
} |
| 407 |
if len(i.HasAttestationsWith) > 0 { |
| 408 |
with := make([]predicate.Attestation, 0, len(i.HasAttestationsWith)) |
| 409 |
for _, w := range i.HasAttestationsWith { |
| 410 |
p, err := w.P() |
| 411 |
if err != nil { |
| 412 |
return nil, fmt.Errorf("%w: field 'HasAttestationsWith'", err) |
| 413 |
} |
| 414 |
with = append(with, p) |
| 415 |
} |
| 416 |
predicates = append(predicates, attestationcollection.HasAttestationsWith(with...)) |
| 417 |
} |
| 418 |
if i.HasStatement != nil { |
| 419 |
p := attestationcollection.HasStatement() |
| 420 |
if !*i.HasStatement { |
| 421 |
p = attestationcollection.Not(p) |
| 422 |
} |
| 423 |
predicates = append(predicates, p) |
| 424 |
} |
| 425 |
if len(i.HasStatementWith) > 0 { |
| 426 |
with := make([]predicate.Statement, 0, len(i.HasStatementWith)) |
| 427 |
for _, w := range i.HasStatementWith { |
| 428 |
p, err := w.P() |
| 429 |
if err != nil { |
| 430 |
return nil, fmt.Errorf("%w: field 'HasStatementWith'", err) |
| 431 |
} |
| 432 |
with = append(with, p) |
| 433 |
} |
| 434 |
predicates = append(predicates, attestationcollection.HasStatementWith(with...)) |
| 435 |
} |
| 436 |
switch len(predicates) { |
| 437 |
case 0: |
| 438 |
return nil, ErrEmptyAttestationCollectionWhereInput |
| 439 |
case 1: |
| 440 |
return predicates[0], nil |
| 441 |
default: |
| 442 |
return attestationcollection.And(predicates...), nil |
| 443 |
} |
| 444 |
} |
| 445 |
|
| 446 |
// AttestationPolicyWhereInput represents a where input for filtering AttestationPolicy queries. |
| 447 |
type AttestationPolicyWhereInput struct { |
| 448 |
Predicates []predicate.AttestationPolicy `json:"-"` |
| 449 |
Not *AttestationPolicyWhereInput `json:"not,omitempty"` |
| 450 |
Or []*AttestationPolicyWhereInput `json:"or,omitempty"` |
| 451 |
And []*AttestationPolicyWhereInput `json:"and,omitempty"` |
| 452 |
|
| 453 |
// "id" field predicates. |
| 454 |
ID *uuid.UUID `json:"id,omitempty"` |
| 455 |
IDNEQ *uuid.UUID `json:"idNEQ,omitempty"` |
| 456 |
IDIn []uuid.UUID `json:"idIn,omitempty"` |
| 457 |
IDNotIn []uuid.UUID `json:"idNotIn,omitempty"` |
| 458 |
IDGT *uuid.UUID `json:"idGT,omitempty"` |
| 459 |
IDGTE *uuid.UUID `json:"idGTE,omitempty"` |
| 460 |
IDLT *uuid.UUID `json:"idLT,omitempty"` |
| 461 |
IDLTE *uuid.UUID `json:"idLTE,omitempty"` |
| 462 |
|
| 463 |
// "name" field predicates. |
| 464 |
Name *string `json:"name,omitempty"` |
| 465 |
NameNEQ *string `json:"nameNEQ,omitempty"` |
| 466 |
NameIn []string `json:"nameIn,omitempty"` |
| 467 |
NameNotIn []string `json:"nameNotIn,omitempty"` |
| 468 |
NameGT *string `json:"nameGT,omitempty"` |
| 469 |
NameGTE *string `json:"nameGTE,omitempty"` |
| 470 |
NameLT *string `json:"nameLT,omitempty"` |
| 471 |
NameLTE *string `json:"nameLTE,omitempty"` |
| 472 |
NameContains *string `json:"nameContains,omitempty"` |
| 473 |
NameHasPrefix *string `json:"nameHasPrefix,omitempty"` |
| 474 |
NameHasSuffix *string `json:"nameHasSuffix,omitempty"` |
| 475 |
NameEqualFold *string `json:"nameEqualFold,omitempty"` |
| 476 |
NameContainsFold *string `json:"nameContainsFold,omitempty"` |
| 477 |
|
| 478 |
// "statement" edge predicates. |
| 479 |
HasStatement *bool `json:"hasStatement,omitempty"` |
| 480 |
HasStatementWith []*StatementWhereInput `json:"hasStatementWith,omitempty"` |
| 481 |
} |
| 482 |
|
| 483 |
// AddPredicates adds custom predicates to the where input to be used during the filtering phase. |
| 484 |
func (i *AttestationPolicyWhereInput) AddPredicates(predicates ...predicate.AttestationPolicy) { |
| 485 |
i.Predicates = append(i.Predicates, predicates...) |
| 486 |
} |
| 487 |
|
| 488 |
// Filter applies the AttestationPolicyWhereInput filter on the AttestationPolicyQuery builder. |
| 489 |
func (i *AttestationPolicyWhereInput) Filter(q *AttestationPolicyQuery) (*AttestationPolicyQuery, error) { |
| 490 |
if i == nil { |
| 491 |
return q, nil |
| 492 |
} |
| 493 |
p, err := i.P() |
| 494 |
if err != nil { |
| 495 |
if err == ErrEmptyAttestationPolicyWhereInput { |
| 496 |
return q, nil |
| 497 |
} |
| 498 |
return nil, err |
| 499 |
} |
| 500 |
return q.Where(p), nil |
| 501 |
} |
| 502 |
|
| 503 |
// ErrEmptyAttestationPolicyWhereInput is returned in case the AttestationPolicyWhereInput is empty. |
| 504 |
var ErrEmptyAttestationPolicyWhereInput = errors.New("ent: empty predicate AttestationPolicyWhereInput") |
| 505 |
|
| 506 |
// P returns a predicate for filtering attestationpolicies. |
| 507 |
// An error is returned if the input is empty or invalid. |
| 508 |
func (i *AttestationPolicyWhereInput) P() (predicate.AttestationPolicy, error) { |
| 509 |
var predicates []predicate.AttestationPolicy |
| 510 |
if i.Not != nil { |
| 511 |
p, err := i.Not.P() |
| 512 |
if err != nil { |
| 513 |
return nil, fmt.Errorf("%w: field 'not'", err) |
| 514 |
} |
| 515 |
predicates = append(predicates, attestationpolicy.Not(p)) |
| 516 |
} |
| 517 |
switch n := len(i.Or); { |
| 518 |
case n == 1: |
| 519 |
p, err := i.Or[0].P() |
| 520 |
if err != nil { |
| 521 |
return nil, fmt.Errorf("%w: field 'or'", err) |
| 522 |
} |
| 523 |
predicates = append(predicates, p) |
| 524 |
case n > 1: |
| 525 |
or := make([]predicate.AttestationPolicy, 0, n) |
| 526 |
for _, w := range i.Or { |
| 527 |
p, err := w.P() |
| 528 |
if err != nil { |
| 529 |
return nil, fmt.Errorf("%w: field 'or'", err) |
| 530 |
} |
| 531 |
or = append(or, p) |
| 532 |
} |
| 533 |
predicates = append(predicates, attestationpolicy.Or(or...)) |
| 534 |
} |
| 535 |
switch n := len(i.And); { |
| 536 |
case n == 1: |
| 537 |
p, err := i.And[0].P() |
| 538 |
if err != nil { |
| 539 |
return nil, fmt.Errorf("%w: field 'and'", err) |
| 540 |
} |
| 541 |
predicates = append(predicates, p) |
| 542 |
case n > 1: |
| 543 |
and := make([]predicate.AttestationPolicy, 0, n) |
| 544 |
for _, w := range i.And { |
| 545 |
p, err := w.P() |
| 546 |
if err != nil { |
| 547 |
return nil, fmt.Errorf("%w: field 'and'", err) |
| 548 |
} |
| 549 |
and = append(and, p) |
| 550 |
} |
| 551 |
predicates = append(predicates, attestationpolicy.And(and...)) |
| 552 |
} |
| 553 |
predicates = append(predicates, i.Predicates...) |
| 554 |
if i.ID != nil { |
| 555 |
predicates = append(predicates, attestationpolicy.IDEQ(*i.ID)) |
| 556 |
} |
| 557 |
if i.IDNEQ != nil { |
| 558 |
predicates = append(predicates, attestationpolicy.IDNEQ(*i.IDNEQ)) |
| 559 |
} |
| 560 |
if len(i.IDIn) > 0 { |
| 561 |
predicates = append(predicates, attestationpolicy.IDIn(i.IDIn...)) |
| 562 |
} |
| 563 |
if len(i.IDNotIn) > 0 { |
| 564 |
predicates = append(predicates, attestationpolicy.IDNotIn(i.IDNotIn...)) |
| 565 |
} |
| 566 |
if i.IDGT != nil { |
| 567 |
predicates = append(predicates, attestationpolicy.IDGT(*i.IDGT)) |
| 568 |
} |
| 569 |
if i.IDGTE != nil { |
| 570 |
predicates = append(predicates, attestationpolicy.IDGTE(*i.IDGTE)) |
| 571 |
} |
| 572 |
if i.IDLT != nil { |
| 573 |
predicates = append(predicates, attestationpolicy.IDLT(*i.IDLT)) |
| 574 |
} |
| 575 |
if i.IDLTE != nil { |
| 576 |
predicates = append(predicates, attestationpolicy.IDLTE(*i.IDLTE)) |
| 577 |
} |
| 578 |
if i.Name != nil { |
| 579 |
predicates = append(predicates, attestationpolicy.NameEQ(*i.Name)) |
| 580 |
} |
| 581 |
if i.NameNEQ != nil { |
| 582 |
predicates = append(predicates, attestationpolicy.NameNEQ(*i.NameNEQ)) |
| 583 |
} |
| 584 |
if len(i.NameIn) > 0 { |
| 585 |
predicates = append(predicates, attestationpolicy.NameIn(i.NameIn...)) |
| 586 |
} |
| 587 |
if len(i.NameNotIn) > 0 { |
| 588 |
predicates = append(predicates, attestationpolicy.NameNotIn(i.NameNotIn...)) |
| 589 |
} |
| 590 |
if i.NameGT != nil { |
| 591 |
predicates = append(predicates, attestationpolicy.NameGT(*i.NameGT)) |
| 592 |
} |
| 593 |
if i.NameGTE != nil { |
| 594 |
predicates = append(predicates, attestationpolicy.NameGTE(*i.NameGTE)) |
| 595 |
} |
| 596 |
if i.NameLT != nil { |
| 597 |
predicates = append(predicates, attestationpolicy.NameLT(*i.NameLT)) |
| 598 |
} |
| 599 |
if i.NameLTE != nil { |
| 600 |
predicates = append(predicates, attestationpolicy.NameLTE(*i.NameLTE)) |
| 601 |
} |
| 602 |
if i.NameContains != nil { |
| 603 |
predicates = append(predicates, attestationpolicy.NameContains(*i.NameContains)) |
| 604 |
} |
| 605 |
if i.NameHasPrefix != nil { |
| 606 |
predicates = append(predicates, attestationpolicy.NameHasPrefix(*i.NameHasPrefix)) |
| 607 |
} |
| 608 |
if i.NameHasSuffix != nil { |
| 609 |
predicates = append(predicates, attestationpolicy.NameHasSuffix(*i.NameHasSuffix)) |
| 610 |
} |
| 611 |
if i.NameEqualFold != nil { |
| 612 |
predicates = append(predicates, attestationpolicy.NameEqualFold(*i.NameEqualFold)) |
| 613 |
} |
| 614 |
if i.NameContainsFold != nil { |
| 615 |
predicates = append(predicates, attestationpolicy.NameContainsFold(*i.NameContainsFold)) |
| 616 |
} |
| 617 |
|
| 618 |
if i.HasStatement != nil { |
| 619 |
p := attestationpolicy.HasStatement() |
| 620 |
if !*i.HasStatement { |
| 621 |
p = attestationpolicy.Not(p) |
| 622 |
} |
| 623 |
predicates = append(predicates, p) |
| 624 |
} |
| 625 |
if len(i.HasStatementWith) > 0 { |
| 626 |
with := make([]predicate.Statement, 0, len(i.HasStatementWith)) |
| 627 |
for _, w := range i.HasStatementWith { |
| 628 |
p, err := w.P() |
| 629 |
if err != nil { |
| 630 |
return nil, fmt.Errorf("%w: field 'HasStatementWith'", err) |
| 631 |
} |
| 632 |
with = append(with, p) |
| 633 |
} |
| 634 |
predicates = append(predicates, attestationpolicy.HasStatementWith(with...)) |
| 635 |
} |
| 636 |
switch len(predicates) { |
| 637 |
case 0: |
| 638 |
return nil, ErrEmptyAttestationPolicyWhereInput |
| 639 |
case 1: |
| 640 |
return predicates[0], nil |
| 641 |
default: |
| 642 |
return attestationpolicy.And(predicates...), nil |
| 643 |
} |
| 644 |
} |
| 645 |
|
| 646 |
// DsseWhereInput represents a where input for filtering Dsse queries. |
| 647 |
type DsseWhereInput struct { |
| 648 |
Predicates []predicate.Dsse `json:"-"` |
| 649 |
Not *DsseWhereInput `json:"not,omitempty"` |
| 650 |
Or []*DsseWhereInput `json:"or,omitempty"` |
| 651 |
And []*DsseWhereInput `json:"and,omitempty"` |
| 652 |
|
| 653 |
// "id" field predicates. |
| 654 |
ID *uuid.UUID `json:"id,omitempty"` |
| 655 |
IDNEQ *uuid.UUID `json:"idNEQ,omitempty"` |
| 656 |
IDIn []uuid.UUID `json:"idIn,omitempty"` |
| 657 |
IDNotIn []uuid.UUID `json:"idNotIn,omitempty"` |
| 658 |
IDGT *uuid.UUID `json:"idGT,omitempty"` |
| 659 |
IDGTE *uuid.UUID `json:"idGTE,omitempty"` |
| 660 |
IDLT *uuid.UUID `json:"idLT,omitempty"` |
| 661 |
IDLTE *uuid.UUID `json:"idLTE,omitempty"` |
| 662 |
|
| 663 |
// "created_at" field predicates. |
| 664 |
CreatedAt *time.Time `json:"createdAt,omitempty"` |
| 665 |
CreatedAtNEQ *time.Time `json:"createdAtNEQ,omitempty"` |
| 666 |
CreatedAtIn []time.Time `json:"createdAtIn,omitempty"` |
| 667 |
CreatedAtNotIn []time.Time `json:"createdAtNotIn,omitempty"` |
| 668 |
CreatedAtGT *time.Time `json:"createdAtGT,omitempty"` |
| 669 |
CreatedAtGTE *time.Time `json:"createdAtGTE,omitempty"` |
| 670 |
CreatedAtLT *time.Time `json:"createdAtLT,omitempty"` |
| 671 |
CreatedAtLTE *time.Time `json:"createdAtLTE,omitempty"` |
| 672 |
CreatedAtIsNil bool `json:"createdAtIsNil,omitempty"` |
| 673 |
CreatedAtNotNil bool `json:"createdAtNotNil,omitempty"` |
| 674 |
|
| 675 |
// "gitoid_sha256" field predicates. |
| 676 |
GitoidSha256 *string `json:"gitoidSha256,omitempty"` |
| 677 |
GitoidSha256NEQ *string `json:"gitoidSha256NEQ,omitempty"` |
| 678 |
GitoidSha256In []string `json:"gitoidSha256In,omitempty"` |
| 679 |
GitoidSha256NotIn []string `json:"gitoidSha256NotIn,omitempty"` |
| 680 |
GitoidSha256GT *string `json:"gitoidSha256GT,omitempty"` |
| 681 |
GitoidSha256GTE *string `json:"gitoidSha256GTE,omitempty"` |
| 682 |
GitoidSha256LT *string `json:"gitoidSha256LT,omitempty"` |
| 683 |
GitoidSha256LTE *string `json:"gitoidSha256LTE,omitempty"` |
| 684 |
GitoidSha256Contains *string `json:"gitoidSha256Contains,omitempty"` |
| 685 |
GitoidSha256HasPrefix *string `json:"gitoidSha256HasPrefix,omitempty"` |
| 686 |
GitoidSha256HasSuffix *string `json:"gitoidSha256HasSuffix,omitempty"` |
| 687 |
GitoidSha256EqualFold *string `json:"gitoidSha256EqualFold,omitempty"` |
| 688 |
GitoidSha256ContainsFold *string `json:"gitoidSha256ContainsFold,omitempty"` |
| 689 |
|
| 690 |
// "payload_type" field predicates. |
| 691 |
PayloadType *string `json:"payloadType,omitempty"` |
| 692 |
PayloadTypeNEQ *string `json:"payloadTypeNEQ,omitempty"` |
| 693 |
PayloadTypeIn []string `json:"payloadTypeIn,omitempty"` |
| 694 |
PayloadTypeNotIn []string `json:"payloadTypeNotIn,omitempty"` |
| 695 |
PayloadTypeGT *string `json:"payloadTypeGT,omitempty"` |
| 696 |
PayloadTypeGTE *string `json:"payloadTypeGTE,omitempty"` |
| 697 |
PayloadTypeLT *string `json:"payloadTypeLT,omitempty"` |
| 698 |
PayloadTypeLTE *string `json:"payloadTypeLTE,omitempty"` |
| 699 |
PayloadTypeContains *string `json:"payloadTypeContains,omitempty"` |
| 700 |
PayloadTypeHasPrefix *string `json:"payloadTypeHasPrefix,omitempty"` |
| 701 |
PayloadTypeHasSuffix *string `json:"payloadTypeHasSuffix,omitempty"` |
| 702 |
PayloadTypeEqualFold *string `json:"payloadTypeEqualFold,omitempty"` |
| 703 |
PayloadTypeContainsFold *string `json:"payloadTypeContainsFold,omitempty"` |
| 704 |
|
| 705 |
// "statement" edge predicates. |
| 706 |
HasStatement *bool `json:"hasStatement,omitempty"` |
| 707 |
HasStatementWith []*StatementWhereInput `json:"hasStatementWith,omitempty"` |
| 708 |
|
| 709 |
// "signatures" edge predicates. |
| 710 |
HasSignatures *bool `json:"hasSignatures,omitempty"` |
| 711 |
HasSignaturesWith []*SignatureWhereInput `json:"hasSignaturesWith,omitempty"` |
| 712 |
|
| 713 |
// "payload_digests" edge predicates. |
| 714 |
HasPayloadDigests *bool `json:"hasPayloadDigests,omitempty"` |
| 715 |
HasPayloadDigestsWith []*PayloadDigestWhereInput `json:"hasPayloadDigestsWith,omitempty"` |
| 716 |
} |
| 717 |
|
| 718 |
// AddPredicates adds custom predicates to the where input to be used during the filtering phase. |
| 719 |
func (i *DsseWhereInput) AddPredicates(predicates ...predicate.Dsse) { |
| 720 |
i.Predicates = append(i.Predicates, predicates...) |
| 721 |
} |
| 722 |
|
| 723 |
// Filter applies the DsseWhereInput filter on the DsseQuery builder. |
| 724 |
func (i *DsseWhereInput) Filter(q *DsseQuery) (*DsseQuery, error) { |
| 725 |
if i == nil { |
| 726 |
return q, nil |
| 727 |
} |
| 728 |
p, err := i.P() |
| 729 |
if err != nil { |
| 730 |
if err == ErrEmptyDsseWhereInput { |
| 731 |
return q, nil |
| 732 |
} |
| 733 |
return nil, err |
| 734 |
} |
| 735 |
return q.Where(p), nil |
| 736 |
} |
| 737 |
|
| 738 |
// ErrEmptyDsseWhereInput is returned in case the DsseWhereInput is empty. |
| 739 |
var ErrEmptyDsseWhereInput = errors.New("ent: empty predicate DsseWhereInput") |
| 740 |
|
| 741 |
// P returns a predicate for filtering dsses. |
| 742 |
// An error is returned if the input is empty or invalid. |
| 743 |
func (i *DsseWhereInput) P() (predicate.Dsse, error) { |
| 744 |
var predicates []predicate.Dsse |
| 745 |
if i.Not != nil { |
| 746 |
p, err := i.Not.P() |
| 747 |
if err != nil { |
| 748 |
return nil, fmt.Errorf("%w: field 'not'", err) |
| 749 |
} |
| 750 |
predicates = append(predicates, dsse.Not(p)) |
| 751 |
} |
| 752 |
switch n := len(i.Or); { |
| 753 |
case n == 1: |
| 754 |
p, err := i.Or[0].P() |
| 755 |
if err != nil { |
| 756 |
return nil, fmt.Errorf("%w: field 'or'", err) |
| 757 |
} |
| 758 |
predicates = append(predicates, p) |
| 759 |
case n > 1: |
| 760 |
or := make([]predicate.Dsse, 0, n) |
| 761 |
for _, w := range i.Or { |
| 762 |
p, err := w.P() |
| 763 |
if err != nil { |
| 764 |
return nil, fmt.Errorf("%w: field 'or'", err) |
| 765 |
} |
| 766 |
or = append(or, p) |
| 767 |
} |
| 768 |
predicates = append(predicates, dsse.Or(or...)) |
| 769 |
} |
| 770 |
switch n := len(i.And); { |
| 771 |
case n == 1: |
| 772 |
p, err := i.And[0].P() |
| 773 |
if err != nil { |
| 774 |
return nil, fmt.Errorf("%w: field 'and'", err) |
| 775 |
} |
| 776 |
predicates = append(predicates, p) |
| 777 |
case n > 1: |
| 778 |
and := make([]predicate.Dsse, 0, n) |
| 779 |
for _, w := range i.And { |
| 780 |
p, err := w.P() |
| 781 |
if err != nil { |
| 782 |
return nil, fmt.Errorf("%w: field 'and'", err) |
| 783 |
} |
| 784 |
and = append(and, p) |
| 785 |
} |
| 786 |
predicates = append(predicates, dsse.And(and...)) |
| 787 |
} |
| 788 |
predicates = append(predicates, i.Predicates...) |
| 789 |
if i.ID != nil { |
| 790 |
predicates = append(predicates, dsse.IDEQ(*i.ID)) |
| 791 |
} |
| 792 |
if i.IDNEQ != nil { |
| 793 |
predicates = append(predicates, dsse.IDNEQ(*i.IDNEQ)) |
| 794 |
} |
| 795 |
if len(i.IDIn) > 0 { |
| 796 |
predicates = append(predicates, dsse.IDIn(i.IDIn...)) |
| 797 |
} |
| 798 |
if len(i.IDNotIn) > 0 { |
| 799 |
predicates = append(predicates, dsse.IDNotIn(i.IDNotIn...)) |
| 800 |
} |
| 801 |
if i.IDGT != nil { |
| 802 |
predicates = append(predicates, dsse.IDGT(*i.IDGT)) |
| 803 |
} |
| 804 |
if i.IDGTE != nil { |
| 805 |
predicates = append(predicates, dsse.IDGTE(*i.IDGTE)) |
| 806 |
} |
| 807 |
if i.IDLT != nil { |
| 808 |
predicates = append(predicates, dsse.IDLT(*i.IDLT)) |
| 809 |
} |
| 810 |
if i.IDLTE != nil { |
| 811 |
predicates = append(predicates, dsse.IDLTE(*i.IDLTE)) |
| 812 |
} |
| 813 |
if i.CreatedAt != nil { |
| 814 |
predicates = append(predicates, dsse.CreatedAtEQ(*i.CreatedAt)) |
| 815 |
} |
| 816 |
if i.CreatedAtNEQ != nil { |
| 817 |
predicates = append(predicates, dsse.CreatedAtNEQ(*i.CreatedAtNEQ)) |
| 818 |
} |
| 819 |
if len(i.CreatedAtIn) > 0 { |
| 820 |
predicates = append(predicates, dsse.CreatedAtIn(i.CreatedAtIn...)) |
| 821 |
} |
| 822 |
if len(i.CreatedAtNotIn) > 0 { |
| 823 |
predicates = append(predicates, dsse.CreatedAtNotIn(i.CreatedAtNotIn...)) |
| 824 |
} |
| 825 |
if i.CreatedAtGT != nil { |
| 826 |
predicates = append(predicates, dsse.CreatedAtGT(*i.CreatedAtGT)) |
| 827 |
} |
| 828 |
if i.CreatedAtGTE != nil { |
| 829 |
predicates = append(predicates, dsse.CreatedAtGTE(*i.CreatedAtGTE)) |
| 830 |
} |
| 831 |
if i.CreatedAtLT != nil { |
| 832 |
predicates = append(predicates, dsse.CreatedAtLT(*i.CreatedAtLT)) |
| 833 |
} |
| 834 |
if i.CreatedAtLTE != nil { |
| 835 |
predicates = append(predicates, dsse.CreatedAtLTE(*i.CreatedAtLTE)) |
| 836 |
} |
| 837 |
if i.CreatedAtIsNil { |
| 838 |
predicates = append(predicates, dsse.CreatedAtIsNil()) |
| 839 |
} |
| 840 |
if i.CreatedAtNotNil { |
| 841 |
predicates = append(predicates, dsse.CreatedAtNotNil()) |
| 842 |
} |
| 843 |
if i.GitoidSha256 != nil { |
| 844 |
predicates = append(predicates, dsse.GitoidSha256EQ(*i.GitoidSha256)) |
| 845 |
} |
| 846 |
if i.GitoidSha256NEQ != nil { |
| 847 |
predicates = append(predicates, dsse.GitoidSha256NEQ(*i.GitoidSha256NEQ)) |
| 848 |
} |
| 849 |
if len(i.GitoidSha256In) > 0 { |
| 850 |
predicates = append(predicates, dsse.GitoidSha256In(i.GitoidSha256In...)) |
| 851 |
} |
| 852 |
if len(i.GitoidSha256NotIn) > 0 { |
| 853 |
predicates = append(predicates, dsse.GitoidSha256NotIn(i.GitoidSha256NotIn...)) |
| 854 |
} |
| 855 |
if i.GitoidSha256GT != nil { |
| 856 |
predicates = append(predicates, dsse.GitoidSha256GT(*i.GitoidSha256GT)) |
| 857 |
} |
| 858 |
if i.GitoidSha256GTE != nil { |
| 859 |
predicates = append(predicates, dsse.GitoidSha256GTE(*i.GitoidSha256GTE)) |
| 860 |
} |
| 861 |
if i.GitoidSha256LT != nil { |
| 862 |
predicates = append(predicates, dsse.GitoidSha256LT(*i.GitoidSha256LT)) |
| 863 |
} |
| 864 |
if i.GitoidSha256LTE != nil { |
| 865 |
predicates = append(predicates, dsse.GitoidSha256LTE(*i.GitoidSha256LTE)) |
| 866 |
} |
| 867 |
if i.GitoidSha256Contains != nil { |
| 868 |
predicates = append(predicates, dsse.GitoidSha256Contains(*i.GitoidSha256Contains)) |
| 869 |
} |
| 870 |
if i.GitoidSha256HasPrefix != nil { |
| 871 |
predicates = append(predicates, dsse.GitoidSha256HasPrefix(*i.GitoidSha256HasPrefix)) |
| 872 |
} |
| 873 |
if i.GitoidSha256HasSuffix != nil { |
| 874 |
predicates = append(predicates, dsse.GitoidSha256HasSuffix(*i.GitoidSha256HasSuffix)) |
| 875 |
} |
| 876 |
if i.GitoidSha256EqualFold != nil { |
| 877 |
predicates = append(predicates, dsse.GitoidSha256EqualFold(*i.GitoidSha256EqualFold)) |
| 878 |
} |
| 879 |
if i.GitoidSha256ContainsFold != nil { |
| 880 |
predicates = append(predicates, dsse.GitoidSha256ContainsFold(*i.GitoidSha256ContainsFold)) |
| 881 |
} |
| 882 |
if i.PayloadType != nil { |
| 883 |
predicates = append(predicates, dsse.PayloadTypeEQ(*i.PayloadType)) |
| 884 |
} |
| 885 |
if i.PayloadTypeNEQ != nil { |
| 886 |
predicates = append(predicates, dsse.PayloadTypeNEQ(*i.PayloadTypeNEQ)) |
| 887 |
} |
| 888 |
if len(i.PayloadTypeIn) > 0 { |
| 889 |
predicates = append(predicates, dsse.PayloadTypeIn(i.PayloadTypeIn...)) |
| 890 |
} |
| 891 |
if len(i.PayloadTypeNotIn) > 0 { |
| 892 |
predicates = append(predicates, dsse.PayloadTypeNotIn(i.PayloadTypeNotIn...)) |
| 893 |
} |
| 894 |
if i.PayloadTypeGT != nil { |
| 895 |
predicates = append(predicates, dsse.PayloadTypeGT(*i.PayloadTypeGT)) |
| 896 |
} |
| 897 |
if i.PayloadTypeGTE != nil { |
| 898 |
predicates = append(predicates, dsse.PayloadTypeGTE(*i.PayloadTypeGTE)) |
| 899 |
} |
| 900 |
if i.PayloadTypeLT != nil { |
| 901 |
predicates = append(predicates, dsse.PayloadTypeLT(*i.PayloadTypeLT)) |
| 902 |
} |
| 903 |
if i.PayloadTypeLTE != nil { |
| 904 |
predicates = append(predicates, dsse.PayloadTypeLTE(*i.PayloadTypeLTE)) |
| 905 |
} |
| 906 |
if i.PayloadTypeContains != nil { |
| 907 |
predicates = append(predicates, dsse.PayloadTypeContains(*i.PayloadTypeContains)) |
| 908 |
} |
| 909 |
if i.PayloadTypeHasPrefix != nil { |
| 910 |
predicates = append(predicates, dsse.PayloadTypeHasPrefix(*i.PayloadTypeHasPrefix)) |
| 911 |
} |
| 912 |
if i.PayloadTypeHasSuffix != nil { |
| 913 |
predicates = append(predicates, dsse.PayloadTypeHasSuffix(*i.PayloadTypeHasSuffix)) |
| 914 |
} |
| 915 |
if i.PayloadTypeEqualFold != nil { |
| 916 |
predicates = append(predicates, dsse.PayloadTypeEqualFold(*i.PayloadTypeEqualFold)) |
| 917 |
} |
| 918 |
if i.PayloadTypeContainsFold != nil { |
| 919 |
predicates = append(predicates, dsse.PayloadTypeContainsFold(*i.PayloadTypeContainsFold)) |
| 920 |
} |
| 921 |
|
| 922 |
if i.HasStatement != nil { |
| 923 |
p := dsse.HasStatement() |
| 924 |
if !*i.HasStatement { |
| 925 |
p = dsse.Not(p) |
| 926 |
} |
| 927 |
predicates = append(predicates, p) |
| 928 |
} |
| 929 |
if len(i.HasStatementWith) > 0 { |
| 930 |
with := make([]predicate.Statement, 0, len(i.HasStatementWith)) |
| 931 |
for _, w := range i.HasStatementWith { |
| 932 |
p, err := w.P() |
| 933 |
if err != nil { |
| 934 |
return nil, fmt.Errorf("%w: field 'HasStatementWith'", err) |
| 935 |
} |
| 936 |
with = append(with, p) |
| 937 |
} |
| 938 |
predicates = append(predicates, dsse.HasStatementWith(with...)) |
| 939 |
} |
| 940 |
if i.HasSignatures != nil { |
| 941 |
p := dsse.HasSignatures() |
| 942 |
if !*i.HasSignatures { |
| 943 |
p = dsse.Not(p) |
| 944 |
} |
| 945 |
predicates = append(predicates, p) |
| 946 |
} |
| 947 |
if len(i.HasSignaturesWith) > 0 { |
| 948 |
with := make([]predicate.Signature, 0, len(i.HasSignaturesWith)) |
| 949 |
for _, w := range i.HasSignaturesWith { |
| 950 |
p, err := w.P() |
| 951 |
if err != nil { |
| 952 |
return nil, fmt.Errorf("%w: field 'HasSignaturesWith'", err) |
| 953 |
} |
| 954 |
with = append(with, p) |
| 955 |
} |
| 956 |
predicates = append(predicates, dsse.HasSignaturesWith(with...)) |
| 957 |
} |
| 958 |
if i.HasPayloadDigests != nil { |
| 959 |
p := dsse.HasPayloadDigests() |
| 960 |
if !*i.HasPayloadDigests { |
| 961 |
p = dsse.Not(p) |
| 962 |
} |
| 963 |
predicates = append(predicates, p) |
| 964 |
} |
| 965 |
if len(i.HasPayloadDigestsWith) > 0 { |
| 966 |
with := make([]predicate.PayloadDigest, 0, len(i.HasPayloadDigestsWith)) |
| 967 |
for _, w := range i.HasPayloadDigestsWith { |
| 968 |
p, err := w.P() |
| 969 |
if err != nil { |
| 970 |
return nil, fmt.Errorf("%w: field 'HasPayloadDigestsWith'", err) |
| 971 |
} |
| 972 |
with = append(with, p) |
| 973 |
} |
| 974 |
predicates = append(predicates, dsse.HasPayloadDigestsWith(with...)) |
| 975 |
} |
| 976 |
switch len(predicates) { |
| 977 |
case 0: |
| 978 |
return nil, ErrEmptyDsseWhereInput |
| 979 |
case 1: |
| 980 |
return predicates[0], nil |
| 981 |
default: |
| 982 |
return dsse.And(predicates...), nil |
| 983 |
} |
| 984 |
} |
| 985 |
|
| 986 |
// PayloadDigestWhereInput represents a where input for filtering PayloadDigest queries. |
| 987 |
type PayloadDigestWhereInput struct { |
| 988 |
Predicates []predicate.PayloadDigest `json:"-"` |
| 989 |
Not *PayloadDigestWhereInput `json:"not,omitempty"` |
| 990 |
Or []*PayloadDigestWhereInput `json:"or,omitempty"` |
| 991 |
And []*PayloadDigestWhereInput `json:"and,omitempty"` |
| 992 |
|
| 993 |
// "id" field predicates. |
| 994 |
ID *uuid.UUID `json:"id,omitempty"` |
| 995 |
IDNEQ *uuid.UUID `json:"idNEQ,omitempty"` |
| 996 |
IDIn []uuid.UUID `json:"idIn,omitempty"` |
| 997 |
IDNotIn []uuid.UUID `json:"idNotIn,omitempty"` |
| 998 |
IDGT *uuid.UUID `json:"idGT,omitempty"` |
| 999 |
IDGTE *uuid.UUID `json:"idGTE,omitempty"` |
| 1000 |
IDLT *uuid.UUID `json:"idLT,omitempty"` |
| 1001 |
IDLTE *uuid.UUID `json:"idLTE,omitempty"` |
| 1002 |
|
| 1003 |
// "algorithm" field predicates. |
| 1004 |
Algorithm *string `json:"algorithm,omitempty"` |
| 1005 |
AlgorithmNEQ *string `json:"algorithmNEQ,omitempty"` |
| 1006 |
AlgorithmIn []string `json:"algorithmIn,omitempty"` |
| 1007 |
AlgorithmNotIn []string `json:"algorithmNotIn,omitempty"` |
| 1008 |
AlgorithmGT *string `json:"algorithmGT,omitempty"` |
| 1009 |
AlgorithmGTE *string `json:"algorithmGTE,omitempty"` |
| 1010 |
AlgorithmLT *string `json:"algorithmLT,omitempty"` |
| 1011 |
AlgorithmLTE *string `json:"algorithmLTE,omitempty"` |
| 1012 |
AlgorithmContains *string `json:"algorithmContains,omitempty"` |
| 1013 |
AlgorithmHasPrefix *string `json:"algorithmHasPrefix,omitempty"` |
| 1014 |
AlgorithmHasSuffix *string `json:"algorithmHasSuffix,omitempty"` |
| 1015 |
AlgorithmEqualFold *string `json:"algorithmEqualFold,omitempty"` |
| 1016 |
AlgorithmContainsFold *string `json:"algorithmContainsFold,omitempty"` |
| 1017 |
|
| 1018 |
// "value" field predicates. |
| 1019 |
Value *string `json:"value,omitempty"` |
| 1020 |
ValueNEQ *string `json:"valueNEQ,omitempty"` |
| 1021 |
ValueIn []string `json:"valueIn,omitempty"` |
| 1022 |
ValueNotIn []string `json:"valueNotIn,omitempty"` |
| 1023 |
ValueGT *string `json:"valueGT,omitempty"` |
| 1024 |
ValueGTE *string `json:"valueGTE,omitempty"` |
| 1025 |
ValueLT *string `json:"valueLT,omitempty"` |
| 1026 |
ValueLTE *string `json:"valueLTE,omitempty"` |
| 1027 |
ValueContains *string `json:"valueContains,omitempty"` |
| 1028 |
ValueHasPrefix *string `json:"valueHasPrefix,omitempty"` |
| 1029 |
ValueHasSuffix *string `json:"valueHasSuffix,omitempty"` |
| 1030 |
ValueEqualFold *string `json:"valueEqualFold,omitempty"` |
| 1031 |
ValueContainsFold *string `json:"valueContainsFold,omitempty"` |
| 1032 |
|
| 1033 |
// "dsse" edge predicates. |
| 1034 |
HasDsse *bool `json:"hasDsse,omitempty"` |
| 1035 |
HasDsseWith []*DsseWhereInput `json:"hasDsseWith,omitempty"` |
| 1036 |
} |
| 1037 |
|
| 1038 |
// AddPredicates adds custom predicates to the where input to be used during the filtering phase. |
| 1039 |
func (i *PayloadDigestWhereInput) AddPredicates(predicates ...predicate.PayloadDigest) { |
| 1040 |
i.Predicates = append(i.Predicates, predicates...) |
| 1041 |
} |
| 1042 |
|
| 1043 |
// Filter applies the PayloadDigestWhereInput filter on the PayloadDigestQuery builder. |
| 1044 |
func (i *PayloadDigestWhereInput) Filter(q *PayloadDigestQuery) (*PayloadDigestQuery, error) { |
| 1045 |
if i == nil { |
| 1046 |
return q, nil |
| 1047 |
} |
| 1048 |
p, err := i.P() |
| 1049 |
if err != nil { |
| 1050 |
if err == ErrEmptyPayloadDigestWhereInput { |
| 1051 |
return q, nil |
| 1052 |
} |
| 1053 |
return nil, err |
| 1054 |
} |
| 1055 |
return q.Where(p), nil |
| 1056 |
} |
| 1057 |
|
| 1058 |
// ErrEmptyPayloadDigestWhereInput is returned in case the PayloadDigestWhereInput is empty. |
| 1059 |
var ErrEmptyPayloadDigestWhereInput = errors.New("ent: empty predicate PayloadDigestWhereInput") |
| 1060 |
|
| 1061 |
// P returns a predicate for filtering payloaddigests. |
| 1062 |
// An error is returned if the input is empty or invalid. |
| 1063 |
func (i *PayloadDigestWhereInput) P() (predicate.PayloadDigest, error) { |
| 1064 |
var predicates []predicate.PayloadDigest |
| 1065 |
if i.Not != nil { |
| 1066 |
p, err := i.Not.P() |
| 1067 |
if err != nil { |
| 1068 |
return nil, fmt.Errorf("%w: field 'not'", err) |
| 1069 |
} |
| 1070 |
predicates = append(predicates, payloaddigest.Not(p)) |
| 1071 |
} |
| 1072 |
switch n := len(i.Or); { |
| 1073 |
case n == 1: |
| 1074 |
p, err := i.Or[0].P() |
| 1075 |
if err != nil { |
| 1076 |
return nil, fmt.Errorf("%w: field 'or'", err) |
| 1077 |
} |
| 1078 |
predicates = append(predicates, p) |
| 1079 |
case n > 1: |
| 1080 |
or := make([]predicate.PayloadDigest, 0, n) |
| 1081 |
for _, w := range i.Or { |
| 1082 |
p, err := w.P() |
| 1083 |
if err != nil { |
| 1084 |
return nil, fmt.Errorf("%w: field 'or'", err) |
| 1085 |
} |
| 1086 |
or = append(or, p) |
| 1087 |
} |
| 1088 |
predicates = append(predicates, payloaddigest.Or(or...)) |
| 1089 |
} |
| 1090 |
switch n := len(i.And); { |
| 1091 |
case n == 1: |
| 1092 |
p, err := i.And[0].P() |
| 1093 |
if err != nil { |
| 1094 |
return nil, fmt.Errorf("%w: field 'and'", err) |
| 1095 |
} |
| 1096 |
predicates = append(predicates, p) |
| 1097 |
case n > 1: |
| 1098 |
and := make([]predicate.PayloadDigest, 0, n) |
| 1099 |
for _, w := range i.And { |
| 1100 |
p, err := w.P() |
| 1101 |
if err != nil { |
| 1102 |
return nil, fmt.Errorf("%w: field 'and'", err) |
| 1103 |
} |
| 1104 |
and = append(and, p) |
| 1105 |
} |
| 1106 |
predicates = append(predicates, payloaddigest.And(and...)) |
| 1107 |
} |
| 1108 |
predicates = append(predicates, i.Predicates...) |
| 1109 |
if i.ID != nil { |
| 1110 |
predicates = append(predicates, payloaddigest.IDEQ(*i.ID)) |
| 1111 |
} |
| 1112 |
if i.IDNEQ != nil { |
| 1113 |
predicates = append(predicates, payloaddigest.IDNEQ(*i.IDNEQ)) |
| 1114 |
} |
| 1115 |
if len(i.IDIn) > 0 { |
| 1116 |
predicates = append(predicates, payloaddigest.IDIn(i.IDIn...)) |
| 1117 |
} |
| 1118 |
if len(i.IDNotIn) > 0 { |
| 1119 |
predicates = append(predicates, payloaddigest.IDNotIn(i.IDNotIn...)) |
| 1120 |
} |
| 1121 |
if i.IDGT != nil { |
| 1122 |
predicates = append(predicates, payloaddigest.IDGT(*i.IDGT)) |
| 1123 |
} |
| 1124 |
if i.IDGTE != nil { |
| 1125 |
predicates = append(predicates, payloaddigest.IDGTE(*i.IDGTE)) |
| 1126 |
} |
| 1127 |
if i.IDLT != nil { |
| 1128 |
predicates = append(predicates, payloaddigest.IDLT(*i.IDLT)) |
| 1129 |
} |
| 1130 |
if i.IDLTE != nil { |
| 1131 |
predicates = append(predicates, payloaddigest.IDLTE(*i.IDLTE)) |
| 1132 |
} |
| 1133 |
if i.Algorithm != nil { |
| 1134 |
predicates = append(predicates, payloaddigest.AlgorithmEQ(*i.Algorithm)) |
| 1135 |
} |
| 1136 |
if i.AlgorithmNEQ != nil { |
| 1137 |
predicates = append(predicates, payloaddigest.AlgorithmNEQ(*i.AlgorithmNEQ)) |
| 1138 |
} |
| 1139 |
if len(i.AlgorithmIn) > 0 { |
| 1140 |
predicates = append(predicates, payloaddigest.AlgorithmIn(i.AlgorithmIn...)) |
| 1141 |
} |
| 1142 |
if len(i.AlgorithmNotIn) > 0 { |
| 1143 |
predicates = append(predicates, payloaddigest.AlgorithmNotIn(i.AlgorithmNotIn...)) |
| 1144 |
} |
| 1145 |
if i.AlgorithmGT != nil { |
| 1146 |
predicates = append(predicates, payloaddigest.AlgorithmGT(*i.AlgorithmGT)) |
| 1147 |
} |
| 1148 |
if i.AlgorithmGTE != nil { |
| 1149 |
predicates = append(predicates, payloaddigest.AlgorithmGTE(*i.AlgorithmGTE)) |
| 1150 |
} |
| 1151 |
if i.AlgorithmLT != nil { |
| 1152 |
predicates = append(predicates, payloaddigest.AlgorithmLT(*i.AlgorithmLT)) |
| 1153 |
} |
| 1154 |
if i.AlgorithmLTE != nil { |
| 1155 |
predicates = append(predicates, payloaddigest.AlgorithmLTE(*i.AlgorithmLTE)) |
| 1156 |
} |
| 1157 |
if i.AlgorithmContains != nil { |
| 1158 |
predicates = append(predicates, payloaddigest.AlgorithmContains(*i.AlgorithmContains)) |
| 1159 |
} |
| 1160 |
if i.AlgorithmHasPrefix != nil { |
| 1161 |
predicates = append(predicates, payloaddigest.AlgorithmHasPrefix(*i.AlgorithmHasPrefix)) |
| 1162 |
} |
| 1163 |
if i.AlgorithmHasSuffix != nil { |
| 1164 |
predicates = append(predicates, payloaddigest.AlgorithmHasSuffix(*i.AlgorithmHasSuffix)) |
| 1165 |
} |
| 1166 |
if i.AlgorithmEqualFold != nil { |
| 1167 |
predicates = append(predicates, payloaddigest.AlgorithmEqualFold(*i.AlgorithmEqualFold)) |
| 1168 |
} |
| 1169 |
if i.AlgorithmContainsFold != nil { |
| 1170 |
predicates = append(predicates, payloaddigest.AlgorithmContainsFold(*i.AlgorithmContainsFold)) |
| 1171 |
} |
| 1172 |
if i.Value != nil { |
| 1173 |
predicates = append(predicates, payloaddigest.ValueEQ(*i.Value)) |
| 1174 |
} |
| 1175 |
if i.ValueNEQ != nil { |
| 1176 |
predicates = append(predicates, payloaddigest.ValueNEQ(*i.ValueNEQ)) |
| 1177 |
} |
| 1178 |
if len(i.ValueIn) > 0 { |
| 1179 |
predicates = append(predicates, payloaddigest.ValueIn(i.ValueIn...)) |
| 1180 |
} |
| 1181 |
if len(i.ValueNotIn) > 0 { |
| 1182 |
predicates = append(predicates, payloaddigest.ValueNotIn(i.ValueNotIn...)) |
| 1183 |
} |
| 1184 |
if i.ValueGT != nil { |
| 1185 |
predicates = append(predicates, payloaddigest.ValueGT(*i.ValueGT)) |
| 1186 |
} |
| 1187 |
if i.ValueGTE != nil { |
| 1188 |
predicates = append(predicates, payloaddigest.ValueGTE(*i.ValueGTE)) |
| 1189 |
} |
| 1190 |
if i.ValueLT != nil { |
| 1191 |
predicates = append(predicates, payloaddigest.ValueLT(*i.ValueLT)) |
| 1192 |
} |
| 1193 |
if i.ValueLTE != nil { |
| 1194 |
predicates = append(predicates, payloaddigest.ValueLTE(*i.ValueLTE)) |
| 1195 |
} |
| 1196 |
if i.ValueContains != nil { |
| 1197 |
predicates = append(predicates, payloaddigest.ValueContains(*i.ValueContains)) |
| 1198 |
} |
| 1199 |
if i.ValueHasPrefix != nil { |
| 1200 |
predicates = append(predicates, payloaddigest.ValueHasPrefix(*i.ValueHasPrefix)) |
| 1201 |
} |
| 1202 |
if i.ValueHasSuffix != nil { |
| 1203 |
predicates = append(predicates, payloaddigest.ValueHasSuffix(*i.ValueHasSuffix)) |
| 1204 |
} |
| 1205 |
if i.ValueEqualFold != nil { |
| 1206 |
predicates = append(predicates, payloaddigest.ValueEqualFold(*i.ValueEqualFold)) |
| 1207 |
} |
| 1208 |
if i.ValueContainsFold != nil { |
| 1209 |
predicates = append(predicates, payloaddigest.ValueContainsFold(*i.ValueContainsFold)) |
| 1210 |
} |
| 1211 |
|
| 1212 |
if i.HasDsse != nil { |
| 1213 |
p := payloaddigest.HasDsse() |
| 1214 |
if !*i.HasDsse { |
| 1215 |
p = payloaddigest.Not(p) |
| 1216 |
} |
| 1217 |
predicates = append(predicates, p) |
| 1218 |
} |
| 1219 |
if len(i.HasDsseWith) > 0 { |
| 1220 |
with := make([]predicate.Dsse, 0, len(i.HasDsseWith)) |
| 1221 |
for _, w := range i.HasDsseWith { |
| 1222 |
p, err := w.P() |
| 1223 |
if err != nil { |
| 1224 |
return nil, fmt.Errorf("%w: field 'HasDsseWith'", err) |
| 1225 |
} |
| 1226 |
with = append(with, p) |
| 1227 |
} |
| 1228 |
predicates = append(predicates, payloaddigest.HasDsseWith(with...)) |
| 1229 |
} |
| 1230 |
switch len(predicates) { |
| 1231 |
case 0: |
| 1232 |
return nil, ErrEmptyPayloadDigestWhereInput |
| 1233 |
case 1: |
| 1234 |
return predicates[0], nil |
| 1235 |
default: |
| 1236 |
return payloaddigest.And(predicates...), nil |
| 1237 |
} |
| 1238 |
} |
| 1239 |
|
| 1240 |
// SignatureWhereInput represents a where input for filtering Signature queries. |
| 1241 |
type SignatureWhereInput struct { |
| 1242 |
Predicates []predicate.Signature `json:"-"` |
| 1243 |
Not *SignatureWhereInput `json:"not,omitempty"` |
| 1244 |
Or []*SignatureWhereInput `json:"or,omitempty"` |
| 1245 |
And []*SignatureWhereInput `json:"and,omitempty"` |
| 1246 |
|
| 1247 |
// "id" field predicates. |
| 1248 |
ID *uuid.UUID `json:"id,omitempty"` |
| 1249 |
IDNEQ *uuid.UUID `json:"idNEQ,omitempty"` |
| 1250 |
IDIn []uuid.UUID `json:"idIn,omitempty"` |
| 1251 |
IDNotIn []uuid.UUID `json:"idNotIn,omitempty"` |
| 1252 |
IDGT *uuid.UUID `json:"idGT,omitempty"` |
| 1253 |
IDGTE *uuid.UUID `json:"idGTE,omitempty"` |
| 1254 |
IDLT *uuid.UUID `json:"idLT,omitempty"` |
| 1255 |
IDLTE *uuid.UUID `json:"idLTE,omitempty"` |
| 1256 |
|
| 1257 |
// "key_id" field predicates. |
| 1258 |
KeyID *string `json:"keyID,omitempty"` |
| 1259 |
KeyIDNEQ *string `json:"keyIDNEQ,omitempty"` |
| 1260 |
KeyIDIn []string `json:"keyIDIn,omitempty"` |
| 1261 |
KeyIDNotIn []string `json:"keyIDNotIn,omitempty"` |
| 1262 |
KeyIDGT *string `json:"keyIDGT,omitempty"` |
| 1263 |
KeyIDGTE *string `json:"keyIDGTE,omitempty"` |
| 1264 |
KeyIDLT *string `json:"keyIDLT,omitempty"` |
| 1265 |
KeyIDLTE *string `json:"keyIDLTE,omitempty"` |
| 1266 |
KeyIDContains *string `json:"keyIDContains,omitempty"` |
| 1267 |
KeyIDHasPrefix *string `json:"keyIDHasPrefix,omitempty"` |
| 1268 |
KeyIDHasSuffix *string `json:"keyIDHasSuffix,omitempty"` |
| 1269 |
KeyIDEqualFold *string `json:"keyIDEqualFold,omitempty"` |
| 1270 |
KeyIDContainsFold *string `json:"keyIDContainsFold,omitempty"` |
| 1271 |
|
| 1272 |
// "signature" field predicates. |
| 1273 |
Signature *string `json:"signature,omitempty"` |
| 1274 |
SignatureNEQ *string `json:"signatureNEQ,omitempty"` |
| 1275 |
SignatureIn []string `json:"signatureIn,omitempty"` |
| 1276 |
SignatureNotIn []string `json:"signatureNotIn,omitempty"` |
| 1277 |
SignatureGT *string `json:"signatureGT,omitempty"` |
| 1278 |
SignatureGTE *string `json:"signatureGTE,omitempty"` |
| 1279 |
SignatureLT *string `json:"signatureLT,omitempty"` |
| 1280 |
SignatureLTE *string `json:"signatureLTE,omitempty"` |
| 1281 |
SignatureContains *string `json:"signatureContains,omitempty"` |
| 1282 |
SignatureHasPrefix *string `json:"signatureHasPrefix,omitempty"` |
| 1283 |
SignatureHasSuffix *string `json:"signatureHasSuffix,omitempty"` |
| 1284 |
SignatureEqualFold *string `json:"signatureEqualFold,omitempty"` |
| 1285 |
SignatureContainsFold *string `json:"signatureContainsFold,omitempty"` |
| 1286 |
|
| 1287 |
// "dsse" edge predicates. |
| 1288 |
HasDsse *bool `json:"hasDsse,omitempty"` |
| 1289 |
HasDsseWith []*DsseWhereInput `json:"hasDsseWith,omitempty"` |
| 1290 |
|
| 1291 |
// "timestamps" edge predicates. |
| 1292 |
HasTimestamps *bool `json:"hasTimestamps,omitempty"` |
| 1293 |
HasTimestampsWith []*TimestampWhereInput `json:"hasTimestampsWith,omitempty"` |
| 1294 |
} |
| 1295 |
|
| 1296 |
// AddPredicates adds custom predicates to the where input to be used during the filtering phase. |
| 1297 |
func (i *SignatureWhereInput) AddPredicates(predicates ...predicate.Signature) { |
| 1298 |
i.Predicates = append(i.Predicates, predicates...) |
| 1299 |
} |
| 1300 |
|
| 1301 |
// Filter applies the SignatureWhereInput filter on the SignatureQuery builder. |
| 1302 |
func (i *SignatureWhereInput) Filter(q *SignatureQuery) (*SignatureQuery, error) { |
| 1303 |
if i == nil { |
| 1304 |
return q, nil |
| 1305 |
} |
| 1306 |
p, err := i.P() |
| 1307 |
if err != nil { |
| 1308 |
if err == ErrEmptySignatureWhereInput { |
| 1309 |
return q, nil |
| 1310 |
} |
| 1311 |
return nil, err |
| 1312 |
} |
| 1313 |
return q.Where(p), nil |
| 1314 |
} |
| 1315 |
|
| 1316 |
// ErrEmptySignatureWhereInput is returned in case the SignatureWhereInput is empty. |
| 1317 |
var ErrEmptySignatureWhereInput = errors.New("ent: empty predicate SignatureWhereInput") |
| 1318 |
|
| 1319 |
// P returns a predicate for filtering signatures. |
| 1320 |
// An error is returned if the input is empty or invalid. |
| 1321 |
func (i *SignatureWhereInput) P() (predicate.Signature, error) { |
| 1322 |
var predicates []predicate.Signature |
| 1323 |
if i.Not != nil { |
| 1324 |
p, err := i.Not.P() |
| 1325 |
if err != nil { |
| 1326 |
return nil, fmt.Errorf("%w: field 'not'", err) |
| 1327 |
} |
| 1328 |
predicates = append(predicates, signature.Not(p)) |
| 1329 |
} |
| 1330 |
switch n := len(i.Or); { |
| 1331 |
case n == 1: |
| 1332 |
p, err := i.Or[0].P() |
| 1333 |
if err != nil { |
| 1334 |
return nil, fmt.Errorf("%w: field 'or'", err) |
| 1335 |
} |
| 1336 |
predicates = append(predicates, p) |
| 1337 |
case n > 1: |
| 1338 |
or := make([]predicate.Signature, 0, n) |
| 1339 |
for _, w := range i.Or { |
| 1340 |
p, err := w.P() |
| 1341 |
if err != nil { |
| 1342 |
return nil, fmt.Errorf("%w: field 'or'", err) |
| 1343 |
} |
| 1344 |
or = append(or, p) |
| 1345 |
} |
| 1346 |
predicates = append(predicates, signature.Or(or...)) |
| 1347 |
} |
| 1348 |
switch n := len(i.And); { |
| 1349 |
case n == 1: |
| 1350 |
p, err := i.And[0].P() |
| 1351 |
if err != nil { |
| 1352 |
return nil, fmt.Errorf("%w: field 'and'", err) |
| 1353 |
} |
| 1354 |
predicates = append(predicates, p) |
| 1355 |
case n > 1: |
| 1356 |
and := make([]predicate.Signature, 0, n) |
| 1357 |
for _, w := range i.And { |
| 1358 |
p, err := w.P() |
| 1359 |
if err != nil { |
| 1360 |
return nil, fmt.Errorf("%w: field 'and'", err) |
| 1361 |
} |
| 1362 |
and = append(and, p) |
| 1363 |
} |
| 1364 |
predicates = append(predicates, signature.And(and...)) |
| 1365 |
} |
| 1366 |
predicates = append(predicates, i.Predicates...) |
| 1367 |
if i.ID != nil { |
| 1368 |
predicates = append(predicates, signature.IDEQ(*i.ID)) |
| 1369 |
} |
| 1370 |
if i.IDNEQ != nil { |
| 1371 |
predicates = append(predicates, signature.IDNEQ(*i.IDNEQ)) |
| 1372 |
} |
| 1373 |
if len(i.IDIn) > 0 { |
| 1374 |
predicates = append(predicates, signature.IDIn(i.IDIn...)) |
| 1375 |
} |
| 1376 |
if len(i.IDNotIn) > 0 { |
| 1377 |
predicates = append(predicates, signature.IDNotIn(i.IDNotIn...)) |
| 1378 |
} |
| 1379 |
if i.IDGT != nil { |
| 1380 |
predicates = append(predicates, signature.IDGT(*i.IDGT)) |
| 1381 |
} |
| 1382 |
if i.IDGTE != nil { |
| 1383 |
predicates = append(predicates, signature.IDGTE(*i.IDGTE)) |
| 1384 |
} |
| 1385 |
if i.IDLT != nil { |
| 1386 |
predicates = append(predicates, signature.IDLT(*i.IDLT)) |
| 1387 |
} |
| 1388 |
if i.IDLTE != nil { |
| 1389 |
predicates = append(predicates, signature.IDLTE(*i.IDLTE)) |
| 1390 |
} |
| 1391 |
if i.KeyID != nil { |
| 1392 |
predicates = append(predicates, signature.KeyIDEQ(*i.KeyID)) |
| 1393 |
} |
| 1394 |
if i.KeyIDNEQ != nil { |
| 1395 |
predicates = append(predicates, signature.KeyIDNEQ(*i.KeyIDNEQ)) |
| 1396 |
} |
| 1397 |
if len(i.KeyIDIn) > 0 { |
| 1398 |
predicates = append(predicates, signature.KeyIDIn(i.KeyIDIn...)) |
| 1399 |
} |
| 1400 |
if len(i.KeyIDNotIn) > 0 { |
| 1401 |
predicates = append(predicates, signature.KeyIDNotIn(i.KeyIDNotIn...)) |
| 1402 |
} |
| 1403 |
if i.KeyIDGT != nil { |
| 1404 |
predicates = append(predicates, signature.KeyIDGT(*i.KeyIDGT)) |
| 1405 |
} |
| 1406 |
if i.KeyIDGTE != nil { |
| 1407 |
predicates = append(predicates, signature.KeyIDGTE(*i.KeyIDGTE)) |
| 1408 |
} |
| 1409 |
if i.KeyIDLT != nil { |
| 1410 |
predicates = append(predicates, signature.KeyIDLT(*i.KeyIDLT)) |
| 1411 |
} |
| 1412 |
if i.KeyIDLTE != nil { |
| 1413 |
predicates = append(predicates, signature.KeyIDLTE(*i.KeyIDLTE)) |
| 1414 |
} |
| 1415 |
if i.KeyIDContains != nil { |
| 1416 |
predicates = append(predicates, signature.KeyIDContains(*i.KeyIDContains)) |
| 1417 |
} |
| 1418 |
if i.KeyIDHasPrefix != nil { |
| 1419 |
predicates = append(predicates, signature.KeyIDHasPrefix(*i.KeyIDHasPrefix)) |
| 1420 |
} |
| 1421 |
if i.KeyIDHasSuffix != nil { |
| 1422 |
predicates = append(predicates, signature.KeyIDHasSuffix(*i.KeyIDHasSuffix)) |
| 1423 |
} |
| 1424 |
if i.KeyIDEqualFold != nil { |
| 1425 |
predicates = append(predicates, signature.KeyIDEqualFold(*i.KeyIDEqualFold)) |
| 1426 |
} |
| 1427 |
if i.KeyIDContainsFold != nil { |
| 1428 |
predicates = append(predicates, signature.KeyIDContainsFold(*i.KeyIDContainsFold)) |
| 1429 |
} |
| 1430 |
if i.Signature != nil { |
| 1431 |
predicates = append(predicates, signature.SignatureEQ(*i.Signature)) |
| 1432 |
} |
| 1433 |
if i.SignatureNEQ != nil { |
| 1434 |
predicates = append(predicates, signature.SignatureNEQ(*i.SignatureNEQ)) |
| 1435 |
} |
| 1436 |
if len(i.SignatureIn) > 0 { |
| 1437 |
predicates = append(predicates, signature.SignatureIn(i.SignatureIn...)) |
| 1438 |
} |
| 1439 |
if len(i.SignatureNotIn) > 0 { |
| 1440 |
predicates = append(predicates, signature.SignatureNotIn(i.SignatureNotIn...)) |
| 1441 |
} |
| 1442 |
if i.SignatureGT != nil { |
| 1443 |
predicates = append(predicates, signature.SignatureGT(*i.SignatureGT)) |
| 1444 |
} |
| 1445 |
if i.SignatureGTE != nil { |
| 1446 |
predicates = append(predicates, signature.SignatureGTE(*i.SignatureGTE)) |
| 1447 |
} |
| 1448 |
if i.SignatureLT != nil { |
| 1449 |
predicates = append(predicates, signature.SignatureLT(*i.SignatureLT)) |
| 1450 |
} |
| 1451 |
if i.SignatureLTE != nil { |
| 1452 |
predicates = append(predicates, signature.SignatureLTE(*i.SignatureLTE)) |
| 1453 |
} |
| 1454 |
if i.SignatureContains != nil { |
| 1455 |
predicates = append(predicates, signature.SignatureContains(*i.SignatureContains)) |
| 1456 |
} |
| 1457 |
if i.SignatureHasPrefix != nil { |
| 1458 |
predicates = append(predicates, signature.SignatureHasPrefix(*i.SignatureHasPrefix)) |
| 1459 |
} |
| 1460 |
if i.SignatureHasSuffix != nil { |
| 1461 |
predicates = append(predicates, signature.SignatureHasSuffix(*i.SignatureHasSuffix)) |
| 1462 |
} |
| 1463 |
if i.SignatureEqualFold != nil { |
| 1464 |
predicates = append(predicates, signature.SignatureEqualFold(*i.SignatureEqualFold)) |
| 1465 |
} |
| 1466 |
if i.SignatureContainsFold != nil { |
| 1467 |
predicates = append(predicates, signature.SignatureContainsFold(*i.SignatureContainsFold)) |
| 1468 |
} |
| 1469 |
|
| 1470 |
if i.HasDsse != nil { |
| 1471 |
p := signature.HasDsse() |
| 1472 |
if !*i.HasDsse { |
| 1473 |
p = signature.Not(p) |
| 1474 |
} |
| 1475 |
predicates = append(predicates, p) |
| 1476 |
} |
| 1477 |
if len(i.HasDsseWith) > 0 { |
| 1478 |
with := make([]predicate.Dsse, 0, len(i.HasDsseWith)) |
| 1479 |
for _, w := range i.HasDsseWith { |
| 1480 |
p, err := w.P() |
| 1481 |
if err != nil { |
| 1482 |
return nil, fmt.Errorf("%w: field 'HasDsseWith'", err) |
| 1483 |
} |
| 1484 |
with = append(with, p) |
| 1485 |
} |
| 1486 |
predicates = append(predicates, signature.HasDsseWith(with...)) |
| 1487 |
} |
| 1488 |
if i.HasTimestamps != nil { |
| 1489 |
p := signature.HasTimestamps() |
| 1490 |
if !*i.HasTimestamps { |
| 1491 |
p = signature.Not(p) |
| 1492 |
} |
| 1493 |
predicates = append(predicates, p) |
| 1494 |
} |
| 1495 |
if len(i.HasTimestampsWith) > 0 { |
| 1496 |
with := make([]predicate.Timestamp, 0, len(i.HasTimestampsWith)) |
| 1497 |
for _, w := range i.HasTimestampsWith { |
| 1498 |
p, err := w.P() |
| 1499 |
if err != nil { |
| 1500 |
return nil, fmt.Errorf("%w: field 'HasTimestampsWith'", err) |
| 1501 |
} |
| 1502 |
with = append(with, p) |
| 1503 |
} |
| 1504 |
predicates = append(predicates, signature.HasTimestampsWith(with...)) |
| 1505 |
} |
| 1506 |
switch len(predicates) { |
| 1507 |
case 0: |
| 1508 |
return nil, ErrEmptySignatureWhereInput |
| 1509 |
case 1: |
| 1510 |
return predicates[0], nil |
| 1511 |
default: |
| 1512 |
return signature.And(predicates...), nil |
| 1513 |
} |
| 1514 |
} |
| 1515 |
|
| 1516 |
// StatementWhereInput represents a where input for filtering Statement queries. |
| 1517 |
type StatementWhereInput struct { |
| 1518 |
Predicates []predicate.Statement `json:"-"` |
| 1519 |
Not *StatementWhereInput `json:"not,omitempty"` |
| 1520 |
Or []*StatementWhereInput `json:"or,omitempty"` |
| 1521 |
And []*StatementWhereInput `json:"and,omitempty"` |
| 1522 |
|
| 1523 |
// "id" field predicates. |
| 1524 |
ID *uuid.UUID `json:"id,omitempty"` |
| 1525 |
IDNEQ *uuid.UUID `json:"idNEQ,omitempty"` |
| 1526 |
IDIn []uuid.UUID `json:"idIn,omitempty"` |
| 1527 |
IDNotIn []uuid.UUID `json:"idNotIn,omitempty"` |
| 1528 |
IDGT *uuid.UUID `json:"idGT,omitempty"` |
| 1529 |
IDGTE *uuid.UUID `json:"idGTE,omitempty"` |
| 1530 |
IDLT *uuid.UUID `json:"idLT,omitempty"` |
| 1531 |
IDLTE *uuid.UUID `json:"idLTE,omitempty"` |
| 1532 |
|
| 1533 |
// "predicate" field predicates. |
| 1534 |
Predicate *string `json:"predicate,omitempty"` |
| 1535 |
PredicateNEQ *string `json:"predicateNEQ,omitempty"` |
| 1536 |
PredicateIn []string `json:"predicateIn,omitempty"` |
| 1537 |
PredicateNotIn []string `json:"predicateNotIn,omitempty"` |
| 1538 |
PredicateGT *string `json:"predicateGT,omitempty"` |
| 1539 |
PredicateGTE *string `json:"predicateGTE,omitempty"` |
| 1540 |
PredicateLT *string `json:"predicateLT,omitempty"` |
| 1541 |
PredicateLTE *string `json:"predicateLTE,omitempty"` |
| 1542 |
PredicateContains *string `json:"predicateContains,omitempty"` |
| 1543 |
PredicateHasPrefix *string `json:"predicateHasPrefix,omitempty"` |
| 1544 |
PredicateHasSuffix *string `json:"predicateHasSuffix,omitempty"` |
| 1545 |
PredicateEqualFold *string `json:"predicateEqualFold,omitempty"` |
| 1546 |
PredicateContainsFold *string `json:"predicateContainsFold,omitempty"` |
| 1547 |
|
| 1548 |
// "subjects" edge predicates. |
| 1549 |
HasSubjects *bool `json:"hasSubjects,omitempty"` |
| 1550 |
HasSubjectsWith []*SubjectWhereInput `json:"hasSubjectsWith,omitempty"` |
| 1551 |
|
| 1552 |
// "policy" edge predicates. |
| 1553 |
HasPolicy *bool `json:"hasPolicy,omitempty"` |
| 1554 |
HasPolicyWith []*AttestationPolicyWhereInput `json:"hasPolicyWith,omitempty"` |
| 1555 |
|
| 1556 |
// "attestation_collections" edge predicates. |
| 1557 |
HasAttestationCollections *bool `json:"hasAttestationCollections,omitempty"` |
| 1558 |
HasAttestationCollectionsWith []*AttestationCollectionWhereInput `json:"hasAttestationCollectionsWith,omitempty"` |
| 1559 |
|
| 1560 |
// "dsse" edge predicates. |
| 1561 |
HasDsse *bool `json:"hasDsse,omitempty"` |
| 1562 |
HasDsseWith []*DsseWhereInput `json:"hasDsseWith,omitempty"` |
| 1563 |
} |
| 1564 |
|
| 1565 |
// AddPredicates adds custom predicates to the where input to be used during the filtering phase. |
| 1566 |
func (i *StatementWhereInput) AddPredicates(predicates ...predicate.Statement) { |
| 1567 |
i.Predicates = append(i.Predicates, predicates...) |
| 1568 |
} |
| 1569 |
|
| 1570 |
// Filter applies the StatementWhereInput filter on the StatementQuery builder. |
| 1571 |
func (i *StatementWhereInput) Filter(q *StatementQuery) (*StatementQuery, error) { |
| 1572 |
if i == nil { |
| 1573 |
return q, nil |
| 1574 |
} |
| 1575 |
p, err := i.P() |
| 1576 |
if err != nil { |
| 1577 |
if err == ErrEmptyStatementWhereInput { |
| 1578 |
return q, nil |
| 1579 |
} |
| 1580 |
return nil, err |
| 1581 |
} |
| 1582 |
return q.Where(p), nil |
| 1583 |
} |
| 1584 |
|
| 1585 |
// ErrEmptyStatementWhereInput is returned in case the StatementWhereInput is empty. |
| 1586 |
var ErrEmptyStatementWhereInput = errors.New("ent: empty predicate StatementWhereInput") |
| 1587 |
|
| 1588 |
// P returns a predicate for filtering statements. |
| 1589 |
// An error is returned if the input is empty or invalid. |
| 1590 |
func (i *StatementWhereInput) P() (predicate.Statement, error) { |
| 1591 |
var predicates []predicate.Statement |
| 1592 |
if i.Not != nil { |
| 1593 |
p, err := i.Not.P() |
| 1594 |
if err != nil { |
| 1595 |
return nil, fmt.Errorf("%w: field 'not'", err) |
| 1596 |
} |
| 1597 |
predicates = append(predicates, statement.Not(p)) |
| 1598 |
} |
| 1599 |
switch n := len(i.Or); { |
| 1600 |
case n == 1: |
| 1601 |
p, err := i.Or[0].P() |
| 1602 |
if err != nil { |
| 1603 |
return nil, fmt.Errorf("%w: field 'or'", err) |
| 1604 |
} |
| 1605 |
predicates = append(predicates, p) |
| 1606 |
case n > 1: |
| 1607 |
or := make([]predicate.Statement, 0, n) |
| 1608 |
for _, w := range i.Or { |
| 1609 |
p, err := w.P() |
| 1610 |
if err != nil { |
| 1611 |
return nil, fmt.Errorf("%w: field 'or'", err) |
| 1612 |
} |
| 1613 |
or = append(or, p) |
| 1614 |
} |
| 1615 |
predicates = append(predicates, statement.Or(or...)) |
| 1616 |
} |
| 1617 |
switch n := len(i.And); { |
| 1618 |
case n == 1: |
| 1619 |
p, err := i.And[0].P() |
| 1620 |
if err != nil { |
| 1621 |
return nil, fmt.Errorf("%w: field 'and'", err) |
| 1622 |
} |
| 1623 |
predicates = append(predicates, p) |
| 1624 |
case n > 1: |
| 1625 |
and := make([]predicate.Statement, 0, n) |
| 1626 |
for _, w := range i.And { |
| 1627 |
p, err := w.P() |
| 1628 |
if err != nil { |
| 1629 |
return nil, fmt.Errorf("%w: field 'and'", err) |
| 1630 |
} |
| 1631 |
and = append(and, p) |
| 1632 |
} |
| 1633 |
predicates = append(predicates, statement.And(and...)) |
| 1634 |
} |
| 1635 |
predicates = append(predicates, i.Predicates...) |
| 1636 |
if i.ID != nil { |
| 1637 |
predicates = append(predicates, statement.IDEQ(*i.ID)) |
| 1638 |
} |
| 1639 |
if i.IDNEQ != nil { |
| 1640 |
predicates = append(predicates, statement.IDNEQ(*i.IDNEQ)) |
| 1641 |
} |
| 1642 |
if len(i.IDIn) > 0 { |
| 1643 |
predicates = append(predicates, statement.IDIn(i.IDIn...)) |
| 1644 |
} |
| 1645 |
if len(i.IDNotIn) > 0 { |
| 1646 |
predicates = append(predicates, statement.IDNotIn(i.IDNotIn...)) |
| 1647 |
} |
| 1648 |
if i.IDGT != nil { |
| 1649 |
predicates = append(predicates, statement.IDGT(*i.IDGT)) |
| 1650 |
} |
| 1651 |
if i.IDGTE != nil { |
| 1652 |
predicates = append(predicates, statement.IDGTE(*i.IDGTE)) |
| 1653 |
} |
| 1654 |
if i.IDLT != nil { |
| 1655 |
predicates = append(predicates, statement.IDLT(*i.IDLT)) |
| 1656 |
} |
| 1657 |
if i.IDLTE != nil { |
| 1658 |
predicates = append(predicates, statement.IDLTE(*i.IDLTE)) |
| 1659 |
} |
| 1660 |
if i.Predicate != nil { |
| 1661 |
predicates = append(predicates, statement.PredicateEQ(*i.Predicate)) |
| 1662 |
} |
| 1663 |
if i.PredicateNEQ != nil { |
| 1664 |
predicates = append(predicates, statement.PredicateNEQ(*i.PredicateNEQ)) |
| 1665 |
} |
| 1666 |
if len(i.PredicateIn) > 0 { |
| 1667 |
predicates = append(predicates, statement.PredicateIn(i.PredicateIn...)) |
| 1668 |
} |
| 1669 |
if len(i.PredicateNotIn) > 0 { |
| 1670 |
predicates = append(predicates, statement.PredicateNotIn(i.PredicateNotIn...)) |
| 1671 |
} |
| 1672 |
if i.PredicateGT != nil { |
| 1673 |
predicates = append(predicates, statement.PredicateGT(*i.PredicateGT)) |
| 1674 |
} |
| 1675 |
if i.PredicateGTE != nil { |
| 1676 |
predicates = append(predicates, statement.PredicateGTE(*i.PredicateGTE)) |
| 1677 |
} |
| 1678 |
if i.PredicateLT != nil { |
| 1679 |
predicates = append(predicates, statement.PredicateLT(*i.PredicateLT)) |
| 1680 |
} |
| 1681 |
if i.PredicateLTE != nil { |
| 1682 |
predicates = append(predicates, statement.PredicateLTE(*i.PredicateLTE)) |
| 1683 |
} |
| 1684 |
if i.PredicateContains != nil { |
| 1685 |
predicates = append(predicates, statement.PredicateContains(*i.PredicateContains)) |
| 1686 |
} |
| 1687 |
if i.PredicateHasPrefix != nil { |
| 1688 |
predicates = append(predicates, statement.PredicateHasPrefix(*i.PredicateHasPrefix)) |
| 1689 |
} |
| 1690 |
if i.PredicateHasSuffix != nil { |
| 1691 |
predicates = append(predicates, statement.PredicateHasSuffix(*i.PredicateHasSuffix)) |
| 1692 |
} |
| 1693 |
if i.PredicateEqualFold != nil { |
| 1694 |
predicates = append(predicates, statement.PredicateEqualFold(*i.PredicateEqualFold)) |
| 1695 |
} |
| 1696 |
if i.PredicateContainsFold != nil { |
| 1697 |
predicates = append(predicates, statement.PredicateContainsFold(*i.PredicateContainsFold)) |
| 1698 |
} |
| 1699 |
|
| 1700 |
if i.HasSubjects != nil { |
| 1701 |
p := statement.HasSubjects() |
| 1702 |
if !*i.HasSubjects { |
| 1703 |
p = statement.Not(p) |
| 1704 |
} |
| 1705 |
predicates = append(predicates, p) |
| 1706 |
} |
| 1707 |
if len(i.HasSubjectsWith) > 0 { |
| 1708 |
with := make([]predicate.Subject, 0, len(i.HasSubjectsWith)) |
| 1709 |
for _, w := range i.HasSubjectsWith { |
| 1710 |
p, err := w.P() |
| 1711 |
if err != nil { |
| 1712 |
return nil, fmt.Errorf("%w: field 'HasSubjectsWith'", err) |
| 1713 |
} |
| 1714 |
with = append(with, p) |
| 1715 |
} |
| 1716 |
predicates = append(predicates, statement.HasSubjectsWith(with...)) |
| 1717 |
} |
| 1718 |
if i.HasPolicy != nil { |
| 1719 |
p := statement.HasPolicy() |
| 1720 |
if !*i.HasPolicy { |
| 1721 |
p = statement.Not(p) |
| 1722 |
} |
| 1723 |
predicates = append(predicates, p) |
| 1724 |
} |
| 1725 |
if len(i.HasPolicyWith) > 0 { |
| 1726 |
with := make([]predicate.AttestationPolicy, 0, len(i.HasPolicyWith)) |
| 1727 |
for _, w := range i.HasPolicyWith { |
| 1728 |
p, err := w.P() |
| 1729 |
if err != nil { |
| 1730 |
return nil, fmt.Errorf("%w: field 'HasPolicyWith'", err) |
| 1731 |
} |
| 1732 |
with = append(with, p) |
| 1733 |
} |
| 1734 |
predicates = append(predicates, statement.HasPolicyWith(with...)) |
| 1735 |
} |
| 1736 |
if i.HasAttestationCollections != nil { |
| 1737 |
p := statement.HasAttestationCollections() |
| 1738 |
if !*i.HasAttestationCollections { |
| 1739 |
p = statement.Not(p) |
| 1740 |
} |
| 1741 |
predicates = append(predicates, p) |
| 1742 |
} |
| 1743 |
if len(i.HasAttestationCollectionsWith) > 0 { |
| 1744 |
with := make([]predicate.AttestationCollection, 0, len(i.HasAttestationCollectionsWith)) |
| 1745 |
for _, w := range i.HasAttestationCollectionsWith { |
| 1746 |
p, err := w.P() |
| 1747 |
if err != nil { |
| 1748 |
return nil, fmt.Errorf("%w: field 'HasAttestationCollectionsWith'", err) |
| 1749 |
} |
| 1750 |
with = append(with, p) |
| 1751 |
} |
| 1752 |
predicates = append(predicates, statement.HasAttestationCollectionsWith(with...)) |
| 1753 |
} |
| 1754 |
if i.HasDsse != nil { |
| 1755 |
p := statement.HasDsse() |
| 1756 |
if !*i.HasDsse { |
| 1757 |
p = statement.Not(p) |
| 1758 |
} |
| 1759 |
predicates = append(predicates, p) |
| 1760 |
} |
| 1761 |
if len(i.HasDsseWith) > 0 { |
| 1762 |
with := make([]predicate.Dsse, 0, len(i.HasDsseWith)) |
| 1763 |
for _, w := range i.HasDsseWith { |
| 1764 |
p, err := w.P() |
| 1765 |
if err != nil { |
| 1766 |
return nil, fmt.Errorf("%w: field 'HasDsseWith'", err) |
| 1767 |
} |
| 1768 |
with = append(with, p) |
| 1769 |
} |
| 1770 |
predicates = append(predicates, statement.HasDsseWith(with...)) |
| 1771 |
} |
| 1772 |
switch len(predicates) { |
| 1773 |
case 0: |
| 1774 |
return nil, ErrEmptyStatementWhereInput |
| 1775 |
case 1: |
| 1776 |
return predicates[0], nil |
| 1777 |
default: |
| 1778 |
return statement.And(predicates...), nil |
| 1779 |
} |
| 1780 |
} |
| 1781 |
|
| 1782 |
// SubjectWhereInput represents a where input for filtering Subject queries. |
| 1783 |
type SubjectWhereInput struct { |
| 1784 |
Predicates []predicate.Subject `json:"-"` |
| 1785 |
Not *SubjectWhereInput `json:"not,omitempty"` |
| 1786 |
Or []*SubjectWhereInput `json:"or,omitempty"` |
| 1787 |
And []*SubjectWhereInput `json:"and,omitempty"` |
| 1788 |
|
| 1789 |
// "id" field predicates. |
| 1790 |
ID *uuid.UUID `json:"id,omitempty"` |
| 1791 |
IDNEQ *uuid.UUID `json:"idNEQ,omitempty"` |
| 1792 |
IDIn []uuid.UUID `json:"idIn,omitempty"` |
| 1793 |
IDNotIn []uuid.UUID `json:"idNotIn,omitempty"` |
| 1794 |
IDGT *uuid.UUID `json:"idGT,omitempty"` |
| 1795 |
IDGTE *uuid.UUID `json:"idGTE,omitempty"` |
| 1796 |
IDLT *uuid.UUID `json:"idLT,omitempty"` |
| 1797 |
IDLTE *uuid.UUID `json:"idLTE,omitempty"` |
| 1798 |
|
| 1799 |
// "created_at" field predicates. |
| 1800 |
CreatedAt *time.Time `json:"createdAt,omitempty"` |
| 1801 |
CreatedAtNEQ *time.Time `json:"createdAtNEQ,omitempty"` |
| 1802 |
CreatedAtIn []time.Time `json:"createdAtIn,omitempty"` |
| 1803 |
CreatedAtNotIn []time.Time `json:"createdAtNotIn,omitempty"` |
| 1804 |
CreatedAtGT *time.Time `json:"createdAtGT,omitempty"` |
| 1805 |
CreatedAtGTE *time.Time `json:"createdAtGTE,omitempty"` |
| 1806 |
CreatedAtLT *time.Time `json:"createdAtLT,omitempty"` |
| 1807 |
CreatedAtLTE *time.Time `json:"createdAtLTE,omitempty"` |
| 1808 |
CreatedAtIsNil bool `json:"createdAtIsNil,omitempty"` |
| 1809 |
CreatedAtNotNil bool `json:"createdAtNotNil,omitempty"` |
| 1810 |
|
| 1811 |
// "name" field predicates. |
| 1812 |
Name *string `json:"name,omitempty"` |
| 1813 |
NameNEQ *string `json:"nameNEQ,omitempty"` |
| 1814 |
NameIn []string `json:"nameIn,omitempty"` |
| 1815 |
NameNotIn []string `json:"nameNotIn,omitempty"` |
| 1816 |
NameGT *string `json:"nameGT,omitempty"` |
| 1817 |
NameGTE *string `json:"nameGTE,omitempty"` |
| 1818 |
NameLT *string `json:"nameLT,omitempty"` |
| 1819 |
NameLTE *string `json:"nameLTE,omitempty"` |
| 1820 |
NameContains *string `json:"nameContains,omitempty"` |
| 1821 |
NameHasPrefix *string `json:"nameHasPrefix,omitempty"` |
| 1822 |
NameHasSuffix *string `json:"nameHasSuffix,omitempty"` |
| 1823 |
NameEqualFold *string `json:"nameEqualFold,omitempty"` |
| 1824 |
NameContainsFold *string `json:"nameContainsFold,omitempty"` |
| 1825 |
|
| 1826 |
// "subject_digests" edge predicates. |
| 1827 |
HasSubjectDigests *bool `json:"hasSubjectDigests,omitempty"` |
| 1828 |
HasSubjectDigestsWith []*SubjectDigestWhereInput `json:"hasSubjectDigestsWith,omitempty"` |
| 1829 |
|
| 1830 |
// "statement" edge predicates. |
| 1831 |
HasStatement *bool `json:"hasStatement,omitempty"` |
| 1832 |
HasStatementWith []*StatementWhereInput `json:"hasStatementWith,omitempty"` |
| 1833 |
} |
| 1834 |
|
| 1835 |
// AddPredicates adds custom predicates to the where input to be used during the filtering phase. |
| 1836 |
func (i *SubjectWhereInput) AddPredicates(predicates ...predicate.Subject) { |
| 1837 |
i.Predicates = append(i.Predicates, predicates...) |
| 1838 |
} |
| 1839 |
|
| 1840 |
// Filter applies the SubjectWhereInput filter on the SubjectQuery builder. |
| 1841 |
func (i *SubjectWhereInput) Filter(q *SubjectQuery) (*SubjectQuery, error) { |
| 1842 |
if i == nil { |
| 1843 |
return q, nil |
| 1844 |
} |
| 1845 |
p, err := i.P() |
| 1846 |
if err != nil { |
| 1847 |
if err == ErrEmptySubjectWhereInput { |
| 1848 |
return q, nil |
| 1849 |
} |
| 1850 |
return nil, err |
| 1851 |
} |
| 1852 |
return q.Where(p), nil |
| 1853 |
} |
| 1854 |
|
| 1855 |
// ErrEmptySubjectWhereInput is returned in case the SubjectWhereInput is empty. |
| 1856 |
var ErrEmptySubjectWhereInput = errors.New("ent: empty predicate SubjectWhereInput") |
| 1857 |
|
| 1858 |
// P returns a predicate for filtering subjects. |
| 1859 |
// An error is returned if the input is empty or invalid. |
| 1860 |
func (i *SubjectWhereInput) P() (predicate.Subject, error) { |
| 1861 |
var predicates []predicate.Subject |
| 1862 |
if i.Not != nil { |
| 1863 |
p, err := i.Not.P() |
| 1864 |
if err != nil { |
| 1865 |
return nil, fmt.Errorf("%w: field 'not'", err) |
| 1866 |
} |
| 1867 |
predicates = append(predicates, subject.Not(p)) |
| 1868 |
} |
| 1869 |
switch n := len(i.Or); { |
| 1870 |
case n == 1: |
| 1871 |
p, err := i.Or[0].P() |
| 1872 |
if err != nil { |
| 1873 |
return nil, fmt.Errorf("%w: field 'or'", err) |
| 1874 |
} |
| 1875 |
predicates = append(predicates, p) |
| 1876 |
case n > 1: |
| 1877 |
or := make([]predicate.Subject, 0, n) |
| 1878 |
for _, w := range i.Or { |
| 1879 |
p, err := w.P() |
| 1880 |
if err != nil { |
| 1881 |
return nil, fmt.Errorf("%w: field 'or'", err) |
| 1882 |
} |
| 1883 |
or = append(or, p) |
| 1884 |
} |
| 1885 |
predicates = append(predicates, subject.Or(or...)) |
| 1886 |
} |
| 1887 |
switch n := len(i.And); { |
| 1888 |
case n == 1: |
| 1889 |
p, err := i.And[0].P() |
| 1890 |
if err != nil { |
| 1891 |
return nil, fmt.Errorf("%w: field 'and'", err) |
| 1892 |
} |
| 1893 |
predicates = append(predicates, p) |
| 1894 |
case n > 1: |
| 1895 |
and := make([]predicate.Subject, 0, n) |
| 1896 |
for _, w := range i.And { |
| 1897 |
p, err := w.P() |
| 1898 |
if err != nil { |
| 1899 |
return nil, fmt.Errorf("%w: field 'and'", err) |
| 1900 |
} |
| 1901 |
and = append(and, p) |
| 1902 |
} |
| 1903 |
predicates = append(predicates, subject.And(and...)) |
| 1904 |
} |
| 1905 |
predicates = append(predicates, i.Predicates...) |
| 1906 |
if i.ID != nil { |
| 1907 |
predicates = append(predicates, subject.IDEQ(*i.ID)) |
| 1908 |
} |
| 1909 |
if i.IDNEQ != nil { |
| 1910 |
predicates = append(predicates, subject.IDNEQ(*i.IDNEQ)) |
| 1911 |
} |
| 1912 |
if len(i.IDIn) > 0 { |
| 1913 |
predicates = append(predicates, subject.IDIn(i.IDIn...)) |
| 1914 |
} |
| 1915 |
if len(i.IDNotIn) > 0 { |
| 1916 |
predicates = append(predicates, subject.IDNotIn(i.IDNotIn...)) |
| 1917 |
} |
| 1918 |
if i.IDGT != nil { |
| 1919 |
predicates = append(predicates, subject.IDGT(*i.IDGT)) |
| 1920 |
} |
| 1921 |
if i.IDGTE != nil { |
| 1922 |
predicates = append(predicates, subject.IDGTE(*i.IDGTE)) |
| 1923 |
} |
| 1924 |
if i.IDLT != nil { |
| 1925 |
predicates = append(predicates, subject.IDLT(*i.IDLT)) |
| 1926 |
} |
| 1927 |
if i.IDLTE != nil { |
| 1928 |
predicates = append(predicates, subject.IDLTE(*i.IDLTE)) |
| 1929 |
} |
| 1930 |
if i.CreatedAt != nil { |
| 1931 |
predicates = append(predicates, subject.CreatedAtEQ(*i.CreatedAt)) |
| 1932 |
} |
| 1933 |
if i.CreatedAtNEQ != nil { |
| 1934 |
predicates = append(predicates, subject.CreatedAtNEQ(*i.CreatedAtNEQ)) |
| 1935 |
} |
| 1936 |
if len(i.CreatedAtIn) > 0 { |
| 1937 |
predicates = append(predicates, subject.CreatedAtIn(i.CreatedAtIn...)) |
| 1938 |
} |
| 1939 |
if len(i.CreatedAtNotIn) > 0 { |
| 1940 |
predicates = append(predicates, subject.CreatedAtNotIn(i.CreatedAtNotIn...)) |
| 1941 |
} |
| 1942 |
if i.CreatedAtGT != nil { |
| 1943 |
predicates = append(predicates, subject.CreatedAtGT(*i.CreatedAtGT)) |
| 1944 |
} |
| 1945 |
if i.CreatedAtGTE != nil { |
| 1946 |
predicates = append(predicates, subject.CreatedAtGTE(*i.CreatedAtGTE)) |
| 1947 |
} |
| 1948 |
if i.CreatedAtLT != nil { |
| 1949 |
predicates = append(predicates, subject.CreatedAtLT(*i.CreatedAtLT)) |
| 1950 |
} |
| 1951 |
if i.CreatedAtLTE != nil { |
| 1952 |
predicates = append(predicates, subject.CreatedAtLTE(*i.CreatedAtLTE)) |
| 1953 |
} |
| 1954 |
if i.CreatedAtIsNil { |
| 1955 |
predicates = append(predicates, subject.CreatedAtIsNil()) |
| 1956 |
} |
| 1957 |
if i.CreatedAtNotNil { |
| 1958 |
predicates = append(predicates, subject.CreatedAtNotNil()) |
| 1959 |
} |
| 1960 |
if i.Name != nil { |
| 1961 |
predicates = append(predicates, subject.NameEQ(*i.Name)) |
| 1962 |
} |
| 1963 |
if i.NameNEQ != nil { |
| 1964 |
predicates = append(predicates, subject.NameNEQ(*i.NameNEQ)) |
| 1965 |
} |
| 1966 |
if len(i.NameIn) > 0 { |
| 1967 |
predicates = append(predicates, subject.NameIn(i.NameIn...)) |
| 1968 |
} |
| 1969 |
if len(i.NameNotIn) > 0 { |
| 1970 |
predicates = append(predicates, subject.NameNotIn(i.NameNotIn...)) |
| 1971 |
} |
| 1972 |
if i.NameGT != nil { |
| 1973 |
predicates = append(predicates, subject.NameGT(*i.NameGT)) |
| 1974 |
} |
| 1975 |
if i.NameGTE != nil { |
| 1976 |
predicates = append(predicates, subject.NameGTE(*i.NameGTE)) |
| 1977 |
} |
| 1978 |
if i.NameLT != nil { |
| 1979 |
predicates = append(predicates, subject.NameLT(*i.NameLT)) |
| 1980 |
} |
| 1981 |
if i.NameLTE != nil { |
| 1982 |
predicates = append(predicates, subject.NameLTE(*i.NameLTE)) |
| 1983 |
} |
| 1984 |
if i.NameContains != nil { |
| 1985 |
predicates = append(predicates, subject.NameContains(*i.NameContains)) |
| 1986 |
} |
| 1987 |
if i.NameHasPrefix != nil { |
| 1988 |
predicates = append(predicates, subject.NameHasPrefix(*i.NameHasPrefix)) |
| 1989 |
} |
| 1990 |
if i.NameHasSuffix != nil { |
| 1991 |
predicates = append(predicates, subject.NameHasSuffix(*i.NameHasSuffix)) |
| 1992 |
} |
| 1993 |
if i.NameEqualFold != nil { |
| 1994 |
predicates = append(predicates, subject.NameEqualFold(*i.NameEqualFold)) |
| 1995 |
} |
| 1996 |
if i.NameContainsFold != nil { |
| 1997 |
predicates = append(predicates, subject.NameContainsFold(*i.NameContainsFold)) |
| 1998 |
} |
| 1999 |
|
| 2000 |
if i.HasSubjectDigests != nil { |
| 2001 |
p := subject.HasSubjectDigests() |
| 2002 |
if !*i.HasSubjectDigests { |
| 2003 |
p = subject.Not(p) |
| 2004 |
} |
| 2005 |
predicates = append(predicates, p) |
| 2006 |
} |
| 2007 |
if len(i.HasSubjectDigestsWith) > 0 { |
| 2008 |
with := make([]predicate.SubjectDigest, 0, len(i.HasSubjectDigestsWith)) |
| 2009 |
for _, w := range i.HasSubjectDigestsWith { |
| 2010 |
p, err := w.P() |
| 2011 |
if err != nil { |
| 2012 |
return nil, fmt.Errorf("%w: field 'HasSubjectDigestsWith'", err) |
| 2013 |
} |
| 2014 |
with = append(with, p) |
| 2015 |
} |
| 2016 |
predicates = append(predicates, subject.HasSubjectDigestsWith(with...)) |
| 2017 |
} |
| 2018 |
if i.HasStatement != nil { |
| 2019 |
p := subject.HasStatement() |
| 2020 |
if !*i.HasStatement { |
| 2021 |
p = subject.Not(p) |
| 2022 |
} |
| 2023 |
predicates = append(predicates, p) |
| 2024 |
} |
| 2025 |
if len(i.HasStatementWith) > 0 { |
| 2026 |
with := make([]predicate.Statement, 0, len(i.HasStatementWith)) |
| 2027 |
for _, w := range i.HasStatementWith { |
| 2028 |
p, err := w.P() |
| 2029 |
if err != nil { |
| 2030 |
return nil, fmt.Errorf("%w: field 'HasStatementWith'", err) |
| 2031 |
} |
| 2032 |
with = append(with, p) |
| 2033 |
} |
| 2034 |
predicates = append(predicates, subject.HasStatementWith(with...)) |
| 2035 |
} |
| 2036 |
switch len(predicates) { |
| 2037 |
case 0: |
| 2038 |
return nil, ErrEmptySubjectWhereInput |
| 2039 |
case 1: |
| 2040 |
return predicates[0], nil |
| 2041 |
default: |
| 2042 |
return subject.And(predicates...), nil |
| 2043 |
} |
| 2044 |
} |
| 2045 |
|
| 2046 |
// SubjectDigestWhereInput represents a where input for filtering SubjectDigest queries. |
| 2047 |
type SubjectDigestWhereInput struct { |
| 2048 |
Predicates []predicate.SubjectDigest `json:"-"` |
| 2049 |
Not *SubjectDigestWhereInput `json:"not,omitempty"` |
| 2050 |
Or []*SubjectDigestWhereInput `json:"or,omitempty"` |
| 2051 |
And []*SubjectDigestWhereInput `json:"and,omitempty"` |
| 2052 |
|
| 2053 |
// "id" field predicates. |
| 2054 |
ID *uuid.UUID `json:"id,omitempty"` |
| 2055 |
IDNEQ *uuid.UUID `json:"idNEQ,omitempty"` |
| 2056 |
IDIn []uuid.UUID `json:"idIn,omitempty"` |
| 2057 |
IDNotIn []uuid.UUID `json:"idNotIn,omitempty"` |
| 2058 |
IDGT *uuid.UUID `json:"idGT,omitempty"` |
| 2059 |
IDGTE *uuid.UUID `json:"idGTE,omitempty"` |
| 2060 |
IDLT *uuid.UUID `json:"idLT,omitempty"` |
| 2061 |
IDLTE *uuid.UUID `json:"idLTE,omitempty"` |
| 2062 |
|
| 2063 |
// "algorithm" field predicates. |
| 2064 |
Algorithm *string `json:"algorithm,omitempty"` |
| 2065 |
AlgorithmNEQ *string `json:"algorithmNEQ,omitempty"` |
| 2066 |
AlgorithmIn []string `json:"algorithmIn,omitempty"` |
| 2067 |
AlgorithmNotIn []string `json:"algorithmNotIn,omitempty"` |
| 2068 |
AlgorithmGT *string `json:"algorithmGT,omitempty"` |
| 2069 |
AlgorithmGTE *string `json:"algorithmGTE,omitempty"` |
| 2070 |
AlgorithmLT *string `json:"algorithmLT,omitempty"` |
| 2071 |
AlgorithmLTE *string `json:"algorithmLTE,omitempty"` |
| 2072 |
AlgorithmContains *string `json:"algorithmContains,omitempty"` |
| 2073 |
AlgorithmHasPrefix *string `json:"algorithmHasPrefix,omitempty"` |
| 2074 |
AlgorithmHasSuffix *string `json:"algorithmHasSuffix,omitempty"` |
| 2075 |
AlgorithmEqualFold *string `json:"algorithmEqualFold,omitempty"` |
| 2076 |
AlgorithmContainsFold *string `json:"algorithmContainsFold,omitempty"` |
| 2077 |
|
| 2078 |
// "value" field predicates. |
| 2079 |
Value *string `json:"value,omitempty"` |
| 2080 |
ValueNEQ *string `json:"valueNEQ,omitempty"` |
| 2081 |
ValueIn []string `json:"valueIn,omitempty"` |
| 2082 |
ValueNotIn []string `json:"valueNotIn,omitempty"` |
| 2083 |
ValueGT *string `json:"valueGT,omitempty"` |
| 2084 |
ValueGTE *string `json:"valueGTE,omitempty"` |
| 2085 |
ValueLT *string `json:"valueLT,omitempty"` |
| 2086 |
ValueLTE *string `json:"valueLTE,omitempty"` |
| 2087 |
ValueContains *string `json:"valueContains,omitempty"` |
| 2088 |
ValueHasPrefix *string `json:"valueHasPrefix,omitempty"` |
| 2089 |
ValueHasSuffix *string `json:"valueHasSuffix,omitempty"` |
| 2090 |
ValueEqualFold *string `json:"valueEqualFold,omitempty"` |
| 2091 |
ValueContainsFold *string `json:"valueContainsFold,omitempty"` |
| 2092 |
|
| 2093 |
// "subject" edge predicates. |
| 2094 |
HasSubject *bool `json:"hasSubject,omitempty"` |
| 2095 |
HasSubjectWith []*SubjectWhereInput `json:"hasSubjectWith,omitempty"` |
| 2096 |
} |
| 2097 |
|
| 2098 |
// AddPredicates adds custom predicates to the where input to be used during the filtering phase. |
| 2099 |
func (i *SubjectDigestWhereInput) AddPredicates(predicates ...predicate.SubjectDigest) { |
| 2100 |
i.Predicates = append(i.Predicates, predicates...) |
| 2101 |
} |
| 2102 |
|
| 2103 |
// Filter applies the SubjectDigestWhereInput filter on the SubjectDigestQuery builder. |
| 2104 |
func (i *SubjectDigestWhereInput) Filter(q *SubjectDigestQuery) (*SubjectDigestQuery, error) { |
| 2105 |
if i == nil { |
| 2106 |
return q, nil |
| 2107 |
} |
| 2108 |
p, err := i.P() |
| 2109 |
if err != nil { |
| 2110 |
if err == ErrEmptySubjectDigestWhereInput { |
| 2111 |
return q, nil |
| 2112 |
} |
| 2113 |
return nil, err |
| 2114 |
} |
| 2115 |
return q.Where(p), nil |
| 2116 |
} |
| 2117 |
|
| 2118 |
// ErrEmptySubjectDigestWhereInput is returned in case the SubjectDigestWhereInput is empty. |
| 2119 |
var ErrEmptySubjectDigestWhereInput = errors.New("ent: empty predicate SubjectDigestWhereInput") |
| 2120 |
|
| 2121 |
// P returns a predicate for filtering subjectdigests. |
| 2122 |
// An error is returned if the input is empty or invalid. |
| 2123 |
func (i *SubjectDigestWhereInput) P() (predicate.SubjectDigest, error) { |
| 2124 |
var predicates []predicate.SubjectDigest |
| 2125 |
if i.Not != nil { |
| 2126 |
p, err := i.Not.P() |
| 2127 |
if err != nil { |
| 2128 |
return nil, fmt.Errorf("%w: field 'not'", err) |
| 2129 |
} |
| 2130 |
predicates = append(predicates, subjectdigest.Not(p)) |
| 2131 |
} |
| 2132 |
switch n := len(i.Or); { |
| 2133 |
case n == 1: |
| 2134 |
p, err := i.Or[0].P() |
| 2135 |
if err != nil { |
| 2136 |
return nil, fmt.Errorf("%w: field 'or'", err) |
| 2137 |
} |
| 2138 |
predicates = append(predicates, p) |
| 2139 |
case n > 1: |
| 2140 |
or := make([]predicate.SubjectDigest, 0, n) |
| 2141 |
for _, w := range i.Or { |
| 2142 |
p, err := w.P() |
| 2143 |
if err != nil { |
| 2144 |
return nil, fmt.Errorf("%w: field 'or'", err) |
| 2145 |
} |
| 2146 |
or = append(or, p) |
| 2147 |
} |
| 2148 |
predicates = append(predicates, subjectdigest.Or(or...)) |
| 2149 |
} |
| 2150 |
switch n := len(i.And); { |
| 2151 |
case n == 1: |
| 2152 |
p, err := i.And[0].P() |
| 2153 |
if err != nil { |
| 2154 |
return nil, fmt.Errorf("%w: field 'and'", err) |
| 2155 |
} |
| 2156 |
predicates = append(predicates, p) |
| 2157 |
case n > 1: |
| 2158 |
and := make([]predicate.SubjectDigest, 0, n) |
| 2159 |
for _, w := range i.And { |
| 2160 |
p, err := w.P() |
| 2161 |
if err != nil { |
| 2162 |
return nil, fmt.Errorf("%w: field 'and'", err) |
| 2163 |
} |
| 2164 |
and = append(and, p) |
| 2165 |
} |
| 2166 |
predicates = append(predicates, subjectdigest.And(and...)) |
| 2167 |
} |
| 2168 |
predicates = append(predicates, i.Predicates...) |
| 2169 |
if i.ID != nil { |
| 2170 |
predicates = append(predicates, subjectdigest.IDEQ(*i.ID)) |
| 2171 |
} |
| 2172 |
if i.IDNEQ != nil { |
| 2173 |
predicates = append(predicates, subjectdigest.IDNEQ(*i.IDNEQ)) |
| 2174 |
} |
| 2175 |
if len(i.IDIn) > 0 { |
| 2176 |
predicates = append(predicates, subjectdigest.IDIn(i.IDIn...)) |
| 2177 |
} |
| 2178 |
if len(i.IDNotIn) > 0 { |
| 2179 |
predicates = append(predicates, subjectdigest.IDNotIn(i.IDNotIn...)) |
| 2180 |
} |
| 2181 |
if i.IDGT != nil { |
| 2182 |
predicates = append(predicates, subjectdigest.IDGT(*i.IDGT)) |
| 2183 |
} |
| 2184 |
if i.IDGTE != nil { |
| 2185 |
predicates = append(predicates, subjectdigest.IDGTE(*i.IDGTE)) |
| 2186 |
} |
| 2187 |
if i.IDLT != nil { |
| 2188 |
predicates = append(predicates, subjectdigest.IDLT(*i.IDLT)) |
| 2189 |
} |
| 2190 |
if i.IDLTE != nil { |
| 2191 |
predicates = append(predicates, subjectdigest.IDLTE(*i.IDLTE)) |
| 2192 |
} |
| 2193 |
if i.Algorithm != nil { |
| 2194 |
predicates = append(predicates, subjectdigest.AlgorithmEQ(*i.Algorithm)) |
| 2195 |
} |
| 2196 |
if i.AlgorithmNEQ != nil { |
| 2197 |
predicates = append(predicates, subjectdigest.AlgorithmNEQ(*i.AlgorithmNEQ)) |
| 2198 |
} |
| 2199 |
if len(i.AlgorithmIn) > 0 { |
| 2200 |
predicates = append(predicates, subjectdigest.AlgorithmIn(i.AlgorithmIn...)) |
| 2201 |
} |
| 2202 |
if len(i.AlgorithmNotIn) > 0 { |
| 2203 |
predicates = append(predicates, subjectdigest.AlgorithmNotIn(i.AlgorithmNotIn...)) |
| 2204 |
} |
| 2205 |
if i.AlgorithmGT != nil { |
| 2206 |
predicates = append(predicates, subjectdigest.AlgorithmGT(*i.AlgorithmGT)) |
| 2207 |
} |
| 2208 |
if i.AlgorithmGTE != nil { |
| 2209 |
predicates = append(predicates, subjectdigest.AlgorithmGTE(*i.AlgorithmGTE)) |
| 2210 |
} |
| 2211 |
if i.AlgorithmLT != nil { |
| 2212 |
predicates = append(predicates, subjectdigest.AlgorithmLT(*i.AlgorithmLT)) |
| 2213 |
} |
| 2214 |
if i.AlgorithmLTE != nil { |
| 2215 |
predicates = append(predicates, subjectdigest.AlgorithmLTE(*i.AlgorithmLTE)) |
| 2216 |
} |
| 2217 |
if i.AlgorithmContains != nil { |
| 2218 |
predicates = append(predicates, subjectdigest.AlgorithmContains(*i.AlgorithmContains)) |
| 2219 |
} |
| 2220 |
if i.AlgorithmHasPrefix != nil { |
| 2221 |
predicates = append(predicates, subjectdigest.AlgorithmHasPrefix(*i.AlgorithmHasPrefix)) |
| 2222 |
} |
| 2223 |
if i.AlgorithmHasSuffix != nil { |
| 2224 |
predicates = append(predicates, subjectdigest.AlgorithmHasSuffix(*i.AlgorithmHasSuffix)) |
| 2225 |
} |
| 2226 |
if i.AlgorithmEqualFold != nil { |
| 2227 |
predicates = append(predicates, subjectdigest.AlgorithmEqualFold(*i.AlgorithmEqualFold)) |
| 2228 |
} |
| 2229 |
if i.AlgorithmContainsFold != nil { |
| 2230 |
predicates = append(predicates, subjectdigest.AlgorithmContainsFold(*i.AlgorithmContainsFold)) |
| 2231 |
} |
| 2232 |
if i.Value != nil { |
| 2233 |
predicates = append(predicates, subjectdigest.ValueEQ(*i.Value)) |
| 2234 |
} |
| 2235 |
if i.ValueNEQ != nil { |
| 2236 |
predicates = append(predicates, subjectdigest.ValueNEQ(*i.ValueNEQ)) |
| 2237 |
} |
| 2238 |
if len(i.ValueIn) > 0 { |
| 2239 |
predicates = append(predicates, subjectdigest.ValueIn(i.ValueIn...)) |
| 2240 |
} |
| 2241 |
if len(i.ValueNotIn) > 0 { |
| 2242 |
predicates = append(predicates, subjectdigest.ValueNotIn(i.ValueNotIn...)) |
| 2243 |
} |
| 2244 |
if i.ValueGT != nil { |
| 2245 |
predicates = append(predicates, subjectdigest.ValueGT(*i.ValueGT)) |
| 2246 |
} |
| 2247 |
if i.ValueGTE != nil { |
| 2248 |
predicates = append(predicates, subjectdigest.ValueGTE(*i.ValueGTE)) |
| 2249 |
} |
| 2250 |
if i.ValueLT != nil { |
| 2251 |
predicates = append(predicates, subjectdigest.ValueLT(*i.ValueLT)) |
| 2252 |
} |
| 2253 |
if i.ValueLTE != nil { |
| 2254 |
predicates = append(predicates, subjectdigest.ValueLTE(*i.ValueLTE)) |
| 2255 |
} |
| 2256 |
if i.ValueContains != nil { |
| 2257 |
predicates = append(predicates, subjectdigest.ValueContains(*i.ValueContains)) |
| 2258 |
} |
| 2259 |
if i.ValueHasPrefix != nil { |
| 2260 |
predicates = append(predicates, subjectdigest.ValueHasPrefix(*i.ValueHasPrefix)) |
| 2261 |
} |
| 2262 |
if i.ValueHasSuffix != nil { |
| 2263 |
predicates = append(predicates, subjectdigest.ValueHasSuffix(*i.ValueHasSuffix)) |
| 2264 |
} |
| 2265 |
if i.ValueEqualFold != nil { |
| 2266 |
predicates = append(predicates, subjectdigest.ValueEqualFold(*i.ValueEqualFold)) |
| 2267 |
} |
| 2268 |
if i.ValueContainsFold != nil { |
| 2269 |
predicates = append(predicates, subjectdigest.ValueContainsFold(*i.ValueContainsFold)) |
| 2270 |
} |
| 2271 |
|
| 2272 |
if i.HasSubject != nil { |
| 2273 |
p := subjectdigest.HasSubject() |
| 2274 |
if !*i.HasSubject { |
| 2275 |
p = subjectdigest.Not(p) |
| 2276 |
} |
| 2277 |
predicates = append(predicates, p) |
| 2278 |
} |
| 2279 |
if len(i.HasSubjectWith) > 0 { |
| 2280 |
with := make([]predicate.Subject, 0, len(i.HasSubjectWith)) |
| 2281 |
for _, w := range i.HasSubjectWith { |
| 2282 |
p, err := w.P() |
| 2283 |
if err != nil { |
| 2284 |
return nil, fmt.Errorf("%w: field 'HasSubjectWith'", err) |
| 2285 |
} |
| 2286 |
with = append(with, p) |
| 2287 |
} |
| 2288 |
predicates = append(predicates, subjectdigest.HasSubjectWith(with...)) |
| 2289 |
} |
| 2290 |
switch len(predicates) { |
| 2291 |
case 0: |
| 2292 |
return nil, ErrEmptySubjectDigestWhereInput |
| 2293 |
case 1: |
| 2294 |
return predicates[0], nil |
| 2295 |
default: |
| 2296 |
return subjectdigest.And(predicates...), nil |
| 2297 |
} |
| 2298 |
} |
| 2299 |
|
| 2300 |
// TimestampWhereInput represents a where input for filtering Timestamp queries. |
| 2301 |
type TimestampWhereInput struct { |
| 2302 |
Predicates []predicate.Timestamp `json:"-"` |
| 2303 |
Not *TimestampWhereInput `json:"not,omitempty"` |
| 2304 |
Or []*TimestampWhereInput `json:"or,omitempty"` |
| 2305 |
And []*TimestampWhereInput `json:"and,omitempty"` |
| 2306 |
|
| 2307 |
// "id" field predicates. |
| 2308 |
ID *uuid.UUID `json:"id,omitempty"` |
| 2309 |
IDNEQ *uuid.UUID `json:"idNEQ,omitempty"` |
| 2310 |
IDIn []uuid.UUID `json:"idIn,omitempty"` |
| 2311 |
IDNotIn []uuid.UUID `json:"idNotIn,omitempty"` |
| 2312 |
IDGT *uuid.UUID `json:"idGT,omitempty"` |
| 2313 |
IDGTE *uuid.UUID `json:"idGTE,omitempty"` |
| 2314 |
IDLT *uuid.UUID `json:"idLT,omitempty"` |
| 2315 |
IDLTE *uuid.UUID `json:"idLTE,omitempty"` |
| 2316 |
|
| 2317 |
// "type" field predicates. |
| 2318 |
Type *string `json:"type,omitempty"` |
| 2319 |
TypeNEQ *string `json:"typeNEQ,omitempty"` |
| 2320 |
TypeIn []string `json:"typeIn,omitempty"` |
| 2321 |
TypeNotIn []string `json:"typeNotIn,omitempty"` |
| 2322 |
TypeGT *string `json:"typeGT,omitempty"` |
| 2323 |
TypeGTE *string `json:"typeGTE,omitempty"` |
| 2324 |
TypeLT *string `json:"typeLT,omitempty"` |
| 2325 |
TypeLTE *string `json:"typeLTE,omitempty"` |
| 2326 |
TypeContains *string `json:"typeContains,omitempty"` |
| 2327 |
TypeHasPrefix *string `json:"typeHasPrefix,omitempty"` |
| 2328 |
TypeHasSuffix *string `json:"typeHasSuffix,omitempty"` |
| 2329 |
TypeEqualFold *string `json:"typeEqualFold,omitempty"` |
| 2330 |
TypeContainsFold *string `json:"typeContainsFold,omitempty"` |
| 2331 |
|
| 2332 |
// "timestamp" field predicates. |
| 2333 |
Timestamp *time.Time `json:"timestamp,omitempty"` |
| 2334 |
TimestampNEQ *time.Time `json:"timestampNEQ,omitempty"` |
| 2335 |
TimestampIn []time.Time `json:"timestampIn,omitempty"` |
| 2336 |
TimestampNotIn []time.Time `json:"timestampNotIn,omitempty"` |
| 2337 |
TimestampGT *time.Time `json:"timestampGT,omitempty"` |
| 2338 |
TimestampGTE *time.Time `json:"timestampGTE,omitempty"` |
| 2339 |
TimestampLT *time.Time `json:"timestampLT,omitempty"` |
| 2340 |
TimestampLTE *time.Time `json:"timestampLTE,omitempty"` |
| 2341 |
|
| 2342 |
// "signature" edge predicates. |
| 2343 |
HasSignature *bool `json:"hasSignature,omitempty"` |
| 2344 |
HasSignatureWith []*SignatureWhereInput `json:"hasSignatureWith,omitempty"` |
| 2345 |
} |
| 2346 |
|
| 2347 |
// AddPredicates adds custom predicates to the where input to be used during the filtering phase. |
| 2348 |
func (i *TimestampWhereInput) AddPredicates(predicates ...predicate.Timestamp) { |
| 2349 |
i.Predicates = append(i.Predicates, predicates...) |
| 2350 |
} |
| 2351 |
|
| 2352 |
// Filter applies the TimestampWhereInput filter on the TimestampQuery builder. |
| 2353 |
func (i *TimestampWhereInput) Filter(q *TimestampQuery) (*TimestampQuery, error) { |
| 2354 |
if i == nil { |
| 2355 |
return q, nil |
| 2356 |
} |
| 2357 |
p, err := i.P() |
| 2358 |
if err != nil { |
| 2359 |
if err == ErrEmptyTimestampWhereInput { |
| 2360 |
return q, nil |
| 2361 |
} |
| 2362 |
return nil, err |
| 2363 |
} |
| 2364 |
return q.Where(p), nil |
| 2365 |
} |
| 2366 |
|
| 2367 |
// ErrEmptyTimestampWhereInput is returned in case the TimestampWhereInput is empty. |
| 2368 |
var ErrEmptyTimestampWhereInput = errors.New("ent: empty predicate TimestampWhereInput") |
| 2369 |
|
| 2370 |
// P returns a predicate for filtering timestamps. |
| 2371 |
// An error is returned if the input is empty or invalid. |
| 2372 |
func (i *TimestampWhereInput) P() (predicate.Timestamp, error) { |
| 2373 |
var predicates []predicate.Timestamp |
| 2374 |
if i.Not != nil { |
| 2375 |
p, err := i.Not.P() |
| 2376 |
if err != nil { |
| 2377 |
return nil, fmt.Errorf("%w: field 'not'", err) |
| 2378 |
} |
| 2379 |
predicates = append(predicates, timestamp.Not(p)) |
| 2380 |
} |
| 2381 |
switch n := len(i.Or); { |
| 2382 |
case n == 1: |
| 2383 |
p, err := i.Or[0].P() |
| 2384 |
if err != nil { |
| 2385 |
return nil, fmt.Errorf("%w: field 'or'", err) |
| 2386 |
} |
| 2387 |
predicates = append(predicates, p) |
| 2388 |
case n > 1: |
| 2389 |
or := make([]predicate.Timestamp, 0, n) |
| 2390 |
for _, w := range i.Or { |
| 2391 |
p, err := w.P() |
| 2392 |
if err != nil { |
| 2393 |
return nil, fmt.Errorf("%w: field 'or'", err) |
| 2394 |
} |
| 2395 |
or = append(or, p) |
| 2396 |
} |
| 2397 |
predicates = append(predicates, timestamp.Or(or...)) |
| 2398 |
} |
| 2399 |
switch n := len(i.And); { |
| 2400 |
case n == 1: |
| 2401 |
p, err := i.And[0].P() |
| 2402 |
if err != nil { |
| 2403 |
return nil, fmt.Errorf("%w: field 'and'", err) |
| 2404 |
} |
| 2405 |
predicates = append(predicates, p) |
| 2406 |
case n > 1: |
| 2407 |
and := make([]predicate.Timestamp, 0, n) |
| 2408 |
for _, w := range i.And { |
| 2409 |
p, err := w.P() |
| 2410 |
if err != nil { |
| 2411 |
return nil, fmt.Errorf("%w: field 'and'", err) |
| 2412 |
} |
| 2413 |
and = append(and, p) |
| 2414 |
} |
| 2415 |
predicates = append(predicates, timestamp.And(and...)) |
| 2416 |
} |
| 2417 |
predicates = append(predicates, i.Predicates...) |
| 2418 |
if i.ID != nil { |
| 2419 |
predicates = append(predicates, timestamp.IDEQ(*i.ID)) |
| 2420 |
} |
| 2421 |
if i.IDNEQ != nil { |
| 2422 |
predicates = append(predicates, timestamp.IDNEQ(*i.IDNEQ)) |
| 2423 |
} |
| 2424 |
if len(i.IDIn) > 0 { |
| 2425 |
predicates = append(predicates, timestamp.IDIn(i.IDIn...)) |
| 2426 |
} |
| 2427 |
if len(i.IDNotIn) > 0 { |
| 2428 |
predicates = append(predicates, timestamp.IDNotIn(i.IDNotIn...)) |
| 2429 |
} |
| 2430 |
if i.IDGT != nil { |
| 2431 |
predicates = append(predicates, timestamp.IDGT(*i.IDGT)) |
| 2432 |
} |
| 2433 |
if i.IDGTE != nil { |
| 2434 |
predicates = append(predicates, timestamp.IDGTE(*i.IDGTE)) |
| 2435 |
} |
| 2436 |
if i.IDLT != nil { |
| 2437 |
predicates = append(predicates, timestamp.IDLT(*i.IDLT)) |
| 2438 |
} |
| 2439 |
if i.IDLTE != nil { |
| 2440 |
predicates = append(predicates, timestamp.IDLTE(*i.IDLTE)) |
| 2441 |
} |
| 2442 |
if i.Type != nil { |
| 2443 |
predicates = append(predicates, timestamp.TypeEQ(*i.Type)) |
| 2444 |
} |
| 2445 |
if i.TypeNEQ != nil { |
| 2446 |
predicates = append(predicates, timestamp.TypeNEQ(*i.TypeNEQ)) |
| 2447 |
} |
| 2448 |
if len(i.TypeIn) > 0 { |
| 2449 |
predicates = append(predicates, timestamp.TypeIn(i.TypeIn...)) |
| 2450 |
} |
| 2451 |
if len(i.TypeNotIn) > 0 { |
| 2452 |
predicates = append(predicates, timestamp.TypeNotIn(i.TypeNotIn...)) |
| 2453 |
} |
| 2454 |
if i.TypeGT != nil { |
| 2455 |
predicates = append(predicates, timestamp.TypeGT(*i.TypeGT)) |
| 2456 |
} |
| 2457 |
if i.TypeGTE != nil { |
| 2458 |
predicates = append(predicates, timestamp.TypeGTE(*i.TypeGTE)) |
| 2459 |
} |
| 2460 |
if i.TypeLT != nil { |
| 2461 |
predicates = append(predicates, timestamp.TypeLT(*i.TypeLT)) |
| 2462 |
} |
| 2463 |
if i.TypeLTE != nil { |
| 2464 |
predicates = append(predicates, timestamp.TypeLTE(*i.TypeLTE)) |
| 2465 |
} |
| 2466 |
if i.TypeContains != nil { |
| 2467 |
predicates = append(predicates, timestamp.TypeContains(*i.TypeContains)) |
| 2468 |
} |
| 2469 |
if i.TypeHasPrefix != nil { |
| 2470 |
predicates = append(predicates, timestamp.TypeHasPrefix(*i.TypeHasPrefix)) |
| 2471 |
} |
| 2472 |
if i.TypeHasSuffix != nil { |
| 2473 |
predicates = append(predicates, timestamp.TypeHasSuffix(*i.TypeHasSuffix)) |
| 2474 |
} |
| 2475 |
if i.TypeEqualFold != nil { |
| 2476 |
predicates = append(predicates, timestamp.TypeEqualFold(*i.TypeEqualFold)) |
| 2477 |
} |
| 2478 |
if i.TypeContainsFold != nil { |
| 2479 |
predicates = append(predicates, timestamp.TypeContainsFold(*i.TypeContainsFold)) |
| 2480 |
} |
| 2481 |
if i.Timestamp != nil { |
| 2482 |
predicates = append(predicates, timestamp.TimestampEQ(*i.Timestamp)) |
| 2483 |
} |
| 2484 |
if i.TimestampNEQ != nil { |
| 2485 |
predicates = append(predicates, timestamp.TimestampNEQ(*i.TimestampNEQ)) |
| 2486 |
} |
| 2487 |
if len(i.TimestampIn) > 0 { |
| 2488 |
predicates = append(predicates, timestamp.TimestampIn(i.TimestampIn...)) |
| 2489 |
} |
| 2490 |
if len(i.TimestampNotIn) > 0 { |
| 2491 |
predicates = append(predicates, timestamp.TimestampNotIn(i.TimestampNotIn...)) |
| 2492 |
} |
| 2493 |
if i.TimestampGT != nil { |
| 2494 |
predicates = append(predicates, timestamp.TimestampGT(*i.TimestampGT)) |
| 2495 |
} |
| 2496 |
if i.TimestampGTE != nil { |
| 2497 |
predicates = append(predicates, timestamp.TimestampGTE(*i.TimestampGTE)) |
| 2498 |
} |
| 2499 |
if i.TimestampLT != nil { |
| 2500 |
predicates = append(predicates, timestamp.TimestampLT(*i.TimestampLT)) |
| 2501 |
} |
| 2502 |
if i.TimestampLTE != nil { |
| 2503 |
predicates = append(predicates, timestamp.TimestampLTE(*i.TimestampLTE)) |
| 2504 |
} |
| 2505 |
|
| 2506 |
if i.HasSignature != nil { |
| 2507 |
p := timestamp.HasSignature() |
| 2508 |
if !*i.HasSignature { |
| 2509 |
p = timestamp.Not(p) |
| 2510 |
} |
| 2511 |
predicates = append(predicates, p) |
| 2512 |
} |
| 2513 |
if len(i.HasSignatureWith) > 0 { |
| 2514 |
with := make([]predicate.Signature, 0, len(i.HasSignatureWith)) |
| 2515 |
for _, w := range i.HasSignatureWith { |
| 2516 |
p, err := w.P() |
| 2517 |
if err != nil { |
| 2518 |
return nil, fmt.Errorf("%w: field 'HasSignatureWith'", err) |
| 2519 |
} |
| 2520 |
with = append(with, p) |
| 2521 |
} |
| 2522 |
predicates = append(predicates, timestamp.HasSignatureWith(with...)) |
| 2523 |
} |
| 2524 |
switch len(predicates) { |
| 2525 |
case 0: |
| 2526 |
return nil, ErrEmptyTimestampWhereInput |
| 2527 |
case 1: |
| 2528 |
return predicates[0], nil |
| 2529 |
default: |
| 2530 |
return timestamp.And(predicates...), nil |
| 2531 |
} |
| 2532 |
} |