Releases: ntbosscher/sqlx
Releases · ntbosscher/sqlx
v1.4.0
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
}