| 1 |
// Code generated by ent, DO NOT EDIT. |
| 2 |
|
| 3 |
package payloaddigest |
| 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 payloaddigest type in the database. |
| 13 |
Label = "payload_digest" |
| 14 |
// FieldID holds the string denoting the id field in the database. |
| 15 |
FieldID = "id" |
| 16 |
// FieldAlgorithm holds the string denoting the algorithm field in the database. |
| 17 |
FieldAlgorithm = "algorithm" |
| 18 |
// FieldValue holds the string denoting the value field in the database. |
| 19 |
FieldValue = "value" |
| 20 |
// EdgeDsse holds the string denoting the dsse edge name in mutations. |
| 21 |
EdgeDsse = "dsse" |
| 22 |
// Table holds the table name of the payloaddigest in the database. |
| 23 |
Table = "payload_digests" |
| 24 |
// DsseTable is the table that holds the dsse relation/edge. |
| 25 |
DsseTable = "payload_digests" |
| 26 |
// DsseInverseTable is the table name for the Dsse entity. |
| 27 |
// It exists in this package in order to avoid circular dependency with the "dsse" package. |
| 28 |
DsseInverseTable = "dsses" |
| 29 |
// DsseColumn is the table column denoting the dsse relation/edge. |
| 30 |
DsseColumn = "dsse_payload_digests" |
| 31 |
) |
| 32 |
|
| 33 |
// Columns holds all SQL columns for payloaddigest fields. |
| 34 |
var Columns = []string{ |
| 35 |
FieldID, |
| 36 |
FieldAlgorithm, |
| 37 |
FieldValue, |
| 38 |
} |
| 39 |
|
| 40 |
// ForeignKeys holds the SQL foreign-keys that are owned by the "payload_digests" |
| 41 |
// table and are not defined as standalone fields in the schema. |
| 42 |
var ForeignKeys = []string{ |
| 43 |
"dsse_payload_digests", |
| 44 |
} |
| 45 |
|
| 46 |
// ValidColumn reports if the column name is valid (part of the table columns). |
| 47 |
func ValidColumn(column string) bool { |
| 48 |
for i := range Columns { |
| 49 |
if column == Columns[i] { |
| 50 |
return true |
| 51 |
} |
| 52 |
} |
| 53 |
for i := range ForeignKeys { |
| 54 |
if column == ForeignKeys[i] { |
| 55 |
return true |
| 56 |
} |
| 57 |
} |
| 58 |
return false |
| 59 |
} |
| 60 |
|
| 61 |
var ( |
| 62 |
// AlgorithmValidator is a validator for the "algorithm" field. It is called by the builders before save. |
| 63 |
AlgorithmValidator func(string) error |
| 64 |
// ValueValidator is a validator for the "value" field. It is called by the builders before save. |
| 65 |
ValueValidator func(string) error |
| 66 |
// DefaultID holds the default value on creation for the "id" field. |
| 67 |
DefaultID func() uuid.UUID |
| 68 |
) |
| 69 |
|
| 70 |
// OrderOption defines the ordering options for the PayloadDigest queries. |
| 71 |
type OrderOption func(*sql.Selector) |
| 72 |
|
| 73 |
// ByID orders the results by the id field. |
| 74 |
func ByID(opts ...sql.OrderTermOption) OrderOption { |
| 75 |
return sql.OrderByField(FieldID, opts...).ToFunc() |
| 76 |
} |
| 77 |
|
| 78 |
// ByAlgorithm orders the results by the algorithm field. |
| 79 |
func ByAlgorithm(opts ...sql.OrderTermOption) OrderOption { |
| 80 |
return sql.OrderByField(FieldAlgorithm, opts...).ToFunc() |
| 81 |
} |
| 82 |
|
| 83 |
// ByValue orders the results by the value field. |
| 84 |
func ByValue(opts ...sql.OrderTermOption) OrderOption { |
| 85 |
return sql.OrderByField(FieldValue, opts...).ToFunc() |
| 86 |
} |
| 87 |
|
| 88 |
// ByDsseField orders the results by dsse field. |
| 89 |
func ByDsseField(field string, opts ...sql.OrderTermOption) OrderOption { |
| 90 |
return func(s *sql.Selector) { |
| 91 |
sqlgraph.OrderByNeighborTerms(s, newDsseStep(), sql.OrderByField(field, opts...)) |
| 92 |
} |
| 93 |
} |
| 94 |
func newDsseStep() *sqlgraph.Step { |
| 95 |
return sqlgraph.NewStep( |
| 96 |
sqlgraph.From(Table, FieldID), |
| 97 |
sqlgraph.To(DsseInverseTable, FieldID), |
| 98 |
sqlgraph.Edge(sqlgraph.M2O, true, DsseTable, DsseColumn), |
| 99 |
) |
| 100 |
} |