Documentation ¶
Index ¶
- Variables
- func NewHTTPServer(svc Service) http.Handler
- type HTTPClient
- func (c *HTTPClient) CreateUser(ctx context.Context, user *User) (err error)
- func (c *HTTPClient) DeleteUser(ctx context.Context, name string) (err error)
- func (c *HTTPClient) GetUser(ctx context.Context, name string) (user *User, err error)
- func (c *HTTPClient) ListUsers(ctx context.Context) (users []*User, err error)
- func (c *HTTPClient) UpdateUser(ctx context.Context, name string, user *User) (err error)
- type InmemService
- func (s *InmemService) CreateUser(ctx context.Context, user *User) error
- func (s *InmemService) DeleteUser(ctx context.Context, name string) error
- func (s *InmemService) GetUser(ctx context.Context, name string) (*User, error)
- func (s *InmemService) ListUsers(ctx context.Context) ([]*User, error)
- func (s *InmemService) UpdateUser(ctx context.Context, name string, user *User) error
- type Service
- type User
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrAlreadyExists = errors.New("already exists") ErrNotFound = errors.New("not found") )
Functions ¶
func NewHTTPServer ¶
Types ¶
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
func NewHTTPClient ¶
func NewHTTPClient(httpClient *http.Client, baseURL string) *HTTPClient
func (*HTTPClient) CreateUser ¶
func (c *HTTPClient) CreateUser(ctx context.Context, user *User) (err error)
func (*HTTPClient) DeleteUser ¶
func (c *HTTPClient) DeleteUser(ctx context.Context, name string) (err error)
func (*HTTPClient) ListUsers ¶
func (c *HTTPClient) ListUsers(ctx context.Context) (users []*User, err error)
func (*HTTPClient) UpdateUser ¶
type InmemService ¶
type InmemService struct {
// contains filtered or unexported fields
}
func NewInmemService ¶
func NewInmemService() *InmemService
func (*InmemService) CreateUser ¶
func (s *InmemService) CreateUser(ctx context.Context, user *User) error
func (*InmemService) DeleteUser ¶
func (s *InmemService) DeleteUser(ctx context.Context, name string) error
func (*InmemService) ListUsers ¶
func (s *InmemService) ListUsers(ctx context.Context) ([]*User, error)
func (*InmemService) UpdateUser ¶
type Service ¶
type Service interface { GetUser(ctx context.Context, name string) (user *User, err error) ListUsers(ctx context.Context) (users []*User, err error) CreateUser(ctx context.Context, user *User) (err error) UpdateUser(ctx context.Context, name string, user *User) (err error) DeleteUser(ctx context.Context, name string) (err error) }
Click to show internal directories.
Click to hide internal directories.