-
Notifications
You must be signed in to change notification settings - Fork 171
/
nobackref.go
70 lines (61 loc) · 2.1 KB
/
nobackref.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
// Code generated by ent, DO NOT EDIT.
package nobackref
import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
const (
// Label holds the string label denoting the nobackref type in the database.
Label = "no_backref"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// EdgeImages holds the string denoting the images edge name in mutations.
EdgeImages = "images"
// Table holds the table name of the nobackref in the database.
Table = "no_backrefs"
// ImagesTable is the table that holds the images relation/edge.
ImagesTable = "images"
// ImagesInverseTable is the table name for the Image entity.
// It exists in this package in order to avoid circular dependency with the "image" package.
ImagesInverseTable = "images"
// ImagesColumn is the table column denoting the images relation/edge.
ImagesColumn = "no_backref_images"
)
// Columns holds all SQL columns for nobackref fields.
var Columns = []string{
FieldID,
}
// 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
}
// OrderOption defines the ordering options for the NoBackref 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()
}
// ByImagesCount orders the results by images count.
func ByImagesCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newImagesStep(), opts...)
}
}
// ByImages orders the results by images terms.
func ByImages(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newImagesStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
func newImagesStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(ImagesInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, ImagesTable, ImagesColumn),
)
}