example_auxiliary

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2021 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConnectionFailed           = NewE("connection_failed")
	ErrTaskAlreadyExistButNotDone = NewE("already_exist_but_not_done")
	ErrTaskAlreadyExistAndDone    = NewE("already_exist_and_done")
)

Different errors

Functions

func CreateTaskInitedByUser

func CreateTaskInitedByUser(l *logrus.Entry, i, userID int) (reterr error)

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 is inited by userID

func SaveTaskToDbMockConnectionError

func SaveTaskToDbMockConnectionError(l *logrus.Entry) error

It mocks case when one tries to save task to db, but connection error occurs.

It returns specific error with stacktrace and with logger inside, which contains relevant fields.

func SaveTaskToDbMockExistAndDone

func SaveTaskToDbMockExistAndDone(l *logrus.Entry) 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 specific error with stacktrace and with logger inside, which contains relevant fields.

func SaveTaskToDbMockExistButNotDone

func SaveTaskToDbMockExistButNotDone(l *logrus.Entry) 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 specific error with stacktrace and with logger inside, which contains relevant fields.

func SaveTaskToDbMockSuccess

func SaveTaskToDbMockSuccess() error

It mocks case of successful saving task.

Types

This section is empty.

Jump to

Keyboard shortcuts

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