Skip to content

Commit a5b649a

Browse files
committed
test: added tests for TzDate, TzDatetime, TzTimestamp
1 parent 6ceed97 commit a5b649a

File tree

1 file changed

+99
-0
lines changed

1 file changed

+99
-0
lines changed

internal/params/struct_test.go

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,105 @@ func TestStruct(t *testing.T) {
810810
},
811811
},
812812
},
813+
{
814+
name: xtest.CurrentFileLine(),
815+
builder: Builder{}.Param("$x").BeginStruct().Field("col1").TzDatetime(time.Unix(123456789, 456).UTC()).EndStruct(),
816+
params: map[string]*Ydb.TypedValue{
817+
"$x": {
818+
Type: &Ydb.Type{
819+
Type: &Ydb.Type_StructType{
820+
StructType: &Ydb.StructType{
821+
Members: []*Ydb.StructMember{
822+
{
823+
Name: "col1",
824+
Type: &Ydb.Type{
825+
Type: &Ydb.Type_TypeId{
826+
TypeId: Ydb.Type_TZ_DATETIME,
827+
},
828+
},
829+
},
830+
},
831+
},
832+
},
833+
},
834+
Value: &Ydb.Value{
835+
Items: []*Ydb.Value{
836+
{
837+
Value: &Ydb.Value_TextValue{
838+
TextValue: "1973-11-29T21:33:09Z",
839+
},
840+
},
841+
},
842+
},
843+
},
844+
},
845+
},
846+
{
847+
name: xtest.CurrentFileLine(),
848+
builder: Builder{}.Param("$x").BeginStruct().Field("col1").TzDate(time.Unix(123456789, 456).UTC()).EndStruct(),
849+
params: map[string]*Ydb.TypedValue{
850+
"$x": {
851+
Type: &Ydb.Type{
852+
Type: &Ydb.Type_StructType{
853+
StructType: &Ydb.StructType{
854+
Members: []*Ydb.StructMember{
855+
{
856+
Name: "col1",
857+
Type: &Ydb.Type{
858+
Type: &Ydb.Type_TypeId{
859+
TypeId: Ydb.Type_TZ_DATE,
860+
},
861+
},
862+
},
863+
},
864+
},
865+
},
866+
},
867+
Value: &Ydb.Value{
868+
Items: []*Ydb.Value{
869+
{
870+
Value: &Ydb.Value_TextValue{
871+
TextValue: "1973-11-29",
872+
},
873+
},
874+
},
875+
},
876+
},
877+
},
878+
},
879+
{
880+
name: xtest.CurrentFileLine(),
881+
builder: Builder{}.Param("$x").BeginStruct().Field("col1").TzTimestamp(time.Unix(123456789, 456).UTC()).EndStruct(),
882+
params: map[string]*Ydb.TypedValue{
883+
"$x": {
884+
Type: &Ydb.Type{
885+
Type: &Ydb.Type_StructType{
886+
StructType: &Ydb.StructType{
887+
Members: []*Ydb.StructMember{
888+
{
889+
Name: "col1",
890+
Type: &Ydb.Type{
891+
Type: &Ydb.Type_TypeId{
892+
TypeId: Ydb.Type_TZ_TIMESTAMP,
893+
},
894+
},
895+
},
896+
},
897+
},
898+
},
899+
},
900+
Value: &Ydb.Value{
901+
Items: []*Ydb.Value{
902+
{
903+
Value: &Ydb.Value_TextValue{
904+
TextValue: "1973-11-29T21:33:09.000000Z",
905+
},
906+
},
907+
},
908+
},
909+
},
910+
},
911+
},
813912
} {
814913
t.Run(tt.name, func(t *testing.T) {
815914
a := allocator.New()

0 commit comments

Comments
 (0)