service

package
v0.0.0-...-02249b2 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UserRepository

type UserRepository interface {
	GetAll(ctx context.Context, name string) ([]model.User, error)
	GetByID(ctx context.Context, id uuid.UUID) (*model.User, error)
	Create(ctx context.Context, u *model.User) (*model.User, error)
	Update(ctx context.Context, u *model.User) (*model.User, error)
	Delete(ctx context.Context, id string) error
}

UserRepository representes the user repository implementation

type UserService

type UserService struct {
	UserRepository UserRepository
}

UserService is a struct to inject a implementation of UserRepository

func (*UserService) Create

func (s *UserService) Create(ctx context.Context, u *model.User) (*model.User, error)

Create call repository Create and returns

func (*UserService) Delete

func (s *UserService) Delete(ctx context.Context, id string) error

Delete call repository Delete and returns

func (*UserService) GetAll

func (s *UserService) GetAll(ctx context.Context, name string) ([]model.User, error)

GetAll calls repository GetAll and returns

func (*UserService) GetByID

func (s *UserService) GetByID(ctx context.Context, id string) (*model.User, error)

GetByID call repository GetById and returns

func (*UserService) Update

func (s *UserService) Update(ctx context.Context, id string, u *model.User) (*model.User, error)

Update call repository Update and returns

Jump to

Keyboard shortcuts

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