add: logparser v5 shared record

This commit is contained in:
Inanc Gumus
2019-08-29 01:32:25 +03:00
parent 81b4246973
commit 4910370808
9 changed files with 116 additions and 24 deletions

View File

@ -0,0 +1,31 @@
// For more tutorials: https://blog.learngoprogramming.com
//
// Copyright © 2018 Inanc Gumus
// Learn Go Programming Course
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
//
package main
import (
"github.com/inancgumus/learngo/logparser/v5/pipe"
)
type passThrough struct {
pipe.Iterator
}
func (t *passThrough) Consume(results pipe.Iterator) error {
t.Iterator = results
return nil
}
func (t *passThrough) Each(yield func(pipe.Record) error) error {
return t.Iterator.Each(func(r pipe.Record) error {
// fmt.Println(r.Fields())
// fmt.Println(r.Int("visits"))
return yield(r)
})
}