-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconn_mock.go
72 lines (62 loc) · 2.1 KB
/
conn_mock.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package jobworker
import (
"context"
)
type ConnectorMock struct {
NameFunc func() string
SubscribeFunc func(ctx context.Context, input *SubscribeInput) (*SubscribeOutput, error)
EnqueueFunc func(ctx context.Context, input *EnqueueInput) (*EnqueueOutput, error)
EnqueueBatchFunc func(ctx context.Context, input *EnqueueBatchInput) (*EnqueueBatchOutput, error)
CompleteJobFunc func(ctx context.Context, input *CompleteJobInput) (*CompleteJobOutput, error)
FailJobFunc func(ctx context.Context, input *FailJobInput) (*FailJobOutput, error)
CloseFunc func() error
SetLoggerFuncFunc func(f LoggerFunc)
}
func (m *ConnectorMock) Name() string {
if m.NameFunc == nil {
panic("This method is not defined.")
}
return m.NameFunc()
}
func (m *ConnectorMock) Subscribe(ctx context.Context, input *SubscribeInput) (*SubscribeOutput, error) {
if m.SubscribeFunc == nil {
panic("This method is not defined.")
}
return m.SubscribeFunc(ctx, input)
}
func (m *ConnectorMock) Enqueue(ctx context.Context, input *EnqueueInput) (*EnqueueOutput, error) {
if m.EnqueueFunc == nil {
panic("This method is not defined.")
}
return m.EnqueueFunc(ctx, input)
}
func (m *ConnectorMock) EnqueueBatch(ctx context.Context, input *EnqueueBatchInput) (*EnqueueBatchOutput, error) {
if m.EnqueueBatchFunc == nil {
panic("This method is not defined.")
}
return m.EnqueueBatchFunc(ctx, input)
}
func (m *ConnectorMock) CompleteJob(ctx context.Context, input *CompleteJobInput) (*CompleteJobOutput, error) {
if m.CompleteJobFunc == nil {
panic("This method is not defined.")
}
return m.CompleteJobFunc(ctx, input)
}
func (m *ConnectorMock) FailJob(ctx context.Context, input *FailJobInput) (*FailJobOutput, error) {
if m.FailJobFunc == nil {
panic("This method is not defined.")
}
return m.FailJobFunc(ctx, input)
}
func (m *ConnectorMock) Close() error {
if m.CloseFunc == nil {
panic("This method is not defined.")
}
return m.CloseFunc()
}
func (m *ConnectorMock) SetLoggerFunc(f LoggerFunc) {
if m.SetLoggerFuncFunc == nil {
panic("This method is not defined.")
}
m.SetLoggerFuncFunc(f)
}