OnlyX is like Only, but panics if an error occurs.
(ctx context.Context)
| 339 | |
| 340 | // OnlyX is like Only, but panics if an error occurs. |
| 341 | func (uq *UserQuery) OnlyX(ctx context.Context) *User { |
| 342 | node, err := uq.Only(ctx) |
| 343 | if err != nil { |
| 344 | panic(err) |
| 345 | } |
| 346 | return node |
| 347 | } |
| 348 | |
| 349 | // OnlyID is like Only, but returns the only User ID in the query. |
| 350 | // Returns a *NotSingularError when more than one User ID is found. |