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

Method Load

structable.go:317–325  ·  view source on GitHub ↗

Load selects the record from the database and loads the values into the bound Record. Load uses the table's PRIMARY KEY(s) as the sole criterion for matching a record. Essentially, it is akin to `SELECT * FROM table WHERE primary_key = ?`. This modifies the Record in-place. Other than the primary

()

Source from the content-addressed store, hash-verified

315// This modifies the Record in-place. Other than the primary key fields, any
316// other field will be overwritten by the value retrieved from the database.
317func (s *DbRecorder) Load() error {
318 whereParts := s.whereIds()
319 dest := s.fieldReferences(false)
320
321 q := s.builder.Select(s.colList(false, false)...).From(s.table).Where(whereParts)
322 err := q.QueryRow().Scan(dest...)
323
324 return err
325}
326
327// LoadWhere loads an object based on a WHERE clause.
328//

Callers

nothing calls this directly

Calls 5

whereIdsMethod · 0.95
fieldReferencesMethod · 0.95
colListMethod · 0.95
ScanMethod · 0.80
QueryRowMethod · 0.80

Tested by

no test coverage detected