init: basic tools
This commit is contained in:
21
output_mem.go
Normal file
21
output_mem.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package script
|
||||
|
||||
import "context"
|
||||
|
||||
type MemWriter struct {
|
||||
rows [][]string
|
||||
}
|
||||
|
||||
func NewMemWriter() *MemWriter {
|
||||
return new(MemWriter)
|
||||
}
|
||||
|
||||
func (m *MemWriter) Write(_ context.Context, record []string) error {
|
||||
m.rows = append(m.rows, record)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *MemWriter) Output() [][]string {
|
||||
return m.rows
|
||||
}
|
Reference in New Issue
Block a user