-
Notifications
You must be signed in to change notification settings - Fork 106
/
dial.go
49 lines (38 loc) · 1.77 KB
/
dial.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
package mock
import (
"context"
"time"
"github.com/benbjohnson/wtf"
)
var _ wtf.DialService = (*DialService)(nil)
// DialService represents a mock of wtf.DialService.
type DialService struct {
FindDialByIDFn func(ctx context.Context, id int) (*wtf.Dial, error)
FindDialsFn func(ctx context.Context, filter wtf.DialFilter) ([]*wtf.Dial, int, error)
CreateDialFn func(ctx context.Context, dial *wtf.Dial) error
UpdateDialFn func(ctx context.Context, id int, upd wtf.DialUpdate) (*wtf.Dial, error)
DeleteDialFn func(ctx context.Context, id int) error
SetDialMembershipValueFn func(ctx context.Context, dialID, value int) error
AverageDialValueReportFn func(ctx context.Context, start, end time.Time, interval time.Duration) (*wtf.DialValueReport, error)
}
func (s *DialService) FindDialByID(ctx context.Context, id int) (*wtf.Dial, error) {
return s.FindDialByIDFn(ctx, id)
}
func (s *DialService) FindDials(ctx context.Context, filter wtf.DialFilter) ([]*wtf.Dial, int, error) {
return s.FindDialsFn(ctx, filter)
}
func (s *DialService) CreateDial(ctx context.Context, dial *wtf.Dial) error {
return s.CreateDialFn(ctx, dial)
}
func (s *DialService) UpdateDial(ctx context.Context, id int, upd wtf.DialUpdate) (*wtf.Dial, error) {
return s.UpdateDialFn(ctx, id, upd)
}
func (s *DialService) DeleteDial(ctx context.Context, id int) error {
return s.DeleteDialFn(ctx, id)
}
func (s *DialService) SetDialMembershipValue(ctx context.Context, dialID, value int) error {
return s.SetDialMembershipValueFn(ctx, dialID, value)
}
func (s *DialService) AverageDialValueReport(ctx context.Context, start, end time.Time, interval time.Duration) (*wtf.DialValueReport, error) {
return s.AverageDialValueReportFn(ctx, start, end, interval)
}