MCPcopy Create free account
hub / github.com/datasweet/datatable / Records

Method Records

table.go:88–114  ·  view source on GitHub ↗

Records returns the rows in datatable as string Computes all expressions.

()

Source from the content-addressed store, hash-verified

86// Records returns the rows in datatable as string
87// Computes all expressions.
88func (t *DataTable) Records() [][]string {
89 if t == nil {
90 return nil
91 }
92
93 if err := t.evaluateExpressions(); err != nil {
94 panic(err)
95 }
96
97 // visible columns
98 var cols []int
99 for i, col := range t.cols {
100 if col.IsVisible() {
101 cols = append(cols, i)
102 }
103 }
104
105 rows := make([][]string, 0, t.nrows)
106 for i := 0; i < t.nrows; i++ {
107 r := make([]string, 0, len(cols))
108 for _, pos := range cols {
109 r = append(r, fmt.Sprintf("%v", t.cols[pos].serie.Get(i)))
110 }
111 rows = append(rows, r)
112 }
113 return rows
114}
115
116// Rows returns the rows in datatable
117// Computes all expressions.

Callers 1

PrintMethod · 0.95

Calls 3

evaluateExpressionsMethod · 0.95
IsVisibleMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected