FirstID returns the first Meta ID from the query. Returns a *NotFoundError when no Meta ID was found.
(ctx context.Context)
| 107 | // FirstID returns the first Meta ID from the query. |
| 108 | // Returns a *NotFoundError when no Meta ID was found. |
| 109 | func (_q *MetaQuery) FirstID(ctx context.Context) (id int, err error) { |
| 110 | var ids []int |
| 111 | if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { |
| 112 | return |
| 113 | } |
| 114 | if len(ids) == 0 { |
| 115 | err = &NotFoundError{meta.Label} |
| 116 | return |
| 117 | } |
| 118 | return ids[0], nil |
| 119 | } |
| 120 | |
| 121 | // FirstIDX is like FirstID, but panics if an error occurs. |
| 122 | func (_q *MetaQuery) FirstIDX(ctx context.Context) int { |
no test coverage detected