Documentation ¶
Index ¶
Constants ¶
const ( ErrCode_ConnectionFailed = "connection_failed" ErrCode_TaskAlreadyExistButNotDone = "already_exist_but_not_done" ErrCode_TaskAlreadyExistAndDone = "already_exist_and_done" )
Error code to distinguish errors.
Variables ¶
This section is empty.
Functions ¶
func CreateTaskInitedByUser1 ¶
Pretends to be service logic function that invokes repository db function SaveTaskToDb...().
0 - calls SaveTaskToDbMockConnectionError 1 - calls SaveTaskToDbMockExistButNotDone 2 - calls SaveTaskToDbMockExistAndDone 3 - calls SaveTaskToDbMockSuccess
All errors occured it annotates with information that this task id inited by user 1 using:
errors.WrapAnnotated(SaveTaskToDb...(), "Inited by user 1")
func SaveTaskToDbMockConnectionError ¶
func SaveTaskToDbMockConnectionError() error
It mocks case when one tries to save task to db, but connection error occurs.
It returns error with error code ErrCode_ConnectionFailed using:
errors.New("connection failed", ErrCode_ConnectionFailed)
func SaveTaskToDbMockExistAndDone ¶
func SaveTaskToDbMockExistAndDone() error
It mocks case when one tries to save task to db, but it already exists. Then it asks if task is already done and it occurs it is done.
It returns error with error code ErrCode_TaskAlreadyExistAndDone using:
return errors.New("already exist and done", ErrCode_TaskAlreadyExistAndDone)
func SaveTaskToDbMockExistButNotDone ¶
func SaveTaskToDbMockExistButNotDone() error
It mocks case when one tries to save task to db, but it already exists. Then it asks if task is already done and it occurs it is not.
It returns error with error code ErrCode_TaskAlreadyExistButNotDone using:
return errors.New("already exist", ErrCode_TaskAlreadyExistButNotDone)
func SaveTaskToDbMockSuccess ¶
func SaveTaskToDbMockSuccess() error
It mocks case of successful saving task.
Types ¶
This section is empty.