Documentation
¶
Index ¶
- Constants
- func NewUserFilter(r *http.Request) (user.Filter, error)
- func TranslateUser(u *user.User) rest.User
- func TranslateUserRequest(u rest.UserRequest) (user.Change, error)
- type UserStorage
- type UsersService
- func (s UsersService) Create(w http.ResponseWriter, r *http.Request)
- func (s UsersService) Get(w http.ResponseWriter, r *http.Request)
- func (s UsersService) List(w http.ResponseWriter, r *http.Request)
- func (UsersService) Name() string
- func (s UsersService) Register(router *mux.Router)
- func (s UsersService) Remove(w http.ResponseWriter, r *http.Request)
- func (UsersService) Shutdown()
- func (s UsersService) Update(w http.ResponseWriter, r *http.Request)
Constants ¶
const (
V1UserRoute string = "/v1/user"
)
Variables ¶
This section is empty.
Functions ¶
func NewUserFilter ¶
NewUserFilter creates an user users filter from the the given request's query parameters.
func TranslateUser ¶
TranslateUser translates an user user to a network user.
func TranslateUserRequest ¶
func TranslateUserRequest(u rest.UserRequest) (user.Change, error)
TranslateUserRequest translates a network user user request to an user user request.
Types ¶
type UserStorage ¶
type UserStorage interface {
List(context.Context, user.Filter) ([]*user.User, error)
Get(context.Context, user.ID) (*user.User, error)
Create(context.Context, user.Create) (*user.User, error)
Update(context.Context, user.ID, user.Update) (*user.User, error)
Remove(context.Context, user.ID) error
}
UserStorage defines the expected behavior of the user manager in the domain layer.
type UsersService ¶
type UsersService struct {
Storage UserStorage
}
UserService services user related network requests.
func (UsersService) Create ¶
func (s UsersService) Create(w http.ResponseWriter, r *http.Request)
Create handles a request to create an user.
func (UsersService) Get ¶
func (s UsersService) Get(w http.ResponseWriter, r *http.Request)
Get handles a request to retrieve an user.
func (UsersService) List ¶
func (s UsersService) List(w http.ResponseWriter, r *http.Request)
List handles a request to retrieve multiple users.
func (UsersService) Register ¶
func (s UsersService) Register(router *mux.Router)
Register sets up the http handler for this service with the given router.
func (UsersService) Remove ¶
func (s UsersService) Remove(w http.ResponseWriter, r *http.Request)
Remove handles a request to remove an user.
func (UsersService) Shutdown ¶
func (UsersService) Shutdown()
Shutdown is a no-op since there no long running processes for this service.
func (UsersService) Update ¶
func (s UsersService) Update(w http.ResponseWriter, r *http.Request)
Update handles a request to update an user.