OnlyX is like Only, but panics if an error occurs.
(ctx context.Context)
| 146 | |
| 147 | // OnlyX is like Only, but panics if an error occurs. |
| 148 | func (tq *TaskQuery) OnlyX(ctx context.Context) *Task { |
| 149 | node, err := tq.Only(ctx) |
| 150 | if err != nil { |
| 151 | panic(err) |
| 152 | } |
| 153 | return node |
| 154 | } |
| 155 | |
| 156 | // OnlyID is like Only, but returns the only Task ID in the query. |
| 157 | // Returns a *NotSingularError when more than one Task ID is found. |