QueryNode queries the node edge of a StoragePolicy.
(sp *StoragePolicy)
| 2627 | |
| 2628 | // QueryNode queries the node edge of a StoragePolicy. |
| 2629 | func (c *StoragePolicyClient) QueryNode(sp *StoragePolicy) *NodeQuery { |
| 2630 | query := (&NodeClient{config: c.config}).Query() |
| 2631 | query.path = func(context.Context) (fromV *sql.Selector, _ error) { |
| 2632 | id := sp.ID |
| 2633 | step := sqlgraph.NewStep( |
| 2634 | sqlgraph.From(storagepolicy.Table, storagepolicy.FieldID, id), |
| 2635 | sqlgraph.To(node.Table, node.FieldID), |
| 2636 | sqlgraph.Edge(sqlgraph.M2O, true, storagepolicy.NodeTable, storagepolicy.NodeColumn), |
| 2637 | ) |
| 2638 | fromV = sqlgraph.Neighbors(sp.driver.Dialect(), step) |
| 2639 | return fromV, nil |
| 2640 | } |
| 2641 | return query |
| 2642 | } |
| 2643 | |
| 2644 | // Hooks returns the client hooks. |
| 2645 | func (c *StoragePolicyClient) Hooks() []Hook { |