services

package
v0.0.0-...-e768eea Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Service layer that separates the api layer and the DB layer

Index

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

func (us *UserService) GetUserById(ctx context.Context, userId string) (*models.User, error)

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL