plc.directory mirror
1// Code generated by ent, DO NOT EDIT.
2
3package operation
4
5import (
6 "time"
7
8 "entgo.io/ent/dialect/sql"
9)
10
11const (
12 // Label holds the string label denoting the operation type in the database.
13 Label = "operation"
14 // FieldID holds the string denoting the id field in the database.
15 FieldID = "id"
16 // FieldDid holds the string denoting the did field in the database.
17 FieldDid = "did"
18 // FieldOperation holds the string denoting the operation field in the database.
19 FieldOperation = "operation"
20 // FieldCid holds the string denoting the cid field in the database.
21 FieldCid = "cid"
22 // FieldNullified holds the string denoting the nullified field in the database.
23 FieldNullified = "nullified"
24 // FieldCreatedAt holds the string denoting the created_at field in the database.
25 FieldCreatedAt = "created_at"
26 // Table holds the table name of the operation in the database.
27 Table = "operations"
28)
29
30// Columns holds all SQL columns for operation fields.
31var Columns = []string{
32 FieldID,
33 FieldDid,
34 FieldOperation,
35 FieldCid,
36 FieldNullified,
37 FieldCreatedAt,
38}
39
40// ValidColumn reports if the column name is valid (part of the table columns).
41func ValidColumn(column string) bool {
42 for i := range Columns {
43 if column == Columns[i] {
44 return true
45 }
46 }
47 return false
48}
49
50var (
51 // DidValidator is a validator for the "did" field. It is called by the builders before save.
52 DidValidator func(string) error
53 // CidValidator is a validator for the "cid" field. It is called by the builders before save.
54 CidValidator func(string) error
55 // DefaultNullified holds the default value on creation for the "nullified" field.
56 DefaultNullified bool
57 // DefaultCreatedAt holds the default value on creation for the "created_at" field.
58 DefaultCreatedAt func() time.Time
59)
60
61// OrderOption defines the ordering options for the Operation queries.
62type OrderOption func(*sql.Selector)
63
64// ByID orders the results by the id field.
65func ByID(opts ...sql.OrderTermOption) OrderOption {
66 return sql.OrderByField(FieldID, opts...).ToFunc()
67}
68
69// ByDid orders the results by the did field.
70func ByDid(opts ...sql.OrderTermOption) OrderOption {
71 return sql.OrderByField(FieldDid, opts...).ToFunc()
72}
73
74// ByCid orders the results by the cid field.
75func ByCid(opts ...sql.OrderTermOption) OrderOption {
76 return sql.OrderByField(FieldCid, opts...).ToFunc()
77}
78
79// ByNullified orders the results by the nullified field.
80func ByNullified(opts ...sql.OrderTermOption) OrderOption {
81 return sql.OrderByField(FieldNullified, opts...).ToFunc()
82}
83
84// ByCreatedAt orders the results by the created_at field.
85func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
86 return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
87}