forked from jmoiron/sqlx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update reflectx to allow for optional nested structs
Nested structs are now only instantiated when one of the database columns in that nested struct is not nil. This allows objects scanned in left/outer joins to keep their natural types (instead of setting everything to NullableX). Example: select house.id, owner.*, from house left join owner on owner.id = house.owner type House struct { ID int Owner *Person // if left join gives nulls, Owner will be nil } type Owner struct { ID int // no need to set this to sql.NullInt }
- Loading branch information
1 parent
28212d4
commit 81db673
Showing
3 changed files
with
315 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.