Skip to content

Commit 2f5d118

Browse files
committed
renamed single-character struct field names with understood names
1 parent d727d4b commit 2f5d118

File tree

2 files changed

+112
-106
lines changed

2 files changed

+112
-106
lines changed

internal/value/type.go

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -191,15 +191,15 @@ func Decimal(precision, scale uint32) *DecimalType {
191191
}
192192

193193
type dictType struct {
194-
k Type
195-
v Type
194+
keyType Type
195+
valueType Type
196196
}
197197

198198
func (v *dictType) toString(buffer *bytes.Buffer) {
199199
buffer.WriteString("Dict<")
200-
v.k.toString(buffer)
200+
v.keyType.toString(buffer)
201201
buffer.WriteByte(',')
202-
v.v.toString(buffer)
202+
v.valueType.toString(buffer)
203203
buffer.WriteByte('>')
204204
}
205205

@@ -215,10 +215,10 @@ func (v *dictType) equalsTo(rhs Type) bool {
215215
if !ok {
216216
return false
217217
}
218-
if !v.k.equalsTo(vv.k) {
218+
if !v.keyType.equalsTo(vv.keyType) {
219219
return false
220220
}
221-
if !v.v.equalsTo(vv.v) {
221+
if !v.valueType.equalsTo(vv.valueType) {
222222
return false
223223
}
224224
return true
@@ -231,8 +231,8 @@ func (v *dictType) toYDB(a *allocator.Allocator) *Ydb.Type {
231231

232232
typeDict.DictType = a.Dict()
233233

234-
typeDict.DictType.Key = v.k.toYDB(a)
235-
typeDict.DictType.Payload = v.v.toYDB(a)
234+
typeDict.DictType.Key = v.keyType.toYDB(a)
235+
typeDict.DictType.Payload = v.valueType.toYDB(a)
236236

237237
t.Type = typeDict
238238

@@ -241,8 +241,8 @@ func (v *dictType) toYDB(a *allocator.Allocator) *Ydb.Type {
241241

242242
func Dict(key, value Type) (v *dictType) {
243243
return &dictType{
244-
k: key,
245-
v: value,
244+
keyType: key,
245+
valueType: value,
246246
}
247247
}
248248

@@ -277,12 +277,12 @@ func EmptyList() emptyListType {
277277
}
278278

279279
type listType struct {
280-
t Type
280+
itemType Type
281281
}
282282

283283
func (v *listType) toString(buffer *bytes.Buffer) {
284284
buffer.WriteString("List<")
285-
v.t.toString(buffer)
285+
v.itemType.toString(buffer)
286286
buffer.WriteString(">")
287287
}
288288

@@ -298,15 +298,15 @@ func (v *listType) equalsTo(rhs Type) bool {
298298
if !ok {
299299
return false
300300
}
301-
return v.t.equalsTo(vv.t)
301+
return v.itemType.equalsTo(vv.itemType)
302302
}
303303

304304
func (v *listType) toYDB(a *allocator.Allocator) *Ydb.Type {
305305
t := a.Type()
306306

307307
list := a.List()
308308

309-
list.Item = v.t.toYDB(a)
309+
list.Item = v.itemType.toYDB(a)
310310

311311
typeList := a.TypeList()
312312
typeList.ListType = list
@@ -318,17 +318,17 @@ func (v *listType) toYDB(a *allocator.Allocator) *Ydb.Type {
318318

319319
func List(t Type) *listType {
320320
return &listType{
321-
t: t,
321+
itemType: t,
322322
}
323323
}
324324

325325
type optionalType struct {
326-
t Type
326+
innerType Type
327327
}
328328

329329
func (v *optionalType) toString(buffer *bytes.Buffer) {
330330
buffer.WriteString("Optional<")
331-
v.t.toString(buffer)
331+
v.innerType.toString(buffer)
332332
buffer.WriteString(">")
333333
}
334334

@@ -344,7 +344,7 @@ func (v *optionalType) equalsTo(rhs Type) bool {
344344
if !ok {
345345
return false
346346
}
347-
return v.t.equalsTo(vv.t)
347+
return v.innerType.equalsTo(vv.innerType)
348348
}
349349

350350
func (v *optionalType) toYDB(a *allocator.Allocator) *Ydb.Type {
@@ -354,7 +354,7 @@ func (v *optionalType) toYDB(a *allocator.Allocator) *Ydb.Type {
354354

355355
typeOptional.OptionalType = a.Optional()
356356

357-
typeOptional.OptionalType.Item = v.t.toYDB(a)
357+
typeOptional.OptionalType.Item = v.innerType.toYDB(a)
358358

359359
t.Type = typeOptional
360360

@@ -363,7 +363,7 @@ func (v *optionalType) toYDB(a *allocator.Allocator) *Ydb.Type {
363363

364364
func Optional(t Type) *optionalType {
365365
return &optionalType{
366-
t: t,
366+
innerType: t,
367367
}
368368
}
369369

@@ -642,13 +642,13 @@ const (
642642
)
643643

644644
type variantType struct {
645-
t Type
646-
tt internalVariantType
645+
innerType Type
646+
variantType internalVariantType
647647
}
648648

649649
func (v *variantType) toString(buffer *bytes.Buffer) {
650650
buffer.WriteString("Variant<")
651-
v.t.toString(buffer)
651+
v.innerType.toString(buffer)
652652
buffer.WriteString(">")
653653
}
654654

@@ -664,7 +664,7 @@ func (v *variantType) equalsTo(rhs Type) bool {
664664
if !ok {
665665
return false
666666
}
667-
return v.t.equalsTo(vv.t)
667+
return v.innerType.equalsTo(vv.innerType)
668668
}
669669

670670
func (v *variantType) toYDB(a *allocator.Allocator) *Ydb.Type {
@@ -674,9 +674,9 @@ func (v *variantType) toYDB(a *allocator.Allocator) *Ydb.Type {
674674

675675
typeVariant.VariantType = a.Variant()
676676

677-
tt := v.t.toYDB(a).Type
677+
tt := v.innerType.toYDB(a).Type
678678

679-
switch v.tt {
679+
switch v.variantType {
680680
case variantTypeTuple:
681681
tupleType, ok := tt.(*Ydb.Type_TupleType)
682682
if !ok {
@@ -698,7 +698,7 @@ func (v *variantType) toYDB(a *allocator.Allocator) *Ydb.Type {
698698

699699
typeVariant.VariantType.Type = structItems
700700
default:
701-
panic(fmt.Sprintf("unsupported variant type: %v", v.tt))
701+
panic(fmt.Sprintf("unsupported variant type: %v", v.variantType))
702702
}
703703

704704
t.Type = typeVariant
@@ -708,7 +708,7 @@ func (v *variantType) toYDB(a *allocator.Allocator) *Ydb.Type {
708708

709709
func Variant(t Type) *variantType {
710710
if tt, ok := t.(*variantType); ok {
711-
t = tt.t
711+
t = tt.innerType
712712
}
713713
var tt internalVariantType
714714
switch t.(type) {
@@ -720,8 +720,8 @@ func Variant(t Type) *variantType {
720720
panic(fmt.Sprintf("unsupported variant type: %v", t))
721721
}
722722
return &variantType{
723-
t: t,
724-
tt: tt,
723+
innerType: t,
724+
variantType: tt,
725725
}
726726
}
727727

0 commit comments

Comments
 (0)