Debian Codegraph @

ent/attestationpolicy/attestationpolicy.go

raw
1 // Code generated by ent, DO NOT EDIT.
2
3 package attestationpolicy
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 attestationpolicy type in the database.
13 Label = "attestation_policy"
14 // FieldID holds the string denoting the id field in the database.
15 FieldID = "id"
16 // FieldName holds the string denoting the name field in the database.
17 FieldName = "name"
18 // EdgeStatement holds the string denoting the statement edge name in mutations.
19 EdgeStatement = "statement"
20 // Table holds the table name of the attestationpolicy in the database.
21 Table = "attestation_policies"
22 // StatementTable is the table that holds the statement relation/edge.
23 StatementTable = "attestation_policies"
24 // StatementInverseTable is the table name for the Statement entity.
25 // It exists in this package in order to avoid circular dependency with the "statement" package.
26 StatementInverseTable = "statements"
27 // StatementColumn is the table column denoting the statement relation/edge.
28 StatementColumn = "statement_policy"
29 )
30
31 // Columns holds all SQL columns for attestationpolicy fields.
32 var Columns = []string{
33 FieldID,
34 FieldName,
35 }
36
37 // ForeignKeys holds the SQL foreign-keys that are owned by the "attestation_policies"
38 // table and are not defined as standalone fields in the schema.
39 var ForeignKeys = []string{
40 "statement_policy",
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 // NameValidator is a validator for the "name" field. It is called by the builders before save.
60 NameValidator 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 AttestationPolicy 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 // ByName orders the results by the name field.
74 func ByName(opts ...sql.OrderTermOption) OrderOption {
75 return sql.OrderByField(FieldName, opts...).ToFunc()
76 }
77
78 // ByStatementField orders the results by statement field.
79 func ByStatementField(field string, opts ...sql.OrderTermOption) OrderOption {
80 return func(s *sql.Selector) {
81 sqlgraph.OrderByNeighborTerms(s, newStatementStep(), sql.OrderByField(field, opts...))
82 }
83 }
84 func newStatementStep() *sqlgraph.Step {
85 return sqlgraph.NewStep(
86 sqlgraph.From(Table, FieldID),
87 sqlgraph.To(StatementInverseTable, FieldID),
88 sqlgraph.Edge(sqlgraph.O2O, true, StatementTable, StatementColumn),
89 )
90 }