File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed
Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,21 @@ func Int64(value int64) IntegerExpression {
3434 return CAST (jet .Int (value )).AS_BIGINT ()
3535}
3636
37+ // Uint8 is constructor for 8 bit unsigned integer expressions literals.
38+ func Uint8 (value uint8 ) IntegerExpression {
39+ return CAST (jet .Uint8 (value )).AS_SMALLINT ()
40+ }
41+
42+ // Uint16 is constructor for 16 bit unsigned integer expressions literals.
43+ func Uint16 (value uint16 ) IntegerExpression {
44+ return CAST (jet .Uint16 (value )).AS_INTEGER ()
45+ }
46+
47+ // Uint32 is constructor for 32 bit unsigned integer expressions literals.
48+ func Uint32 (value uint32 ) IntegerExpression {
49+ return CAST (jet .Uint32 (value )).AS_BIGINT ()
50+ }
51+
3752// Float creates new float literal expression
3853var Float = jet .Float
3954
Original file line number Diff line number Diff line change @@ -34,6 +34,21 @@ func TestInt64(t *testing.T) {
3434 assertSerialize (t , Int64 (val ), `$1::bigint` , val )
3535}
3636
37+ func TestUint8 (t * testing.T ) {
38+ val := uint8 (math .MaxUint8 )
39+ assertSerialize (t , Uint8 (val ), `$1::smallint` , val )
40+ }
41+
42+ func TestUint16 (t * testing.T ) {
43+ val := uint16 (math .MaxUint16 )
44+ assertSerialize (t , Uint16 (val ), `$1::integer` , val )
45+ }
46+
47+ func TestUint32 (t * testing.T ) {
48+ val := uint32 (math .MaxUint32 )
49+ assertSerialize (t , Uint32 (val ), `$1::bigint` , val )
50+ }
51+
3752func TestFloat (t * testing.T ) {
3853 assertSerialize (t , Float (12.34 ), `$1` , float64 (12.34 ))
3954
You can’t perform that action at this time.
0 commit comments