Exists returns `true` if and only if there is at least one record that matches the primary keys for this Record. If the primary key on the Record has no value, this will look for records with no value (or the default value).
()
| 348 | // If the primary key on the Record has no value, this will look for records with no value (or the default |
| 349 | // value). |
| 350 | func (s *DbRecorder) Exists() (bool, error) { |
| 351 | has := false |
| 352 | whereParts := s.whereIds() |
| 353 | |
| 354 | q := s.builder.Select("COUNT(*) > 0").From(s.table).Where(whereParts) |
| 355 | err := q.QueryRow().Scan(&has) |
| 356 | |
| 357 | return has, err |
| 358 | } |
| 359 | |
| 360 | // ExistsWhere returns `true` if and only if there is at least one record that matches one (or multiple) conditions. |
| 361 | // |