This commit is contained in:
John Kerl 2020-08-26 23:41:15 -04:00
parent a7359852c0
commit 481a894fd4
4 changed files with 38 additions and 30 deletions

View file

@ -0,0 +1,24 @@
package mapping
import (
"containers"
)
type MapperNothing struct {
// stateless
}
func NewMapperNothing() *MapperNothing {
return &MapperNothing {
}
}
func (this *MapperNothing) Name() string {
return "nothing"
}
func (this *MapperNothing) Map(inrec *containers.Lrec, outrecs chan<- *containers.Lrec) {
if inrec == nil { // end of stream
outrecs <- inrec
}
}

View file

@ -3,6 +3,7 @@ package mapping
func Create(mapperName string) RecordMapper {
switch mapperName {
case "cat": return NewMapperCat()
case "nothing": return NewMapperNothing()
case "tac": return NewMapperTac()
default: return nil
}

View file

@ -1,32 +1,15 @@
* input.RecordReader interface
* impls:
o dkvp
o xtab
o csv
o streaming json
o etc
* factory
* remove argf
* needs fresh start on each new filename
* lots of trivial things are just a matter of keystroking
* defer them while focusing on what's hard (and maybe most worthwhile about the Go port)
* mapper interface
* impls:
o cat
o cut
o head
o tail
o count
o ... lots more over time (if ever)
o defer DSL for a good long while
* factory
* defer then-chaining for the merest of moments
o needs []mapchan in the streamer
harder / more worthy:
* streaming JSON reader
* streaming RFC-compliant CSV reader
* sort
* stats1
* DSL
* calendar/DST/TZ
* output.RecordWriter interface
* impls:
o dkvp
o xtab
o csv
o json
o etc
* factory
easier:
* most of the verbs
* most of the file formats
* then-chaining