First returns the first NodeVersion entity from the query. Returns a *NotFoundError when no NodeVersion was found.
(ctx context.Context)
| 138 | // First returns the first NodeVersion entity from the query. |
| 139 | // Returns a *NotFoundError when no NodeVersion was found. |
| 140 | func (nvq *NodeVersionQuery) First(ctx context.Context) (*NodeVersion, error) { |
| 141 | nodes, err := nvq.Limit(1).All(setContextOp(ctx, nvq.ctx, ent.OpQueryFirst)) |
| 142 | if err != nil { |
| 143 | return nil, err |
| 144 | } |
| 145 | if len(nodes) == 0 { |
| 146 | return nil, &NotFoundError{nodeversion.Label} |
| 147 | } |
| 148 | return nodes[0], nil |
| 149 | } |
| 150 | |
| 151 | // FirstX is like First, but panics if an error occurs. |
| 152 | func (nvq *NodeVersionQuery) FirstX(ctx context.Context) *NodeVersion { |
no test coverage detected