JSON marshals the table rows as a JSON array. A header-only table marshals to "[]".
()
| 85 | // JSON marshals the table rows as a JSON array. A header-only table marshals |
| 86 | // to "[]". |
| 87 | func (t *Table) JSON() ([]byte, error) { |
| 88 | if t.Rows == nil { |
| 89 | return []byte("[]"), nil |
| 90 | } |
| 91 | return json.Marshal(t.Rows) |
| 92 | } |
| 93 | |
| 94 | // HasColumns reports whether every named column is present in the header. |
| 95 | func (t *Table) HasColumns(cols ...string) bool { |
no outgoing calls