FirstID returns the first Alert ID from the query. Returns a *NotFoundError when no Alert ID was found.
(ctx context.Context)
| 181 | // FirstID returns the first Alert ID from the query. |
| 182 | // Returns a *NotFoundError when no Alert ID was found. |
| 183 | func (_q *AlertQuery) FirstID(ctx context.Context) (id int, err error) { |
| 184 | var ids []int |
| 185 | if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { |
| 186 | return |
| 187 | } |
| 188 | if len(ids) == 0 { |
| 189 | err = &NotFoundError{alert.Label} |
| 190 | return |
| 191 | } |
| 192 | return ids[0], nil |
| 193 | } |
| 194 | |
| 195 | // FirstIDX is like FirstID, but panics if an error occurs. |
| 196 | func (_q *AlertQuery) FirstIDX(ctx context.Context) int { |
no test coverage detected