exportToBytes is a helper function that exports to a byte slice using a writer function.
(result *v1pb.QueryResult, writerFunc Writer)
| 20 | |
| 21 | // exportToBytes is a helper function that exports to a byte slice using a writer function. |
| 22 | func exportToBytes(result *v1pb.QueryResult, writerFunc Writer) ([]byte, error) { |
| 23 | var buf bytes.Buffer |
| 24 | if err := writerFunc(&buf, result); err != nil { |
| 25 | return nil, err |
| 26 | } |
| 27 | return buf.Bytes(), nil |
| 28 | } |
| 29 | |
| 30 | func formatTimestamp(ts *v1pb.RowValue_Timestamp) string { |
| 31 | return ts.GoogleTimestamp.AsTime().Format(timestampFormat) |