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

Method Rows

table.go:118–145  ·  view source on GitHub ↗

Rows returns the rows in datatable Computes all expressions.

(opt ...ExportOption)

Source from the content-addressed store, hash-verified

116// Rows returns the rows in datatable
117// Computes all expressions.
118func (t *DataTable) Rows(opt ...ExportOption) []Row {
119 if t == nil {
120 return nil
121 }
122
123 opts := newExportOptions(opt...)
124 if err := t.evaluateExpressions(); err != nil {
125 panic(err)
126 }
127
128 // visible columns
129 cols := make(map[string]int)
130 for i, col := range t.cols {
131 if opts.WithHiddenCols || col.IsVisible() {
132 cols[col.Name()] = i
133 }
134 }
135
136 rows := make([]Row, 0, t.nrows)
137 for i := 0; i < t.nrows; i++ {
138 r := make(Row, len(cols))
139 for name, pos := range cols {
140 r[name] = t.cols[pos].serie.Get(i)
141 }
142 rows = append(rows, r)
143 }
144 return rows
145}
146
147func (t *DataTable) String() string {
148 var sb strings.Builder

Callers 4

TestRowsFunction · 0.80
checkTableFunction · 0.80
TableMethod · 0.80
joinMethod · 0.80

Calls 5

evaluateExpressionsMethod · 0.95
newExportOptionsFunction · 0.85
IsVisibleMethod · 0.65
NameMethod · 0.65
GetMethod · 0.65

Tested by 2

TestRowsFunction · 0.64
checkTableFunction · 0.64