diff options
-rw-r--r-- | skate/cmd/skate-map/main.go | 2 | ||||
-rw-r--r-- | skate/map.go | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/skate/cmd/skate-map/main.go b/skate/cmd/skate-map/main.go index e72cc0c..ffe1017 100644 --- a/skate/cmd/skate-map/main.go +++ b/skate/cmd/skate-map/main.go @@ -25,7 +25,7 @@ var ( func main() { flag.Parse() // XXX: introduce prefixes - availableMappers := map[string]skate.FieldMapper{ + availableMappers := map[string]skate.Mapper{ "id": skate.Identity, "ff": skate.CreateFixedMapper(*extraValue), "title": skate.MapperTitle, diff --git a/skate/map.go b/skate/map.go index 9cad1e4..2cb4ebc 100644 --- a/skate/map.go +++ b/skate/map.go @@ -31,13 +31,13 @@ type PartialDoc struct { Year string `json:"release_year"` } -// FieldMapper maps a blob to an arbitrary number of fields, e.g. for (key, +// Mapper maps a blob to an arbitrary number of fields, e.g. for (key, // doc). We want fields, but we do not want to bake in TSV into each function. -type FieldMapper func([]byte) ([][]byte, error) +type Mapper func([]byte) ([][]byte, error) // TSV serialized the result of a field mapper as TSV. This is a slim adapter, // e.g. to parallel.Processor, which expects this function signature. -func (f FieldMapper) TSV(p []byte) ([]byte, error) { +func (f Mapper) TSV(p []byte) ([]byte, error) { fields, err := f(p) if err != nil { return nil, err @@ -63,7 +63,7 @@ func Identity(p []byte) ([][]byte, error) { // CreateFixedMapper extract the value from a given fixed top level json key. // Returns a function that maps doc to (v, doc). -func CreateFixedMapper(field string) FieldMapper { +func CreateFixedMapper(field string) Mapper { f := func(p []byte) ([][]byte, error) { var ( doc map[string]interface{} |