diff --git a/bool.go b/bool.go index 441d403..fdba1f2 100644 --- a/bool.go +++ b/bool.go @@ -24,6 +24,14 @@ type Bool struct { sql.NullBool } +func True() Bool { + return B(true) +} + +func False() Bool { + return B(false) +} + // NewBool creates a new Bool func NewBool(b bool, valid bool) Bool { return Bool{ diff --git a/bool_test.go b/bool_test.go index 4229da5..32229cb 100644 --- a/bool_test.go +++ b/bool_test.go @@ -295,3 +295,10 @@ func assertBoolEqualIsFalse(t *testing.T, a, b Bool) { t.Errorf("Equal() of Bool{%t, Valid:%t} and Bool{%t, Valid:%t} should return false", a.Bool, a.Valid, b.Bool, b.Valid) } } + +func TestTrueFalse(t *testing.T) { + assert.True(t, True().Valid) + assert.True(t, True().Bool) + assert.True(t, False().Valid) + assert.False(t, False().Bool) +}