init: basic tools

This commit is contained in:
2025-08-30 22:00:31 +03:00
commit ec5db88f97
13 changed files with 467 additions and 0 deletions

29
input_mem.go Normal file
View File

@@ -0,0 +1,29 @@
package script
import (
"context"
"io"
)
type MemReader struct {
rows [][]string
curr int
}
func NewMemReader(records [][]string) *MemReader {
return &MemReader{
rows: records,
}
}
func (m *MemReader) Read(context.Context) ([]string, error) {
if m.curr == len(m.rows) || len(m.rows) == 0 {
return nil, io.EOF
}
defer func() {
m.curr++
}()
return m.rows[m.curr], nil
}