@@ -276,6 +276,16 @@ func TypeFromProto(t *proto.Type) Type {
276
276
TypeVariationRef : t .IntervalDay .TypeVariationReference ,
277
277
Precision : precision ,
278
278
}
279
+ case * proto.Type_IntervalCompound_ :
280
+ precision , err := ProtoToTimePrecision (t .IntervalCompound .Precision )
281
+ if err != nil {
282
+ panic (fmt .Sprintf ("Invalid precision %v" , err ))
283
+ }
284
+ return & IntervalCompoundType {
285
+ nullability : t .IntervalCompound .Nullability ,
286
+ typeVariationRef : t .IntervalCompound .TypeVariationReference ,
287
+ precision : precision ,
288
+ }
279
289
case * proto.Type_TimestampTz :
280
290
return & TimestampTzType {
281
291
Nullability : t .TimestampTz .Nullability ,
@@ -311,6 +321,26 @@ func TypeFromProto(t *proto.Type) Type {
311
321
Scale : t .Decimal .Scale ,
312
322
Precision : t .Decimal .Precision ,
313
323
}
324
+ case * proto.Type_PrecisionTimestamp_ :
325
+ precision , err := ProtoToTimePrecision (t .PrecisionTimestamp .Precision )
326
+ if err != nil {
327
+ panic (fmt .Sprintf ("Invalid precision %v" , err ))
328
+ }
329
+ return & PrecisionTimestampType {
330
+ Nullability : t .PrecisionTimestamp .Nullability ,
331
+ TypeVariationRef : t .PrecisionTimestamp .TypeVariationReference ,
332
+ Precision : precision ,
333
+ }
334
+ case * proto.Type_PrecisionTimestampTz :
335
+ precision , err := ProtoToTimePrecision (t .PrecisionTimestampTz .Precision )
336
+ if err != nil {
337
+ panic (fmt .Sprintf ("Invalid precision %v" , err ))
338
+ }
339
+ return & PrecisionTimestampTzType {PrecisionTimestampType {
340
+ Nullability : t .PrecisionTimestampTz .Nullability ,
341
+ TypeVariationRef : t .PrecisionTimestampTz .TypeVariationReference ,
342
+ Precision : precision ,
343
+ }}
314
344
case * proto.Type_Struct_ :
315
345
fields := make ([]Type , len (t .Struct .Types ))
316
346
for i , f := range t .Struct .Types {
@@ -655,6 +685,13 @@ func TypeToProto(t Type) *proto.Type {
655
685
Precision : & precision ,
656
686
Nullability : t .Nullability ,
657
687
TypeVariationReference : t .TypeVariationRef }}}
688
+ case IntervalCompoundType :
689
+ precision := t .precision .ToProtoVal ()
690
+ return & proto.Type {Kind : & proto.Type_IntervalCompound_ {
691
+ IntervalCompound : & proto.Type_IntervalCompound {
692
+ Precision : precision ,
693
+ Nullability : t .nullability ,
694
+ TypeVariationReference : t .typeVariationRef }}}
658
695
case * UUIDType :
659
696
return & proto.Type {Kind : & proto.Type_Uuid {
660
697
Uuid : & proto.Type_UUID {
@@ -680,6 +717,18 @@ func TypeToProto(t Type) *proto.Type {
680
717
TypeVariationReference : t .TypeVariationRef }}}
681
718
case * DecimalType :
682
719
return t .ToProto ()
720
+ case * PrecisionTimestampType :
721
+ return & proto.Type {Kind : & proto.Type_PrecisionTimestamp_ {
722
+ PrecisionTimestamp : & proto.Type_PrecisionTimestamp {
723
+ Precision : int32 (t .Precision ),
724
+ Nullability : t .Nullability ,
725
+ TypeVariationReference : t .TypeVariationRef }}}
726
+ case * PrecisionTimestampTzType :
727
+ return & proto.Type {Kind : & proto.Type_PrecisionTimestampTz {
728
+ PrecisionTimestampTz : & proto.Type_PrecisionTimestampTZ {
729
+ Precision : int32 (t .Precision ),
730
+ Nullability : t .Nullability ,
731
+ TypeVariationReference : t .TypeVariationRef }}}
683
732
case * StructType :
684
733
return t .ToProto ()
685
734
case * ListType :
0 commit comments