forked from percona/pmgo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpipe.go
50 lines (40 loc) · 834 Bytes
/
pipe.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
package mgoi
import "github.com/globalsign/mgo"
type PipeManager interface {
All(result interface{}) error
AllowDiskUse() PipeManager
Batch(n int) PipeManager
Explain(result interface{}) error
Iter() *mgo.Iter
One(result interface{}) error
}
type Pipe struct {
pipe *mgo.Pipe
}
func NewPipeManager(p *mgo.Pipe) PipeManager {
return &Pipe{
pipe: p,
}
}
func (p *Pipe) All(result interface{}) error {
return p.pipe.All(result)
}
func (p *Pipe) AllowDiskUse() PipeManager {
return &Pipe{
pipe: p.pipe,
}
}
func (p *Pipe) Batch(n int) PipeManager {
return &Pipe{
pipe: p.pipe.Batch(n),
}
}
func (p *Pipe) Explain(result interface{}) error {
return p.pipe.Explain(result)
}
func (p *Pipe) Iter() *mgo.Iter {
return p.pipe.Iter()
}
func (p *Pipe) One(result interface{}) error {
return p.pipe.One(result)
}