QueryNode chains the current query on the "node" edge.
()
| 134 | |
| 135 | // QueryNode chains the current query on the "node" edge. |
| 136 | func (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. |
nothing calls this directly
no test coverage detected