Update updates the values on an existing entry. This updates records where the Record's primary keys match the record in the database. Essentially, it runs `UPDATE table SET names=values WHERE id=?` If no entry is found, update will NOT create (INSERT) a new record.
()
| 451 | // |
| 452 | // If no entry is found, update will NOT create (INSERT) a new record. |
| 453 | func (s *DbRecorder) Update() error { |
| 454 | |
| 455 | whereParts := s.whereIds() |
| 456 | |
| 457 | cols, vals := s.colValLists(false, true) |
| 458 | |
| 459 | q := s.builder.Update(s.table) |
| 460 | for i := range cols { |
| 461 | q = q.Set(cols[i], vals[i]) |
| 462 | } |
| 463 | |
| 464 | _, err := q.Where(whereParts).Exec() |
| 465 | return err |
| 466 | } |
| 467 | |
| 468 | // colList gets a list of column names. If withKeys is false, columns that are |
| 469 | // designated as primary keys will not be returned in this list. |
nothing calls this directly
no test coverage detected