Debian Codegraph @

ent/attestation/attestation.go

raw
1 // Code generated by ent, DO NOT EDIT.
2
3 package attestation
4
5 import (
6 "entgo.io/ent/dialect/sql"
7 "entgo.io/ent/dialect/sql/sqlgraph"
8 "github.com/google/uuid"
9 )
10
11 const (
12 // Label holds the string label denoting the attestation type in the database.
13 Label = "attestation"
14 // FieldID holds the string denoting the id field in the database.
15 FieldID = "id"
16 // FieldType holds the string denoting the type field in the database.
17 FieldType = "type"
18 // EdgeAttestationCollection holds the string denoting the attestation_collection edge name in mutations.
19 EdgeAttestationCollection = "attestation_collection"
20 // Table holds the table name of the attestation in the database.
21 Table = "attestations"
22 // AttestationCollectionTable is the table that holds the attestation_collection relation/edge.
23 AttestationCollectionTable = "attestations"
24 // AttestationCollectionInverseTable is the table name for the AttestationCollection entity.
25 // It exists in this package in order to avoid circular dependency with the "attestationcollection" package.
26 AttestationCollectionInverseTable = "attestation_collections"
27 // AttestationCollectionColumn is the table column denoting the attestation_collection relation/edge.
28 AttestationCollectionColumn = "attestation_collection_attestations"
29 )
30
31 // Columns holds all SQL columns for attestation fields.
32 var Columns = []string{
33 FieldID,
34 FieldType,
35 }
36
37 // ForeignKeys holds the SQL foreign-keys that are owned by the "attestations"
38 // table and are not defined as standalone fields in the schema.
39 var ForeignKeys = []string{
40 "attestation_collection_attestations",
41 }
42
43 // ValidColumn reports if the column name is valid (part of the table columns).
44 func ValidColumn(column string) bool {
45 for i := range Columns {
46 if column == Columns[i] {
47 return true
48 }
49 }
50 for i := range ForeignKeys {
51 if column == ForeignKeys[i] {
52 return true
53 }
54 }
55 return false
56 }
57
58 var (
59 // TypeValidator is a validator for the "type" field. It is called by the builders before save.
60 TypeValidator func(string) error
61 // DefaultID holds the default value on creation for the "id" field.
62 DefaultID func() uuid.UUID
63 )
64
65 // OrderOption defines the ordering options for the Attestation queries.
66 type OrderOption func(*sql.Selector)
67
68 // ByID orders the results by the id field.
69 func ByID(opts ...sql.OrderTermOption) OrderOption {
70 return sql.OrderByField(FieldID, opts...).ToFunc()
71 }
72
73 // ByType orders the results by the type field.
74 func ByType(opts ...sql.OrderTermOption) OrderOption {
75 return sql.OrderByField(FieldType, opts...).ToFunc()
76 }
77
78 // ByAttestationCollectionField orders the results by attestation_collection field.
79 func ByAttestationCollectionField(field string, opts ...sql.OrderTermOption) OrderOption {
80 return func(s *sql.Selector) {
81 sqlgraph.OrderByNeighborTerms(s, newAttestationCollectionStep(), sql.OrderByField(field, opts...))
82 }
83 }
84 func newAttestationCollectionStep() *sqlgraph.Step {
85 return sqlgraph.NewStep(
86 sqlgraph.From(Table, FieldID),
87 sqlgraph.To(AttestationCollectionInverseTable, FieldID),
88 sqlgraph.Edge(sqlgraph.M2O, true, AttestationCollectionTable, AttestationCollectionColumn),
89 )
90 }