MCPcopy
hub / github.com/benbjohnson/wtf / UserService

Interface UserService

user.go:51–72  ·  view source on GitHub ↗

UserService represents a service for managing users.

Source from the content-addressed store, hash-verified

49
50// UserService represents a service for managing users.
51type UserService interface {
52 // Retrieves a user by ID along with their associated auth objects.
53 // Returns ENOTFOUND if user does not exist.
54 FindUserByID(ctx context.Context, id int) (*User, error)
55
56 // Retrieves a list of users by filter. Also returns total count of matching
57 // users which may differ from returned results if filter.Limit is specified.
58 FindUsers(ctx context.Context, filter UserFilter) ([]*User, int, error)
59
60 // Creates a new user. This is only used for testing since users are typically
61 // created during the OAuth creation process in AuthService.CreateAuth().
62 CreateUser(ctx context.Context, user *User) error
63
64 // Updates a user object. Returns EUNAUTHORIZED if current user is not
65 // the user that is being updated. Returns ENOTFOUND if user does not exist.
66 UpdateUser(ctx context.Context, id int, upd UserUpdate) (*User, error)
67
68 // Permanently deletes a user and all owned dials. Returns EUNAUTHORIZED
69 // if current user is not the user being deleted. Returns ENOTFOUND if
70 // user does not exist.
71 DeleteUser(ctx context.Context, id int) error
72}
73
74// UserFilter represents a filter passed to FindUsers().
75type UserFilter struct {

Callers 13

authenticateMethod · 0.65
authenticateMethod · 0.65
MustCreateUserFunction · 0.65
MustCreateUserFunction · 0.65
TestUserService_FindUserFunction · 0.95

Implementers 2

UserServicemock/user.go
UserServicesqlite/user.go

Calls

no outgoing calls

Tested by

no test coverage detected