-
Notifications
You must be signed in to change notification settings - Fork 0
/
etl_test.go
69 lines (52 loc) · 1000 Bytes
/
etl_test.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package etl_test
import (
"context"
"log"
"reflect"
"testing"
"github.com/thearchitect/etl"
)
// https://github.com/polarsignals/frostdb
// https://github.com/kelindar/column
type Ares struct{}
func A(string) Ares {
return Ares{}
}
type Bres struct{}
func B(string) Bres {
return Bres{}
}
type Cres struct{}
func C(Ares, Bres) Cres {
return Cres{}
}
type Dres struct{}
func D(Ares, Bres) Dres {
return Dres{}
}
func E(Cres, Dres) int8 {
return 0
}
func F(Ares, Cres, Dres) int8 {
return 1
}
func TestName(t *testing.T) {
log.SetFlags(log.Lmicroseconds)
dag := etl.NewDAG[
func() (string, string),
func(int8, int8),
](func(node etl.NodeFunc) {
nA := node(A)
nB := node(B)
nC := node(C, nA, nB)
nD := node(D, nA, nB)
node(E, nC, nD)
node(F, nA, nC, nD)
})
log.Println(reflect.TypeOf(etl.Empty{}))
dag.Run(context.Background(), func() (inA string, inB string) {
return "", ""
}, func(resE int8, resF int8) {
log.Println("result", resE, resF)
})
}