MCPcopy
hub / github.com/cloudreve/cloudreve / QueryNode

Method QueryNode

ent/storagepolicy_query.go:136–155  ·  view source on GitHub ↗

QueryNode chains the current query on the "node" edge.

()

Source from the content-addressed store, hash-verified

134
135// QueryNode chains the current query on the "node" edge.
136func (spq *StoragePolicyQuery) QueryNode() *NodeQuery {
137 query := (&NodeClient{config: spq.config}).Query()
138 query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
139 if err := spq.prepareQuery(ctx); err != nil {
140 return nil, err
141 }
142 selector := spq.sqlQuery(ctx)
143 if err := selector.Err(); err != nil {
144 return nil, err
145 }
146 step := sqlgraph.NewStep(
147 sqlgraph.From(storagepolicy.Table, storagepolicy.FieldID, selector),
148 sqlgraph.To(node.Table, node.FieldID),
149 sqlgraph.Edge(sqlgraph.M2O, true, storagepolicy.NodeTable, storagepolicy.NodeColumn),
150 )
151 fromU = sqlgraph.SetNeighbors(spq.driver.Dialect(), step)
152 return fromU, nil
153 }
154 return query
155}
156
157// First returns the first StoragePolicy entity from the query.
158// Returns a *NotFoundError when no StoragePolicy was found.

Callers

nothing calls this directly

Calls 5

prepareQueryMethod · 0.95
sqlQueryMethod · 0.95
DialectMethod · 0.80
ToMethod · 0.65
QueryMethod · 0.45

Tested by

no test coverage detected