Documentation ¶
Index ¶
- Variables
- func Module() fx.Option
- func SetUserHandlerRoutes(server *echo.Echo, handler *UserHandler)
- type Role
- type Service
- type User
- type UserHandler
- type UserService
- func (s *UserService) Create(ctx context.Context, u User) (user User, err error)
- func (s *UserService) Get(ctx context.Context, userID uint) (user User, err error)
- func (s *UserService) GetByEmail(ctx context.Context, email string) (user User, err error)
- func (s *UserService) ListAll(ctx context.Context, role Role) (users []User, err error)
- func (s *UserService) UpdateAvatar(ctx context.Context, userID uint, newAvatarHref string) (user User, err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidRole = errors.New("not a valid Role")
Functions ¶
func SetUserHandlerRoutes ¶
func SetUserHandlerRoutes(server *echo.Echo, handler *UserHandler)
Types ¶
type Role ¶
type Role int
ENUM(user, mod, admin)
func (Role) IsValid ¶
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (Role) MarshalText ¶
MarshalText implements the text marshaller method.
func (*Role) UnmarshalText ¶
UnmarshalText implements the text unmarshaller method.
type Service ¶
type Service interface { Create(ctx context.Context, u User) (user User, err error) Get(ctx context.Context, userID uint) (user User, err error) GetByEmail(ctx context.Context, email string) (user User, err error) ListAll(ctx context.Context, role Role) (users []User, err error) UpdateAvatar(ctx context.Context, userID uint, newAvatarHref string) (user User, err error) }
func NewUserService ¶
type UserHandler ¶
type UserHandler struct {
// contains filtered or unexported fields
}
func NewUserHandler ¶
func NewUserHandler(service Service) *UserHandler
func (*UserHandler) ListAll ¶
func (h *UserHandler) ListAll(c echo.Context) (err error)
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
func (*UserService) GetByEmail ¶
func (*UserService) UpdateAvatar ¶
Click to show internal directories.
Click to hide internal directories.