MCPcopy Create free account
hub / github.com/cloudreve/cloudreve / getNodeOrderOption

Function getNodeOrderOption

inventory/node.go:134–146  ·  view source on GitHub ↗
(args *ListNodeParameters)

Source from the content-addressed store, hash-verified

132}
133
134func getNodeOrderOption(args *ListNodeParameters) []node.OrderOption {
135 orderTerm := getOrderTerm(args.Order)
136 switch args.OrderBy {
137 case node.FieldName:
138 return []node.OrderOption{node.ByName(orderTerm), node.ByID(orderTerm)}
139 case node.FieldWeight:
140 return []node.OrderOption{node.ByWeight(orderTerm), node.ByID(orderTerm)}
141 case node.FieldUpdatedAt:
142 return []node.OrderOption{node.ByUpdatedAt(orderTerm), node.ByID(orderTerm)}
143 default:
144 return []node.OrderOption{node.ByID(orderTerm)}
145 }
146}
147
148func withNodeEagerLoading(ctx context.Context, query *ent.NodeQuery) *ent.NodeQuery {
149 if _, ok := ctx.Value(LoadNodeStoragePolicy{}).(bool); ok {

Callers 1

ListNodesMethod · 0.85

Calls 5

ByNameFunction · 0.92
ByIDFunction · 0.92
ByWeightFunction · 0.92
ByUpdatedAtFunction · 0.92
getOrderTermFunction · 0.85

Tested by

no test coverage detected