-
Notifications
You must be signed in to change notification settings - Fork 45
/
pager.go
51 lines (38 loc) · 982 Bytes
/
pager.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
51
package mock
import (
"context"
"github.com/blacklightcms/recurly"
)
var _ recurly.Pager = &Pager{}
type Pager struct {
OnCount func(ctx context.Context) (int, error)
CountInvoked bool
OnNext func() bool
NextInvoked bool
OnCursor func() string
CursorInvoked bool
OnFetch func(ctx context.Context, dst interface{}) error
FetchInvoked bool
OnFetchAll func(ctx context.Context, dst interface{}) error
FetchAllInvoked bool
}
func (m *Pager) Count(ctx context.Context) (int, error) {
m.CountInvoked = true
return m.OnCount(ctx)
}
func (m *Pager) Next() bool {
m.NextInvoked = true
return m.OnNext()
}
func (m *Pager) Cursor() string {
m.CursorInvoked = true
return m.OnCursor()
}
func (m *Pager) Fetch(ctx context.Context, dst interface{}) error {
m.FetchInvoked = true
return m.OnFetch(ctx, dst)
}
func (m *Pager) FetchAll(ctx context.Context, dst interface{}) error {
m.FetchAllInvoked = true
return m.OnFetchAll(ctx, dst)
}