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{})
| 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). |
| 337 | func (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 | // |
nothing calls this directly
no test coverage detected