-
Notifications
You must be signed in to change notification settings - Fork 105
/
user.go
37 lines (28 loc) · 1.11 KB
/
user.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
package mock
import (
"context"
"github.com/benbjohnson/wtf"
)
var _ wtf.UserService = (*UserService)(nil)
type UserService struct {
FindUserByIDFn func(ctx context.Context, id int) (*wtf.User, error)
FindUsersFn func(ctx context.Context, filter wtf.UserFilter) ([]*wtf.User, int, error)
CreateUserFn func(ctx context.Context, user *wtf.User) error
UpdateUserFn func(ctx context.Context, id int, upd wtf.UserUpdate) (*wtf.User, error)
DeleteUserFn func(ctx context.Context, id int) error
}
func (s *UserService) FindUserByID(ctx context.Context, id int) (*wtf.User, error) {
return s.FindUserByIDFn(ctx, id)
}
func (s *UserService) FindUsers(ctx context.Context, filter wtf.UserFilter) ([]*wtf.User, int, error) {
return s.FindUsersFn(ctx, filter)
}
func (s *UserService) CreateUser(ctx context.Context, user *wtf.User) error {
return s.CreateUserFn(ctx, user)
}
func (s *UserService) UpdateUser(ctx context.Context, id int, upd wtf.UserUpdate) (*wtf.User, error) {
return s.UpdateUserFn(ctx, id, upd)
}
func (s *UserService) DeleteUser(ctx context.Context, id int) error {
return s.DeleteUserFn(ctx, id)
}