add: logparser v5 shared record
This commit is contained in:
31
logparser/v5/passthrough.go
Normal file
31
logparser/v5/passthrough.go
Normal 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)
|
||||
})
|
||||
|
||||
}
|
Reference in New Issue
Block a user