Skip to content

Commit fb931eb

Browse files
committed
fix: struct orientation fix #3
1 parent f207835 commit fb931eb

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

encoding_structs.go

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,12 @@ func structToTable(s interface{}) (*STable, error) {
4747
caption := t.Name()
4848
table := New(caption)
4949

50-
table.AddFieldWithOptions("key", &Options{
51-
HeaderAlignment: AlignmentLeft,
52-
})
53-
54-
table.AddFieldWithOptions("value", &Options{
55-
HeaderAlignment: AlignmentLeft,
56-
})
57-
5850
fieldNames := getFieldNames(v, t)
51+
table.AddFields(fieldNames...)
52+
5953
fieldValues := getFieldValues(v, t)
54+
table.Row(fieldValues...)
6055

61-
for i := range fieldNames {
62-
key := fieldNames[i]
63-
value := fieldValues[i]
64-
table.Row(key, value)
65-
}
6656
return table, nil
6757
}
6858

0 commit comments

Comments
 (0)