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