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