forked from cromon/ratchet2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
passthrough.go
29 lines (23 loc) · 918 Bytes
/
passthrough.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
package processors
import "github.com/rameshputalapattu/ratchet2/data"
// Passthrough simply passes the data on to the next stage.
// We have to set a placeholder field - if we leave this as an empty struct we get some properties
// for comparison and memory addressing that are not desirable and cause comparison bugs
// (see: http://dave.cheney.net/2014/03/25/the-empty-struct)
type Passthrough struct {
i int
}
// NewPassthrough instantiates a new instance of Passthrough
func NewPassthrough() *Passthrough {
return &Passthrough{}
}
// ProcessData blindly sends whatever it receives to the outputChan
func (r *Passthrough) ProcessData(d data.JSON, outputChan chan data.JSON, killChan chan error) {
outputChan <- d
}
// Finish - see interface for documentation.
func (r *Passthrough) Finish(outputChan chan data.JSON, killChan chan error) {
}
func (r *Passthrough) String() string {
return "Passthrough"
}