-
Notifications
You must be signed in to change notification settings - Fork 0
/
tool.go
102 lines (89 loc) · 3.35 KB
/
tool.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// Code generated by ent, DO NOT EDIT.
package tool
import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
const (
// Label holds the string label denoting the tool type in the database.
Label = "tool"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldIndx holds the string denoting the indx field in the database.
FieldIndx = "indx"
// FieldName holds the string denoting the name field in the database.
FieldName = "name"
// FieldToolCategory holds the string denoting the tool_category field in the database.
FieldToolCategory = "tool_category"
// FieldEquipmentID holds the string denoting the equipment_id field in the database.
FieldEquipmentID = "equipment_id"
// EdgeEquipment holds the string denoting the equipment edge name in mutations.
EdgeEquipment = "equipment"
// Table holds the table name of the tool in the database.
Table = "tools"
// EquipmentTable is the table that holds the equipment relation/edge.
EquipmentTable = "tools"
// EquipmentInverseTable is the table name for the Equipment entity.
// It exists in this package in order to avoid circular dependency with the "equipment" package.
EquipmentInverseTable = "equipment"
// EquipmentColumn is the table column denoting the equipment relation/edge.
EquipmentColumn = "equipment_id"
)
// Columns holds all SQL columns for tool fields.
var Columns = []string{
FieldID,
FieldIndx,
FieldName,
FieldToolCategory,
FieldEquipmentID,
}
// ValidColumn reports if the column name is valid (part of the table columns).
func ValidColumn(column string) bool {
for i := range Columns {
if column == Columns[i] {
return true
}
}
return false
}
var (
// IndxValidator is a validator for the "indx" field. It is called by the builders before save.
IndxValidator func(string) error
// NameValidator is a validator for the "name" field. It is called by the builders before save.
NameValidator func(string) error
)
// OrderOption defines the ordering options for the Tool queries.
type OrderOption func(*sql.Selector)
// ByID orders the results by the id field.
func ByID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldID, opts...).ToFunc()
}
// ByIndx orders the results by the indx field.
func ByIndx(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldIndx, opts...).ToFunc()
}
// ByName orders the results by the name field.
func ByName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldName, opts...).ToFunc()
}
// ByToolCategory orders the results by the tool_category field.
func ByToolCategory(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldToolCategory, opts...).ToFunc()
}
// ByEquipmentID orders the results by the equipment_id field.
func ByEquipmentID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldEquipmentID, opts...).ToFunc()
}
// ByEquipmentField orders the results by equipment field.
func ByEquipmentField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newEquipmentStep(), sql.OrderByField(field, opts...))
}
}
func newEquipmentStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(EquipmentInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2O, true, EquipmentTable, EquipmentColumn),
)
}