insertPg runs a postgres-specific INSERT. Unlike the default (MySQL) driver, this actually refreshes ALL of the fields on the Record object. We do this because it is trivially easy in Postgres.
()
| 429 | // this actually refreshes ALL of the fields on the Record object. We do this |
| 430 | // because it is trivially easy in Postgres. |
| 431 | func (s *DbRecorder) insertPg() error { |
| 432 | |
| 433 | cols, vals := s.colValLists(true, false) |
| 434 | dest := s.fieldReferences(true) |
| 435 | |
| 436 | q := s.builder.Insert(s.table).Columns(cols...).Values(vals...). |
| 437 | Suffix("RETURNING " + strings.Join(s.colList(true, false), ",")) |
| 438 | |
| 439 | sql, vals, err := q.ToSql() |
| 440 | if err != nil { |
| 441 | return err |
| 442 | } |
| 443 | |
| 444 | return s.db.QueryRow(sql, vals...).Scan(dest...) |
| 445 | } |
| 446 | |
| 447 | // Update updates the values on an existing entry. |
| 448 | // |
no test coverage detected