/
Repository.go
95 lines (75 loc) · 2.41 KB
/
Repository.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// Code generated by mockery v2.12.3. DO NOT EDIT.
package mocks
import (
context "context"
productrecord "github.com/Gopher-Rangers/mercadofresco-gopherrangers/internal/product_record"
mock "github.com/stretchr/testify/mock"
)
// Repository is an autogenerated mock type for the Repository type
type Repository struct {
mock.Mock
}
// GetAll provides a mock function with given fields: ctx
func (_m *Repository) GetAll(ctx context.Context) ([]productrecord.ProductRecordGet, error) {
ret := _m.Called(ctx)
var r0 []productrecord.ProductRecordGet
if rf, ok := ret.Get(0).(func(context.Context) []productrecord.ProductRecordGet); ok {
r0 = rf(ctx)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]productrecord.ProductRecordGet)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context) error); ok {
r1 = rf(ctx)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetById provides a mock function with given fields: ctx, id
func (_m *Repository) GetById(ctx context.Context, id int) (productrecord.ProductRecordGet, error) {
ret := _m.Called(ctx, id)
var r0 productrecord.ProductRecordGet
if rf, ok := ret.Get(0).(func(context.Context, int) productrecord.ProductRecordGet); ok {
r0 = rf(ctx, id)
} else {
r0 = ret.Get(0).(productrecord.ProductRecordGet)
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, int) error); ok {
r1 = rf(ctx, id)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Store provides a mock function with given fields: ctx, prod
func (_m *Repository) Store(ctx context.Context, prod productrecord.ProductRecord) (productrecord.ProductRecord, error) {
ret := _m.Called(ctx, prod)
var r0 productrecord.ProductRecord
if rf, ok := ret.Get(0).(func(context.Context, productrecord.ProductRecord) productrecord.ProductRecord); ok {
r0 = rf(ctx, prod)
} else {
r0 = ret.Get(0).(productrecord.ProductRecord)
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, productrecord.ProductRecord) error); ok {
r1 = rf(ctx, prod)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
type NewRepositoryT interface {
mock.TestingT
Cleanup(func())
}
// NewRepository creates a new instance of Repository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewRepository(t NewRepositoryT) *Repository {
mock := &Repository{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}