userservice

package
v0.0.0-...-e6e2e8d Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package userservice manages business logic layer of users.

Package userservice is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewUserWihtoutPassword

func NewUserWihtoutPassword(u domain.User) domain.UserWihtoutPassword

NewUserWihtoutPassword returns user with removed sensitive data.

Types

type MockRepo

type MockRepo struct {
	// contains filtered or unexported fields
}

MockRepo is a mock of Repo interface.

func NewMockRepo

func NewMockRepo(ctrl *gomock.Controller) *MockRepo

NewMockRepo creates a new mock instance.

func (*MockRepo) Create

Create mocks base method.

func (*MockRepo) EXPECT

func (m *MockRepo) EXPECT() *MockRepoMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockRepo) Get

func (m *MockRepo) Get(ctx context.Context, username string) (domain.User, error)

Get mocks base method.

type MockRepoMockRecorder

type MockRepoMockRecorder struct {
	// contains filtered or unexported fields
}

MockRepoMockRecorder is the mock recorder for MockRepo.

func (*MockRepoMockRecorder) Create

func (mr *MockRepoMockRecorder) Create(ctx, arg interface{}) *gomock.Call

Create indicates an expected call of Create.

func (*MockRepoMockRecorder) Get

func (mr *MockRepoMockRecorder) Get(ctx, username interface{}) *gomock.Call

Get indicates an expected call of Get.

type Repo

type Repo interface {
	Create(ctx context.Context, arg domain.CreateUserParams) (domain.User, error)
	Get(ctx context.Context, username string) (domain.User, error)
}

Repo provides data access layer interface needed by user service layer.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service facilitates user service layer logic.

func New

func New(ur Repo) *Service

New return user service struct to manage user bussines logic.

func (*Service) CheckPassword

func (s *Service) CheckPassword(ctx context.Context, username, pass string) (domain.UserWihtoutPassword, error)

CheckPassword checks if the password is valid for the given username.

func (*Service) Create

func (s *Service) Create(ctx context.Context, username, password, fullname, email string) (domain.UserWihtoutPassword, error)

Create creates and returns user.

Jump to

Keyboard shortcuts

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