FirstID returns the first User ID from the query. Returns a *NotFoundError when no User ID was found.
(ctx context.Context)
| 135 | // FirstID returns the first User ID from the query. |
| 136 | // Returns a *NotFoundError when no User ID was found. |
| 137 | func (_q *UserQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) { |
| 138 | var ids []uuid.UUID |
| 139 | if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { |
| 140 | return |
| 141 | } |
| 142 | if len(ids) == 0 { |
| 143 | err = &NotFoundError{user.Label} |
| 144 | return |
| 145 | } |
| 146 | return ids[0], nil |
| 147 | } |
| 148 | |
| 149 | // FirstIDX is like FirstID, but panics if an error occurs. |
| 150 | func (_q *UserQuery) FirstIDX(ctx context.Context) uuid.UUID { |
no test coverage detected