Exist returns true if the query has elements in the graph.
(ctx context.Context)
| 270 | |
| 271 | // Exist returns true if the query has elements in the graph. |
| 272 | func (_q *UserQuery) Exist(ctx context.Context) (bool, error) { |
| 273 | ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist) |
| 274 | switch _, err := _q.FirstID(ctx); { |
| 275 | case IsNotFound(err): |
| 276 | return false, nil |
| 277 | case err != nil: |
| 278 | return false, fmt.Errorf("ent: check existence: %w", err) |
| 279 | default: |
| 280 | return true, nil |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | // ExistX is like Exist, but panics if an error occurs. |
| 285 | func (_q *UserQuery) ExistX(ctx context.Context) bool { |
no test coverage detected