Skip to content

Commit 6c398e5

Browse files
committed
revert String method in types.Type interface
1 parent fec0068 commit 6c398e5

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

internal/value/type.go

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010

1111
type Type interface {
1212
Yql() string
13+
String() string
1314

1415
toYDB(a *allocator.Allocator) *Ydb.Type
1516
equalsTo(rhs Type) bool
@@ -145,6 +146,10 @@ type DecimalType struct {
145146
Scale uint32
146147
}
147148

149+
func (v *DecimalType) String() string {
150+
return v.Yql()
151+
}
152+
148153
func (v *DecimalType) Name() string {
149154
return "Decimal"
150155
}
@@ -185,6 +190,10 @@ type dictType struct {
185190
valueType Type
186191
}
187192

193+
func (v *dictType) String() string {
194+
return v.Yql()
195+
}
196+
188197
func (v *dictType) Yql() string {
189198
buffer := allocator.Buffers.Get()
190199
defer allocator.Buffers.Put(buffer)
@@ -238,6 +247,10 @@ func (v emptyListType) Yql() string {
238247
return "EmptyList"
239248
}
240249

250+
func (v emptyListType) String() string {
251+
return v.Yql()
252+
}
253+
241254
func (emptyListType) equalsTo(rhs Type) bool {
242255
_, ok := rhs.(emptyListType)
243256
return ok
@@ -257,6 +270,10 @@ func EmptyList() emptyListType {
257270

258271
type emptyDictType struct{}
259272

273+
func (v emptyDictType) String() string {
274+
return v.Yql()
275+
}
276+
260277
func (v emptyDictType) Yql() string {
261278
return "EmptyDict"
262279
}
@@ -286,6 +303,10 @@ type listType struct {
286303
itemType Type
287304
}
288305

306+
func (v *listType) String() string {
307+
return v.Yql()
308+
}
309+
289310
func (v *listType) Yql() string {
290311
return "List<" + v.itemType.Yql() + ">"
291312
}
@@ -323,6 +344,10 @@ type setType struct {
323344
itemType Type
324345
}
325346

347+
func (v *setType) String() string {
348+
return v.Yql()
349+
}
350+
326351
func (v *setType) Yql() string {
327352
return "Set<" + v.itemType.Yql() + ">"
328353
}
@@ -360,6 +385,10 @@ type optionalType struct {
360385
innerType Type
361386
}
362387

388+
func (v optionalType) String() string {
389+
return v.Yql()
390+
}
391+
363392
func (v optionalType) Yql() string {
364393
return "Optional<" + v.innerType.Yql() + ">"
365394
}
@@ -394,6 +423,10 @@ func Optional(t Type) optionalType {
394423

395424
type PrimitiveType uint
396425

426+
func (v PrimitiveType) String() string {
427+
return v.Yql()
428+
}
429+
397430
func (v PrimitiveType) Yql() string {
398431
return primitiveString[v]
399432
}
@@ -506,6 +539,10 @@ type (
506539
}
507540
)
508541

542+
func (v *StructType) String() string {
543+
return v.Yql()
544+
}
545+
509546
func (v *StructType) Yql() string {
510547
buffer := allocator.Buffers.Get()
511548
defer allocator.Buffers.Put(buffer)
@@ -584,6 +621,10 @@ type TupleType struct {
584621
items []Type
585622
}
586623

624+
func (v *TupleType) String() string {
625+
return v.Yql()
626+
}
627+
587628
func (v *TupleType) Yql() string {
588629
buffer := allocator.Buffers.Get()
589630
defer allocator.Buffers.Put(buffer)
@@ -748,6 +789,10 @@ func VariantTuple(items ...Type) *variantTupleType {
748789

749790
type voidType struct{}
750791

792+
func (v voidType) String() string {
793+
return v.Yql()
794+
}
795+
751796
func (v voidType) Yql() string {
752797
return "Void"
753798
}
@@ -771,6 +816,10 @@ func Void() voidType {
771816

772817
type nullType struct{}
773818

819+
func (v nullType) String() string {
820+
return v.Yql()
821+
}
822+
774823
func (v nullType) Yql() string {
775824
return "Null"
776825
}

0 commit comments

Comments
 (0)