Skip to content

Commit

Permalink
Merge pull request #277 from GeertJohan/pr-218-add-dummyfield
Browse files Browse the repository at this point in the history
Cherry pick correct commit for PR #218
  • Loading branch information
Geert-Johan Riemer committed Jul 10, 2015
2 parents 62e914b + 5652a0b commit 2a05b50
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion gorp.go
Expand Up @@ -96,6 +96,14 @@ func (nt NullTime) Value() (driver.Value, error) {
return nt.Time, nil
}

// for fields that exists in DB table, but not exists in struct
type dummyField struct{}

// Scan implements the Scanner interface.
func (nt *dummyField) Scan(value interface{}) error {
return nil
}

var zeroVal reflect.Value
var versFieldConst = "[gorp_ver_field]"

Expand Down Expand Up @@ -1912,7 +1920,7 @@ func rawselect(m *DbMap, exec SqlExecutor, i interface{}, query string,
if index == nil {
// this field is not present in the struct, so create a dummy
// value for rows.Scan to scan into
var dummy sql.RawBytes
var dummy dummyField
dest[x] = &dummy
continue
}
Expand Down

0 comments on commit 2a05b50

Please sign in to comment.