MCPcopy
hub / github.com/chrislusf/glow / testSelfJoin

Function testSelfJoin

examples/word_count/word_count.go:87–104  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

85}
86
87func testSelfJoin() {
88 words := flow.New().TextFile(
89 "/etc/passwd", 3,
90 ).Filter(func(line string) bool {
91 return !strings.HasPrefix(line, "#")
92 }).Map(func(line string, ch chan string) {
93 for _, token := range strings.Split(line, ":") {
94 ch <- token
95 }
96 }).Map(func(line string) (string, string) {
97 return line, line
98 })
99
100 words.Join(words).Map(func(key, left, right string) {
101 println(key, ":", left, ":", right)
102 }).Run()
103
104}
105
106func testJoin() {
107 reg, err := regexp.Compile("[^A-Za-z0-9]+")

Callers 1

mainFunction · 0.85

Calls 5

MapMethod · 0.80
FilterMethod · 0.80
TextFileMethod · 0.80
JoinMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected