OnlyX is like Only, but panics if an error occurs.
(ctx context.Context)
| 219 | |
| 220 | // OnlyX is like Only, but panics if an error occurs. |
| 221 | func (spq *StoragePolicyQuery) OnlyX(ctx context.Context) *StoragePolicy { |
| 222 | node, err := spq.Only(ctx) |
| 223 | if err != nil { |
| 224 | panic(err) |
| 225 | } |
| 226 | return node |
| 227 | } |
| 228 | |
| 229 | // OnlyID is like Only, but returns the only StoragePolicy ID in the query. |
| 230 | // Returns a *NotSingularError when more than one StoragePolicy ID is found. |