Skip to content

Commit

Permalink
Final changes
Browse files Browse the repository at this point in the history
  • Loading branch information
maiadegraaf committed Jan 15, 2024
1 parent 1b6e9af commit f053e00
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 955 deletions.
47 changes: 24 additions & 23 deletions appender_modals.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,44 @@ import "strconv"
const standardListSize = 3000
const standardNestedListSize = 30

type ListInt struct {
L []int32
type ListString struct {
L []string
}

func (l *ListInt) Fill() ListInt {
func (l *ListString) Fill() ListString {
for j := 0; j < standardListSize; j++ {
l.L = append(l.L, int32(j))
l.L = append(l.L, strconv.Itoa(j)+" ducks are cool")
}
return *l
}

func (l *ListInt) FillFromInterface(i interface{}) ListInt {
inner := i.(map[string]interface{})["L"]
l.FillInnerFromInterface(inner.([]interface{}))
return *l
}

func (l *ListInt) FillInnerFromInterface(i []interface{}) ListInt {
func (l *ListString) FillFromInterface(i []interface{}) ListString {
for _, v := range i {
l.L = append(l.L, v.(int32))
l.L = append(l.L, v.(string))
}
return *l
}

type ListString struct {
L []string
type ListInt struct {
L []int32
}

func (l *ListString) Fill() ListString {
func (l *ListInt) Fill() ListInt {
for j := 0; j < standardListSize; j++ {
l.L = append(l.L, strconv.Itoa(j)+" ducks are cool")
l.L = append(l.L, int32(j))
}
return *l
}

func (l *ListString) FillFromInterface(i []interface{}) ListString {
func (l *ListInt) FillFromInterface(i interface{}) ListInt {
inner := i.(map[string]interface{})["L"]
l.FillInnerFromInterface(inner.([]interface{}))
return *l
}

func (l *ListInt) FillInnerFromInterface(i []interface{}) ListInt {
for _, v := range i {
l.L = append(l.L, v.(string))
l.L = append(l.L, v.(int32))
}
return *l
}
Expand All @@ -52,8 +52,8 @@ type NestedListInt struct {
}

func (l *NestedListInt) Fill() NestedListInt {
inner := ListInt{}
for j := 0; j < standardNestedListSize; j++ {
inner := ListInt{}
l.L = append(l.L, inner.Fill().L)
}
return *l
Expand All @@ -72,8 +72,8 @@ type TripleNestedListInt struct {
}

func (l *TripleNestedListInt) Fill() TripleNestedListInt {
inner := NestedListInt{}
for j := 0; j < standardNestedListSize; j++ {
for j := 0; j < standardNestedListSize/3; j++ {
inner := NestedListInt{}
l.L = append(l.L, inner.Fill().L)
}
return *l
Expand Down Expand Up @@ -184,16 +184,17 @@ type Mix struct {

func (m *Mix) Fill() Mix {
m.A.Fill()
l := ListInt{}
for j := 0; j < standardNestedListSize; j++ {
l := ListInt{}
m.B = append(m.B, l.Fill())
}
return *m
}

func (m *Mix) FillFromInterface(i interface{}) Mix {
inner := i.(map[string]interface{})
m.A.FillFromInterface(inner["A"].([]interface{}))
innerA := inner["A"].(map[string]interface{})
m.A.FillFromInterface(innerA["L"].([]interface{}))
for _, v := range inner["B"].([]interface{}) {
l := ListInt{}
m.B = append(m.B, l.FillFromInterface(v))
Expand Down
87 changes: 0 additions & 87 deletions appender_nested_2_test.go

This file was deleted.

79 changes: 0 additions & 79 deletions appender_nested_fancy_test.go

This file was deleted.

Loading

0 comments on commit f053e00

Please sign in to comment.