Versions in this module Expand all Collapse all v0 v0.0.3 Feb 4, 2024 v0.0.2 Feb 4, 2024 Changes in this version + var ErrInvalidRole = errors.New("not a valid Role") + func Module() fx.Option + func SetUserHandlerRoutes(server *echo.Echo, handler *UserHandler) + type Role int + const RoleAdmin + const RoleMod + const RoleUser + func ParseRole(name string) (Role, error) + func (x *Role) Scan(value interface{}) (err error) + func (x *Role) UnmarshalText(text []byte) error + func (x Role) IsValid() bool + func (x Role) MarshalText() ([]byte, error) + func (x Role) String() string + func (x Role) Value() (driver.Value, error) + type Service interface + Create func(ctx context.Context, u User) (user User, err error) + Get func(ctx context.Context, userID uint) (user User, err error) + GetByEmail func(ctx context.Context, email string) (user User, err error) + ListAll func(ctx context.Context, role Role) (users []User, err error) + UpdateAvatar func(ctx context.Context, userID uint, newAvatarHref string) (user User, err error) + func NewUserService(db *gorm.DB) Service + type User struct + Avatar string + Bio string + Email string + Name string + Role Role + func (u *User) IsAdmin() bool + func (u *User) IsMod() bool + type UserHandler struct + func NewUserHandler(service Service) *UserHandler + func (h *UserHandler) ListAll(c echo.Context) (err error) + type UserService struct + 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)