2
0
Files
pgx/pgtype/numrange_test.go
T
Jack Christensen efb333df6b Fix go modules
Wow. This is fun. Sure is easy to get modules wrong when upgrading a v2+
project.
2019-04-20 17:41:08 -05:00

47 lines
1.3 KiB
Go

package pgtype_test
import (
"math/big"
"testing"
"github.com/jackc/pgx/v4/pgtype"
"github.com/jackc/pgx/v4/pgtype/testutil"
)
func TestNumrangeTranscode(t *testing.T) {
testutil.TestSuccessfulTranscode(t, "numrange", []interface{}{
&pgtype.Numrange{
LowerType: pgtype.Empty,
UpperType: pgtype.Empty,
Status: pgtype.Present,
},
&pgtype.Numrange{
Lower: pgtype.Numeric{Int: big.NewInt(-543), Exp: 3, Status: pgtype.Present},
Upper: pgtype.Numeric{Int: big.NewInt(342), Exp: 1, Status: pgtype.Present},
LowerType: pgtype.Inclusive,
UpperType: pgtype.Exclusive,
Status: pgtype.Present,
},
&pgtype.Numrange{
Lower: pgtype.Numeric{Int: big.NewInt(-42), Exp: 1, Status: pgtype.Present},
Upper: pgtype.Numeric{Int: big.NewInt(-5), Exp: 0, Status: pgtype.Present},
LowerType: pgtype.Inclusive,
UpperType: pgtype.Exclusive,
Status: pgtype.Present,
},
&pgtype.Numrange{
Lower: pgtype.Numeric{Int: big.NewInt(-42), Exp: 1, Status: pgtype.Present},
LowerType: pgtype.Inclusive,
UpperType: pgtype.Unbounded,
Status: pgtype.Present,
},
&pgtype.Numrange{
Upper: pgtype.Numeric{Int: big.NewInt(-42), Exp: 1, Status: pgtype.Present},
LowerType: pgtype.Unbounded,
UpperType: pgtype.Exclusive,
Status: pgtype.Present,
},
&pgtype.Numrange{Status: pgtype.Null},
})
}