OnlyX is like Only, but panics if an error occurs.
(ctx context.Context)
| 195 | |
| 196 | // OnlyX is like Only, but panics if an error occurs. |
| 197 | func (eq *EntityQuery) OnlyX(ctx context.Context) *Entity { |
| 198 | node, err := eq.Only(ctx) |
| 199 | if err != nil { |
| 200 | panic(err) |
| 201 | } |
| 202 | return node |
| 203 | } |
| 204 | |
| 205 | // OnlyID is like Only, but returns the only Entity ID in the query. |
| 206 | // Returns a *NotSingularError when more than one Entity ID is found. |