Skip to content

Commit

Permalink
VaryingDataTypeSlice String method
Browse files Browse the repository at this point in the history
  • Loading branch information
qdm12 committed Nov 24, 2022
1 parent 193a759 commit 8b68c0a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/scale/varying_data_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package scale

import (
"fmt"
"strings"
)

// VaryingDataTypeValue is used to represent scale encodable types of an associated VaryingDataType
Expand Down Expand Up @@ -34,6 +35,14 @@ func (vdts *VaryingDataTypeSlice) Add(values ...VaryingDataTypeValue) (err error
return
}

func (vdts VaryingDataTypeSlice) String() string {
stringTypes := make([]string, len(vdts.Types))
for i, vdt := range vdts.Types {
stringTypes[i] = vdt.String()
}
return "[" + strings.Join(stringTypes, ", ") + "]"
}

// NewVaryingDataTypeSlice is constructor for VaryingDataTypeSlice
func NewVaryingDataTypeSlice(vdt VaryingDataType) (vdts VaryingDataTypeSlice) {
vdts.VaryingDataType = vdt
Expand Down

0 comments on commit 8b68c0a

Please sign in to comment.