service

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: May 20, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsExternalServiceErr

func IsExternalServiceErr(err error) bool

IsExternalServiceErr returns true if external service raises an error

func IsInvalidArgumentErr

func IsInvalidArgumentErr(err error) bool

IsInvalidArgumentErr returns true if a given argument is invalid

func IsModelExistErr

func IsModelExistErr(err error) bool

IsModelExistErr returns true if model already exists

func IsModelNotExistErr

func IsModelNotExistErr(err error) bool

IsModelNotExistErr returns true if model does not exist

func IsModelValidationErr

func IsModelValidationErr(err error) bool

IsModelValidationErr returns true if model is invalid

Types

type ClientService

type ClientService interface {
	ListClients() ([]*model.Client, error)
	ShowClient(uint) (*model.Client, error)
	ShowClientByUser(string) (*model.Client, error)
	CreateClient(*model.Client) error
}

ClientService interface

type ClientTx

type ClientTx interface {
	GetClients() ([]*model.Client, error)
	GetClient(uint) (*model.Client, error)
	GetClientByUser(string) (*model.Client, error)
	AddClient(*model.Client) error
}

ClientTx interface

type DB

type DB interface {
	Begin() (Tx, error)
}

DB interface

type MockDB

type MockDB struct {
	mock.Mock
}

MockDB is an autogenerated mock type for the DB type

func (*MockDB) Begin

func (_m *MockDB) Begin() (Tx, error)

Begin provides a mock function with given fields:

type MockService

type MockService struct {
	mock.Mock
}

MockService is an autogenerated mock type for the Service type

func (*MockService) CallPatient

func (_m *MockService) CallPatient(_a0 *model.Patient) error

CallPatient provides a mock function with given fields: _a0

func (*MockService) ChangeUserPassword

func (_m *MockService) ChangeUserPassword(_a0 *model.User) error

ChangeUserPassword provides a mock function with given fields: _a0

func (*MockService) CreateClient

func (_m *MockService) CreateClient(_a0 *model.Client) error

CreateClient provides a mock function with given fields: _a0

func (*MockService) CreatePatient

func (_m *MockService) CreatePatient(_a0 *model.Patient) error

CreatePatient provides a mock function with given fields: _a0

func (*MockService) CreateToken

func (_m *MockService) CreateToken(_a0 *model.Token) error

CreateToken provides a mock function with given fields: _a0

func (*MockService) CreateUser

func (_m *MockService) CreateUser(_a0 *model.User) error

CreateUser provides a mock function with given fields: _a0

func (*MockService) DeletePatient

func (_m *MockService) DeletePatient(_a0 *model.Patient) error

DeletePatient provides a mock function with given fields: _a0

func (*MockService) DeleteToken

func (_m *MockService) DeleteToken(_a0 *model.Token) error

DeleteToken provides a mock function with given fields: _a0

func (*MockService) ListClients

func (_m *MockService) ListClients() ([]*model.Client, error)

ListClients provides a mock function with given fields:

func (*MockService) ListPagerPatientsByStatus

func (_m *MockService) ListPagerPatientsByStatus(_a0 ...model.PatientStatus) ([]*model.Patient, error)

ListPagerPatientsByStatus provides a mock function with given fields: _a0

func (*MockService) ListPagers

func (_m *MockService) ListPagers() ([]*model.Pager, error)

ListPagers provides a mock function with given fields:

func (*MockService) ListPatients

func (_m *MockService) ListPatients() ([]*model.Patient, error)

ListPatients provides a mock function with given fields:

func (*MockService) ListTokensByUser

func (_m *MockService) ListTokensByUser(_a0 string) ([]*model.Token, error)

ListTokensByUser provides a mock function with given fields: _a0

func (*MockService) ListUsers

func (_m *MockService) ListUsers() ([]*model.User, error)

ListUsers provides a mock function with given fields:

func (*MockService) Login

func (_m *MockService) Login(_a0 string, _a1 string) (*model.User, bool, error)

Login provides a mock function with given fields: _a0, _a1

func (*MockService) ShowClient

func (_m *MockService) ShowClient(_a0 uint) (*model.Client, error)

ShowClient provides a mock function with given fields: _a0

func (*MockService) ShowClientByUser

func (_m *MockService) ShowClientByUser(_a0 string) (*model.Client, error)

ShowClientByUser provides a mock function with given fields: _a0

func (*MockService) ShowPager

func (_m *MockService) ShowPager(_a0 uint) (*model.Pager, error)

ShowPager provides a mock function with given fields: _a0

func (*MockService) ShowPatient

func (_m *MockService) ShowPatient(_a0 uint) (*model.Patient, error)

ShowPatient provides a mock function with given fields: _a0

func (*MockService) ShowToken

func (_m *MockService) ShowToken(_a0 string) (*model.Token, error)

ShowToken provides a mock function with given fields: _a0

func (*MockService) ShowUser

func (_m *MockService) ShowUser(_a0 string) (*model.User, error)

ShowUser provides a mock function with given fields: _a0

func (*MockService) ShowUserByToken

func (_m *MockService) ShowUserByToken(_a0 string) (*model.User, error)

ShowUserByToken provides a mock function with given fields: _a0

func (*MockService) UpdatePatient

func (_m *MockService) UpdatePatient(_a0 *model.Patient) error

UpdatePatient provides a mock function with given fields: _a0

type MockTx

type MockTx struct {
	mock.Mock
}

MockTx is an autogenerated mock type for the Tx type

func (*MockTx) AddClient

func (_m *MockTx) AddClient(_a0 *model.Client) error

AddClient provides a mock function with given fields: _a0

func (*MockTx) AddPatient

func (_m *MockTx) AddPatient(_a0 *model.Patient) error

AddPatient provides a mock function with given fields: _a0

func (*MockTx) AddToken

func (_m *MockTx) AddToken(_a0 *model.Token) error

AddToken provides a mock function with given fields: _a0

func (*MockTx) AddUser

func (_m *MockTx) AddUser(_a0 *model.User) error

AddUser provides a mock function with given fields: _a0

func (*MockTx) Commit

func (_m *MockTx) Commit() error

Commit provides a mock function with given fields:

func (*MockTx) GetClient

func (_m *MockTx) GetClient(_a0 uint) (*model.Client, error)

GetClient provides a mock function with given fields: _a0

func (*MockTx) GetClientByUser

func (_m *MockTx) GetClientByUser(_a0 string) (*model.Client, error)

GetClientByUser provides a mock function with given fields: _a0

func (*MockTx) GetClients

func (_m *MockTx) GetClients() ([]*model.Client, error)

GetClients provides a mock function with given fields:

func (*MockTx) GetPager

func (_m *MockTx) GetPager(_a0 uint) (*model.Pager, error)

GetPager provides a mock function with given fields: _a0

func (*MockTx) GetPagers

func (_m *MockTx) GetPagers() ([]*model.Pager, error)

GetPagers provides a mock function with given fields:

func (*MockTx) GetPatient

func (_m *MockTx) GetPatient(_a0 uint) (*model.Patient, error)

GetPatient provides a mock function with given fields: _a0

func (*MockTx) GetPatients

func (_m *MockTx) GetPatients() ([]*model.Patient, error)

GetPatients provides a mock function with given fields:

func (*MockTx) GetPatientsByClient

func (_m *MockTx) GetPatientsByClient(_a0 uint, _a1 ...bool) ([]*model.Patient, error)

GetPatientsByClient provides a mock function with given fields: _a0, _a1

func (*MockTx) GetPatientsWithPagerByStatus

func (_m *MockTx) GetPatientsWithPagerByStatus(_a0 ...model.PatientStatus) ([]*model.Patient, error)

GetPatientsWithPagerByStatus provides a mock function with given fields: _a0

func (*MockTx) GetToken

func (_m *MockTx) GetToken(_a0 string) (*model.Token, error)

GetToken provides a mock function with given fields: _a0

func (*MockTx) GetTokensByUser

func (_m *MockTx) GetTokensByUser(_a0 string) ([]*model.Token, error)

GetTokensByUser provides a mock function with given fields: _a0

func (*MockTx) GetUnassignedPagers

func (_m *MockTx) GetUnassignedPagers() ([]*model.Pager, error)

GetUnassignedPagers provides a mock function with given fields:

func (*MockTx) GetUser

func (_m *MockTx) GetUser(_a0 string) (*model.User, error)

GetUser provides a mock function with given fields: _a0

func (*MockTx) GetUserByToken

func (_m *MockTx) GetUserByToken(_a0 string) (*model.User, error)

GetUserByToken provides a mock function with given fields: _a0

func (*MockTx) GetUsers

func (_m *MockTx) GetUsers() ([]*model.User, error)

GetUsers provides a mock function with given fields:

func (*MockTx) MarkPatientsInactiveByClient

func (_m *MockTx) MarkPatientsInactiveByClient(_a0 uint) error

MarkPatientsInactiveByClient provides a mock function with given fields: _a0

func (*MockTx) RemovePatient

func (_m *MockTx) RemovePatient(_a0 *model.Patient) error

RemovePatient provides a mock function with given fields: _a0

func (*MockTx) RemovePatientsByClient

func (_m *MockTx) RemovePatientsByClient(_a0 uint, _a1 ...bool) error

RemovePatientsByClient provides a mock function with given fields: _a0, _a1

func (*MockTx) RemoveToken

func (_m *MockTx) RemoveToken(_a0 *model.Token) error

RemoveToken provides a mock function with given fields: _a0

func (*MockTx) Rollback

func (_m *MockTx) Rollback() error

Rollback provides a mock function with given fields:

func (*MockTx) UpdatePatient

func (_m *MockTx) UpdatePatient(_a0 *model.Patient) error

UpdatePatient provides a mock function with given fields: _a0

func (*MockTx) UpdateUserPassword

func (_m *MockTx) UpdateUserPassword(_a0 *model.User) error

UpdateUserPassword provides a mock function with given fields: _a0

type PagerService

type PagerService interface {
	ListPagers() ([]*model.Pager, error)
	ShowPager(uint) (*model.Pager, error)
	CreatePager(*model.Pager) error
}

PagerService interface

type PagerTx

type PagerTx interface {
	GetPagers() ([]*model.Pager, error)
	GetUnassignedPagers() ([]*model.Pager, error)
	GetPager(uint) (*model.Pager, error)
	AddPager(*model.Pager) error
}

PagerTx interface

type PatientService

type PatientService interface {
	ListPatients() ([]*model.Patient, error)
	ListPagerPatientsByStatus(...model.PatientStatus) ([]*model.Patient, error)
	ShowPatient(uint) (*model.Patient, error)
	CreatePatient(*model.Patient) error
	UpdatePatient(*model.Patient) error
	DeletePatient(*model.Patient) error
	CallPatient(*model.Patient) error
}

PatientService interface

type PatientTx

type PatientTx interface {
	GetPatients() ([]*model.Patient, error)
	GetPatientsWithPagerByStatus(...model.PatientStatus) ([]*model.Patient, error)
	// Get Patients by Client, Activity (first in slice) and Assignment of a Pager (second in slice)
	GetPatientsByClient(uint, ...bool) ([]*model.Patient, error)
	GetPatient(uint) (*model.Patient, error)
	AddPatient(*model.Patient) error
	UpdatePatient(*model.Patient) error
	MarkPatientsInactiveByClient(uint) error
	RemovePatient(*model.Patient) error
	// Remove Patients by Client, Activity (first in slice) and Assignment of a Pager (second in slice)
	RemovePatientsByClient(uint, ...bool) error
}

PatientTx interface

type Service

Service interface combines all concrete model services

func NewService

func NewService(db DB, notifier UINotifier) Service

NewService constructs a new service layer

type TokenService

type TokenService interface {
	ListTokensByUser(string) ([]*model.Token, error)
	ShowToken(string) (*model.Token, error)
	CreateToken(*model.Token) error
	DeleteToken(*model.Token) error
}

TokenService interface

type TokenTx

type TokenTx interface {
	GetToken(string) (*model.Token, error)
	GetTokensByUser(string) ([]*model.Token, error)
	AddToken(*model.Token) error
	RemoveToken(*model.Token) error
}

TokenTx interface

type Tx

type Tx interface {
	Commit() error
	Rollback() error

	ClientTx
	PagerTx
	PatientTx
	TokenTx
	UserTx
}

Tx interface

type UINotifier

type UINotifier interface {
	NotifyNewPatient(*model.Patient)
	NotifyUpdatedPatient(*model.Patient)
	NotifyDeletedPatient(*model.Patient)
}

UINotifier interface for async view updates

type UserService

type UserService interface {
	ListUsers() ([]*model.User, error)
	ShowUser(string) (*model.User, error)
	ShowUserByToken(string) (*model.User, error)
	CreateUser(*model.User) error
	ChangeUserPassword(*model.User) error
	Login(string, string) (*model.User, bool, error)
}

UserService interface

type UserTx

type UserTx interface {
	GetUsers() ([]*model.User, error)
	GetUser(string) (*model.User, error)
	GetUserByToken(string) (*model.User, error)
	AddUser(*model.User) error
	UpdateUserPassword(*model.User) error
}

UserTx interface

Jump to

Keyboard shortcuts

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