-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathmain.go
51 lines (42 loc) · 887 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// basic example illustrates how to build a very simple baker-based program with just
// input and output components
package main
import (
"log"
"strings"
"github.com/AdRoll/baker"
"github.com/AdRoll/baker/filter"
"github.com/AdRoll/baker/input"
"github.com/AdRoll/baker/output"
)
func main() {
toml := `
[fields]
names=["timestamp", "source", "target"]
[input]
name = "List"
[input.config]
files=["testdata/input.csv.zst"]
[[filter]]
name="ReplaceFields"
[filter.config]
ReplaceFields=["replaced", "timestamp"]
[output]
name = "FileWriter"
procs=1
[output.config]
PathString="/tmp/_out/output.csv.gz"
`
c := baker.Components{
Inputs: input.All,
Outputs: output.All,
Filters: filter.All,
}
cfg, err := baker.NewConfigFromToml(strings.NewReader(toml), c)
if err != nil {
log.Fatal(err)
}
if err := baker.Main(cfg); err != nil {
log.Fatal(err)
}
}