MCPcopy Index your code
hub / github.com/Masterminds/structable / Update

Method Update

structable.go:453–466  ·  view source on GitHub ↗

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.

()

Source from the content-addressed store, hash-verified

451//
452// If no entry is found, update will NOT create (INSERT) a new record.
453func (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.

Callers

nothing calls this directly

Calls 4

whereIdsMethod · 0.95
colValListsMethod · 0.95
ExecMethod · 0.80
UpdateMethod · 0.65

Tested by

no test coverage detected