QueryStoragePolicies queries the storage_policies edge of a File.
(f *File)
| 942 | |
| 943 | // QueryStoragePolicies queries the storage_policies edge of a File. |
| 944 | func (c *FileClient) QueryStoragePolicies(f *File) *StoragePolicyQuery { |
| 945 | query := (&StoragePolicyClient{config: c.config}).Query() |
| 946 | query.path = func(context.Context) (fromV *sql.Selector, _ error) { |
| 947 | id := f.ID |
| 948 | step := sqlgraph.NewStep( |
| 949 | sqlgraph.From(file.Table, file.FieldID, id), |
| 950 | sqlgraph.To(storagepolicy.Table, storagepolicy.FieldID), |
| 951 | sqlgraph.Edge(sqlgraph.M2O, true, file.StoragePoliciesTable, file.StoragePoliciesColumn), |
| 952 | ) |
| 953 | fromV = sqlgraph.Neighbors(f.driver.Dialect(), step) |
| 954 | return fromV, nil |
| 955 | } |
| 956 | return query |
| 957 | } |
| 958 | |
| 959 | // QueryParent queries the parent edge of a File. |
| 960 | func (c *FileClient) QueryParent(f *File) *FileQuery { |