FirstID returns the first DBPackage ID from the query. Returns a *NotFoundError when no DBPackage ID was found.
(ctx context.Context)
| 84 | // FirstID returns the first DBPackage ID from the query. |
| 85 | // Returns a *NotFoundError when no DBPackage ID was found. |
| 86 | func (_q *DBPackageQuery) FirstID(ctx context.Context) (id int, err error) { |
| 87 | var ids []int |
| 88 | if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { |
| 89 | return |
| 90 | } |
| 91 | if len(ids) == 0 { |
| 92 | err = &NotFoundError{dbpackage.Label} |
| 93 | return |
| 94 | } |
| 95 | return ids[0], nil |
| 96 | } |
| 97 | |
| 98 | // FirstIDX is like FirstID, but panics if an error occurs. |
| 99 | func (_q *DBPackageQuery) FirstIDX(ctx context.Context) int { |
no test coverage detected