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

Method LoadWhere

structable.go:337–344  ·  view source on GitHub ↗

LoadWhere loads an object based on a WHERE clause. This can be used to define alternate loaders: func (s *MyStructable) LoadUuid(uuid string) error { return s.LoadWhere("uuid = ?", uuid) } This functions similarly to Load, but with the notable difference that it loads the entire object (it do

(pred interface{}, args ...interface{})

Source from the content-addressed store, hash-verified

335// This functions similarly to Load, but with the notable difference that
336// it loads the entire object (it does not skip keys used to do the lookup).
337func (s *DbRecorder) LoadWhere(pred interface{}, args ...interface{}) error {
338 dest := s.fieldReferences(true)
339
340 q := s.builder.Select(s.colList(true, true)...).From(s.table).Where(pred, args...)
341 err := q.QueryRow().Scan(dest...)
342
343 return err
344}
345
346// Exists returns `true` if and only if there is at least one record that matches the primary keys for this Record.
347//

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected