2023-07-06 13:48:19 +02:00
|
|
|
package table
|
|
|
|
|
|
|
|
type Table struct {
|
|
|
|
RawRows []Row
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *Table) AddFailed(rows ...Row) {
|
|
|
|
for _, row := range rows {
|
|
|
|
if row.IsFailure {
|
|
|
|
t.RawRows = append(t.RawRows, row)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *Table) Add(rows ...Row) {
|
|
|
|
t.RawRows = append(t.RawRows, rows...)
|
|
|
|
}
|
|
|
|
|
2023-09-07 04:53:37 +02:00
|
|
|
func (t *Table) Rows(detailed bool) interface{} {
|
|
|
|
if detailed {
|
|
|
|
return t.RawRows
|
|
|
|
}
|
2024-05-20 17:16:35 +08:00
|
|
|
rows := make([]RowCompact, 0, len(t.RawRows))
|
2023-09-07 04:53:37 +02:00
|
|
|
for _, row := range t.RawRows {
|
|
|
|
rows = append(rows, row.RowCompact)
|
|
|
|
}
|
|
|
|
return rows
|
2023-07-06 13:48:19 +02:00
|
|
|
}
|