OnlyX is like Only, but panics if an error occurs.
(ctx context.Context)
| 175 | |
| 176 | // OnlyX is like Only, but panics if an error occurs. |
| 177 | func (_q *UserQuery) OnlyX(ctx context.Context) *User { |
| 178 | node, err := _q.Only(ctx) |
| 179 | if err != nil { |
| 180 | panic(err) |
| 181 | } |
| 182 | return node |
| 183 | } |
| 184 | |
| 185 | // OnlyID is like Only, but returns the only User ID in the query. |
| 186 | // Returns a *NotSingularError when more than one User ID is found. |