Debian Codegraph @

ent/signature/signature.go

raw
1 // Code generated by ent, DO NOT EDIT.
2
3 package signature
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 signature type in the database.
13 Label = "signature"
14 // FieldID holds the string denoting the id field in the database.
15 FieldID = "id"
16 // FieldKeyID holds the string denoting the key_id field in the database.
17 FieldKeyID = "key_id"
18 // FieldSignature holds the string denoting the signature field in the database.
19 FieldSignature = "signature"
20 // EdgeDsse holds the string denoting the dsse edge name in mutations.
21 EdgeDsse = "dsse"
22 // EdgeTimestamps holds the string denoting the timestamps edge name in mutations.
23 EdgeTimestamps = "timestamps"
24 // Table holds the table name of the signature in the database.
25 Table = "signatures"
26 // DsseTable is the table that holds the dsse relation/edge.
27 DsseTable = "signatures"
28 // DsseInverseTable is the table name for the Dsse entity.
29 // It exists in this package in order to avoid circular dependency with the "dsse" package.
30 DsseInverseTable = "dsses"
31 // DsseColumn is the table column denoting the dsse relation/edge.
32 DsseColumn = "dsse_signatures"
33 // TimestampsTable is the table that holds the timestamps relation/edge.
34 TimestampsTable = "timestamps"
35 // TimestampsInverseTable is the table name for the Timestamp entity.
36 // It exists in this package in order to avoid circular dependency with the "timestamp" package.
37 TimestampsInverseTable = "timestamps"
38 // TimestampsColumn is the table column denoting the timestamps relation/edge.
39 TimestampsColumn = "signature_timestamps"
40 )
41
42 // Columns holds all SQL columns for signature fields.
43 var Columns = []string{
44 FieldID,
45 FieldKeyID,
46 FieldSignature,
47 }
48
49 // ForeignKeys holds the SQL foreign-keys that are owned by the "signatures"
50 // table and are not defined as standalone fields in the schema.
51 var ForeignKeys = []string{
52 "dsse_signatures",
53 }
54
55 // ValidColumn reports if the column name is valid (part of the table columns).
56 func ValidColumn(column string) bool {
57 for i := range Columns {
58 if column == Columns[i] {
59 return true
60 }
61 }
62 for i := range ForeignKeys {
63 if column == ForeignKeys[i] {
64 return true
65 }
66 }
67 return false
68 }
69
70 var (
71 // SignatureValidator is a validator for the "signature" field. It is called by the builders before save.
72 SignatureValidator func(string) error
73 // DefaultID holds the default value on creation for the "id" field.
74 DefaultID func() uuid.UUID
75 )
76
77 // OrderOption defines the ordering options for the Signature queries.
78 type OrderOption func(*sql.Selector)
79
80 // ByID orders the results by the id field.
81 func ByID(opts ...sql.OrderTermOption) OrderOption {
82 return sql.OrderByField(FieldID, opts...).ToFunc()
83 }
84
85 // ByKeyID orders the results by the key_id field.
86 func ByKeyID(opts ...sql.OrderTermOption) OrderOption {
87 return sql.OrderByField(FieldKeyID, opts...).ToFunc()
88 }
89
90 // BySignature orders the results by the signature field.
91 func BySignature(opts ...sql.OrderTermOption) OrderOption {
92 return sql.OrderByField(FieldSignature, opts...).ToFunc()
93 }
94
95 // ByDsseField orders the results by dsse field.
96 func ByDsseField(field string, opts ...sql.OrderTermOption) OrderOption {
97 return func(s *sql.Selector) {
98 sqlgraph.OrderByNeighborTerms(s, newDsseStep(), sql.OrderByField(field, opts...))
99 }
100 }
101
102 // ByTimestampsCount orders the results by timestamps count.
103 func ByTimestampsCount(opts ...sql.OrderTermOption) OrderOption {
104 return func(s *sql.Selector) {
105 sqlgraph.OrderByNeighborsCount(s, newTimestampsStep(), opts...)
106 }
107 }
108
109 // ByTimestamps orders the results by timestamps terms.
110 func ByTimestamps(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
111 return func(s *sql.Selector) {
112 sqlgraph.OrderByNeighborTerms(s, newTimestampsStep(), append([]sql.OrderTerm{term}, terms...)...)
113 }
114 }
115 func newDsseStep() *sqlgraph.Step {
116 return sqlgraph.NewStep(
117 sqlgraph.From(Table, FieldID),
118 sqlgraph.To(DsseInverseTable, FieldID),
119 sqlgraph.Edge(sqlgraph.M2O, true, DsseTable, DsseColumn),
120 )
121 }
122 func newTimestampsStep() *sqlgraph.Step {
123 return sqlgraph.NewStep(
124 sqlgraph.From(Table, FieldID),
125 sqlgraph.To(TimestampsInverseTable, FieldID),
126 sqlgraph.Edge(sqlgraph.O2M, false, TimestampsTable, TimestampsColumn),
127 )
128 }