concat support joiner
@@ -30,4 +30,15 @@ func TestConcatTransformer(t *testing.T) {
exp = []Data{{"myword1": "20110218", "myword2": "1901", "myword3": "02", "myword": "20110218190102"}, {"abc": "x1"}}
assert.Equal(t, exp, data)
assert.Equal(t, concat.Stage(), transforms.StageAfterParser)
+
+ concat = &Concat{
+ Key: "myword1,myword2,myword3",
+ New: "myword",
+ joiner: "_",
+ }
+ data, err = concat.Transform([]Data{{"myword1": "20110218", "myword2": "1901", "myword3": "02"}, {"abc": "x1"}})
+ assert.Error(t, err)
+ exp = []Data{{"myword1": "20110218", "myword2": "1901", "myword3": "02", "myword": "20110218_1901_02"}, {"abc": "x1"}}
+ assert.Equal(t, exp, data)
+ assert.Equal(t, concat.Stage(), transforms.StageAfterParser)
}
