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