First returns the first OAuthClient entity from the query. Returns a *NotFoundError when no OAuthClient was found.
(ctx context.Context)
| 85 | // First returns the first OAuthClient entity from the query. |
| 86 | // Returns a *NotFoundError when no OAuthClient was found. |
| 87 | func (ocq *OAuthClientQuery) First(ctx context.Context) (*OAuthClient, error) { |
| 88 | nodes, err := ocq.Limit(1).All(setContextOp(ctx, ocq.ctx, "First")) |
| 89 | if err != nil { |
| 90 | return nil, err |
| 91 | } |
| 92 | if len(nodes) == 0 { |
| 93 | return nil, &NotFoundError{oauthclient.Label} |
| 94 | } |
| 95 | return nodes[0], nil |
| 96 | } |
| 97 | |
| 98 | // FirstX is like First, but panics if an error occurs. |
| 99 | func (ocq *OAuthClientQuery) FirstX(ctx context.Context) *OAuthClient { |
no test coverage detected