Documentation ¶
Overview ¶
Service layer that separates the api layer and the DB layer
Index ¶
- type IUserService
- type UserService
- func (us *UserService) CreateUser(ctx context.Context, userCreation models.UserCreation) (*string, error)
- func (us *UserService) DeleteUserById(ctx context.Context, userId string) error
- func (us *UserService) GetUserById(ctx context.Context, userId string) (*models.User, error)
- func (us *UserService) GetUsers(ctx context.Context, queryParams models.GetUserQueryParams) ([]models.User, error)
- func (us *UserService) UpdateUser(ctx context.Context, userId string, userCreation models.UserCreation) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IUserService ¶
type IUserService interface { CreateUser(context.Context, models.UserCreation) (*string, error) DeleteUserById(context.Context, string) error GetUsers(context.Context, models.GetUserQueryParams) ([]models.User, error) GetUserById(context.Context, string) (*models.User, error) UpdateUser(context.Context, string, models.UserCreation) error }
func NewUserService ¶
func NewUserService(storage db.IUserStorage, broker messagebroker.IMessageBroker) IUserService
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
func (*UserService) CreateUser ¶
func (us *UserService) CreateUser(ctx context.Context, userCreation models.UserCreation) (*string, error)
CreateUser returns the ID of the newly created user
func (*UserService) DeleteUserById ¶
func (us *UserService) DeleteUserById(ctx context.Context, userId string) error
DeleteUserById deletes the user having the provided userId
func (*UserService) GetUserById ¶
GetUserById returns the user having the provided userId
func (*UserService) GetUsers ¶
func (us *UserService) GetUsers(ctx context.Context, queryParams models.GetUserQueryParams) ([]models.User, error)
GetUsers returns the list of the Users, filtered by parameters in the queryParams
func (*UserService) UpdateUser ¶
func (us *UserService) UpdateUser(ctx context.Context, userId string, userCreation models.UserCreation) error
UpdateUser updates the user having the provided userId
Click to show internal directories.
Click to hide internal directories.