miller/pkg/output/record_writer.go
Adam Lesperance 085e831668
The package version must match the major tag version (#1654)
* Update package version

* Update makefile targets

* Update readme packages

* Remaining old packages via rg/sd
2024-09-20 12:10:11 -04:00

26 lines
741 B
Go

package output
import (
"bufio"
"github.com/johnkerl/miller/v6/pkg/mlrval"
"github.com/johnkerl/miller/v6/pkg/types"
)
// IRecordWriter is the abstract interface for all record-writers. They are
// specific to output file format, e.g. CSV, PPRINT, JSON, etc.
//
// Convention: nil outrec signifies end of record stream.
//
// The ChannelWriter will call bufferedOutputStream.Flush() after every record
// if the --fflush flag (writerOptions.FlushOnEveryRecord) is present, so each
// writer does not have to -- unless the writer retains records e.g. for PPRINT
// format.
type IRecordWriter interface {
Write(
outrec *mlrval.Mlrmap,
context *types.Context,
bufferedOutputStream *bufio.Writer,
outputIsStdout bool,
) error
}