Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUserNotFound = errors.NotFound("user not found") ErrUserAlreadyExists = errors.Conflict("user already exists") ErrUserIDRequired = errors.BadRequest("user id required") ErrInvalidCredentials = errors.Unauthorized("invalid credentials") ErrUserBalanceNotFound = errors.NotFound("user balance not found") )
Functions ¶
func RegisterProviders ¶
Types ¶
type CreateUserRequest ¶
type DeleteUserRequest ¶
type DeleteUserRequest struct {
UserID uint `json:"username" validate:"required,email"`
}
type Repository ¶
type Service ¶
type Service interface { Get(id uint) (*UserResponse, error) GetByUserName(username string) (*UserResponse, error) Create(request CreateUserRequest) error Delete(request DeleteUserRequest) error GetBalance(userId uint) (*UserBalanceResponse, error) VerifyCredentials(username string, password string) (*UserResponse, error) }
func NewService ¶
func NewService(options UserServiceParams) Service
type User ¶
type User struct { ID uint UserName string `validate:"required,email"` Password string `validate:"required"` Balance *UserBalance }
func (*User) ComparePassword ¶
type UserBalance ¶
type UserBalanceResponse ¶
type UserFactory ¶
func NewUserFactory ¶
func NewUserFactory(validator *validator.Validator) UserFactory
type UserResponse ¶
type UserResponse struct { ID uint `json:"id"` UserName string `json:"username"` Balance UserBalanceResponse `json:"balance"` }
type UserServiceParams ¶
type UserServiceParams struct { dig.In Repository Repository CreateUserFactory UserFactory }
Click to show internal directories.
Click to hide internal directories.