Merge branch 'master' of https://github.com/tarikdemirci/pgx into tarikdemirci-master

pull/426/head
Jack Christensen 2018-05-17 16:45:32 -05:00
commit a6ac63930a
2 changed files with 6 additions and 0 deletions

View File

@ -13,6 +13,11 @@ type Bool struct {
}
func (dst *Bool) Set(src interface{}) error {
if src == nil {
*dst = Bool{Status: Null}
return nil
}
switch value := src.(type) {
case bool:
*dst = Bool{Bool: value, Status: Present}

View File

@ -29,6 +29,7 @@ func TestBoolSet(t *testing.T) {
{source: "f", result: pgtype.Bool{Bool: false, Status: pgtype.Present}},
{source: _bool(true), result: pgtype.Bool{Bool: true, Status: pgtype.Present}},
{source: _bool(false), result: pgtype.Bool{Bool: false, Status: pgtype.Present}},
{source: nil, result: pgtype.Bool{Status: pgtype.Null}},
}
for i, tt := range successfulTests {