Skip to content

Commit

Permalink
Correct fix to append just data item on list bind
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Dec 14, 2020
1 parent dad0a20 commit 41fe50b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
10 changes: 5 additions & 5 deletions data/binding/bindlists.go
Expand Up @@ -33,7 +33,7 @@ func BindBoolList(v *[]bool) BoolList {
b := &boundBoolList{val: v}

for _, i := range *v {
b.Append(i)
b.appendItem(BindBool(&i))
}

return b
Expand Down Expand Up @@ -113,7 +113,7 @@ func BindFloatList(v *[]float64) FloatList {
b := &boundFloatList{val: v}

for _, i := range *v {
b.Append(i)
b.appendItem(BindFloat(&i))
}

return b
Expand Down Expand Up @@ -193,7 +193,7 @@ func BindIntList(v *[]int) IntList {
b := &boundIntList{val: v}

for _, i := range *v {
b.Append(i)
b.appendItem(BindInt(&i))
}

return b
Expand Down Expand Up @@ -273,7 +273,7 @@ func BindRuneList(v *[]rune) RuneList {
b := &boundRuneList{val: v}

for _, i := range *v {
b.Append(i)
b.appendItem(BindRune(&i))
}

return b
Expand Down Expand Up @@ -353,7 +353,7 @@ func BindStringList(v *[]string) StringList {
b := &boundStringList{val: v}

for _, i := range *v {
b.Append(i)
b.appendItem(BindString(&i))
}

return b
Expand Down
3 changes: 3 additions & 0 deletions data/binding/bindlists_test.go
Expand Up @@ -12,6 +12,9 @@ func TestBindFloatList(t *testing.T) {

assert.Equal(t, 3, f.Length())
assert.Equal(t, 5.0, f.Get(1))

assert.NotNil(t, f.(*boundFloatList).val)
assert.Equal(t, 3, len(*(f.(*boundFloatList).val)))
}

func TestNewFloatList(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion data/binding/gen.go
Expand Up @@ -247,7 +247,7 @@ func Bind{{ .Name }}List(v *[]{{ .Type }}) {{ .Name }}List {
b := &bound{{ .Name }}List{val: v}
for _, i := range *v {
b.Append(i)
b.appendItem(Bind{{ .Name }}(&i))
}
return b
Expand Down

0 comments on commit 41fe50b

Please sign in to comment.