| 1 |
// Code generated by ent, DO NOT EDIT. |
| 2 |
|
| 3 |
package timestamp |
| 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 timestamp type in the database. |
| 13 |
Label = "timestamp" |
| 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 |
// FieldTimestamp holds the string denoting the timestamp field in the database. |
| 19 |
FieldTimestamp = "timestamp" |
| 20 |
// EdgeSignature holds the string denoting the signature edge name in mutations. |
| 21 |
EdgeSignature = "signature" |
| 22 |
// Table holds the table name of the timestamp in the database. |
| 23 |
Table = "timestamps" |
| 24 |
// SignatureTable is the table that holds the signature relation/edge. |
| 25 |
SignatureTable = "timestamps" |
| 26 |
// SignatureInverseTable is the table name for the Signature entity. |
| 27 |
// It exists in this package in order to avoid circular dependency with the "signature" package. |
| 28 |
SignatureInverseTable = "signatures" |
| 29 |
// SignatureColumn is the table column denoting the signature relation/edge. |
| 30 |
SignatureColumn = "signature_timestamps" |
| 31 |
) |
| 32 |
|
| 33 |
// Columns holds all SQL columns for timestamp fields. |
| 34 |
var Columns = []string{ |
| 35 |
FieldID, |
| 36 |
FieldType, |
| 37 |
FieldTimestamp, |
| 38 |
} |
| 39 |
|
| 40 |
// ForeignKeys holds the SQL foreign-keys that are owned by the "timestamps" |
| 41 |
// table and are not defined as standalone fields in the schema. |
| 42 |
var ForeignKeys = []string{ |
| 43 |
"signature_timestamps", |
| 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 |
// DefaultID holds the default value on creation for the "id" field. |
| 63 |
DefaultID func() uuid.UUID |
| 64 |
) |
| 65 |
|
| 66 |
// OrderOption defines the ordering options for the Timestamp queries. |
| 67 |
type OrderOption func(*sql.Selector) |
| 68 |
|
| 69 |
// ByID orders the results by the id field. |
| 70 |
func ByID(opts ...sql.OrderTermOption) OrderOption { |
| 71 |
return sql.OrderByField(FieldID, opts...).ToFunc() |
| 72 |
} |
| 73 |
|
| 74 |
// ByType orders the results by the type field. |
| 75 |
func ByType(opts ...sql.OrderTermOption) OrderOption { |
| 76 |
return sql.OrderByField(FieldType, opts...).ToFunc() |
| 77 |
} |
| 78 |
|
| 79 |
// ByTimestamp orders the results by the timestamp field. |
| 80 |
func ByTimestamp(opts ...sql.OrderTermOption) OrderOption { |
| 81 |
return sql.OrderByField(FieldTimestamp, opts...).ToFunc() |
| 82 |
} |
| 83 |
|
| 84 |
// BySignatureField orders the results by signature field. |
| 85 |
func BySignatureField(field string, opts ...sql.OrderTermOption) OrderOption { |
| 86 |
return func(s *sql.Selector) { |
| 87 |
sqlgraph.OrderByNeighborTerms(s, newSignatureStep(), sql.OrderByField(field, opts...)) |
| 88 |
} |
| 89 |
} |
| 90 |
func newSignatureStep() *sqlgraph.Step { |
| 91 |
return sqlgraph.NewStep( |
| 92 |
sqlgraph.From(Table, FieldID), |
| 93 |
sqlgraph.To(SignatureInverseTable, FieldID), |
| 94 |
sqlgraph.Edge(sqlgraph.M2O, true, SignatureTable, SignatureColumn), |
| 95 |
) |
| 96 |
} |