FirstID returns the first Share ID from the query. Returns a *NotFoundError when no Share ID was found.
(ctx context.Context)
| 131 | // FirstID returns the first Share ID from the query. |
| 132 | // Returns a *NotFoundError when no Share ID was found. |
| 133 | func (sq *ShareQuery) FirstID(ctx context.Context) (id int, err error) { |
| 134 | var ids []int |
| 135 | if ids, err = sq.Limit(1).IDs(setContextOp(ctx, sq.ctx, "FirstID")); err != nil { |
| 136 | return |
| 137 | } |
| 138 | if len(ids) == 0 { |
| 139 | err = &NotFoundError{share.Label} |
| 140 | return |
| 141 | } |
| 142 | return ids[0], nil |
| 143 | } |
| 144 | |
| 145 | // FirstIDX is like FirstID, but panics if an error occurs. |
| 146 | func (sq *ShareQuery) FirstIDX(ctx context.Context) int { |
no test coverage detected