ExistsWhere returns `true` if and only if there is at least one record that matches one (or multiple) conditions. Conditions are expressed in the form of predicates and expected values that together build a WHERE clause. See Squirrel's Where(pred, args)
(pred interface{}, args ...interface{})
| 362 | // Conditions are expressed in the form of predicates and expected values |
| 363 | // that together build a WHERE clause. See Squirrel's Where(pred, args) |
| 364 | func (s *DbRecorder) ExistsWhere(pred interface{}, args ...interface{}) (bool, error) { |
| 365 | has := false |
| 366 | |
| 367 | q := s.builder.Select("COUNT(*) > 0").From(s.table).Where(pred, args...) |
| 368 | err := q.QueryRow().Scan(&has) |
| 369 | |
| 370 | return has, err |
| 371 | } |
| 372 | |
| 373 | // Delete deletes the record from the underlying table. |
| 374 | // |