Exist returns true if the query has elements in the graph.
(ctx context.Context)
| 243 | |
| 244 | // Exist returns true if the query has elements in the graph. |
| 245 | func (_q *MachineQuery) Exist(ctx context.Context) (bool, error) { |
| 246 | ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist) |
| 247 | switch _, err := _q.FirstID(ctx); { |
| 248 | case IsNotFound(err): |
| 249 | return false, nil |
| 250 | case err != nil: |
| 251 | return false, fmt.Errorf("ent: check existence: %w", err) |
| 252 | default: |
| 253 | return true, nil |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | // ExistX is like Exist, but panics if an error occurs. |
| 258 | func (_q *MachineQuery) ExistX(ctx context.Context) bool { |
no test coverage detected