usecase

package
v0.0.0-...-5bf7098 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(repo repository.Repository, logger *zap.SugaredLogger) *useCaseURL

Types

type URLData

type URLData struct {
	ID       int
	FullURL  string
	ShortURL string
	Counter  int64
}

type UseCase

type UseCase interface {
	Create(ctx context.Context, fullURL *URLData) (*URLData, error)
	Redirect(ctx context.Context, token string) (*URLData, error)
	GetStat(ctx context.Context, id int) (*URLData, error)
}

type UseCaseMock

type UseCaseMock struct {
	CreateMock mUseCaseMockCreate

	GetStatMock mUseCaseMockGetStat

	RedirectMock mUseCaseMockRedirect
	// contains filtered or unexported fields
}

UseCaseMock implements UseCase

func NewUseCaseMock

func NewUseCaseMock(t minimock.Tester) *UseCaseMock

NewUseCaseMock returns a mock for UseCase

func (*UseCaseMock) Create

func (mmCreate *UseCaseMock) Create(ctx context.Context, fullURL *URLData) (up1 *URLData, err error)

Create implements UseCase

func (*UseCaseMock) CreateAfterCounter

func (mmCreate *UseCaseMock) CreateAfterCounter() uint64

CreateAfterCounter returns a count of finished UseCaseMock.Create invocations

func (*UseCaseMock) CreateBeforeCounter

func (mmCreate *UseCaseMock) CreateBeforeCounter() uint64

CreateBeforeCounter returns a count of UseCaseMock.Create invocations

func (*UseCaseMock) GetStat

func (mmGetStat *UseCaseMock) GetStat(ctx context.Context, id int) (up1 *URLData, err error)

GetStat implements UseCase

func (*UseCaseMock) GetStatAfterCounter

func (mmGetStat *UseCaseMock) GetStatAfterCounter() uint64

GetStatAfterCounter returns a count of finished UseCaseMock.GetStat invocations

func (*UseCaseMock) GetStatBeforeCounter

func (mmGetStat *UseCaseMock) GetStatBeforeCounter() uint64

GetStatBeforeCounter returns a count of UseCaseMock.GetStat invocations

func (*UseCaseMock) MinimockCreateDone

func (m *UseCaseMock) MinimockCreateDone() bool

MinimockCreateDone returns true if the count of the Create invocations corresponds the number of defined expectations

func (*UseCaseMock) MinimockCreateInspect

func (m *UseCaseMock) MinimockCreateInspect()

MinimockCreateInspect logs each unmet expectation

func (*UseCaseMock) MinimockFinish

func (m *UseCaseMock) MinimockFinish()

MinimockFinish checks that all mocked methods have been called the expected number of times

func (*UseCaseMock) MinimockGetStatDone

func (m *UseCaseMock) MinimockGetStatDone() bool

MinimockGetStatDone returns true if the count of the GetStat invocations corresponds the number of defined expectations

func (*UseCaseMock) MinimockGetStatInspect

func (m *UseCaseMock) MinimockGetStatInspect()

MinimockGetStatInspect logs each unmet expectation

func (*UseCaseMock) MinimockRedirectDone

func (m *UseCaseMock) MinimockRedirectDone() bool

MinimockRedirectDone returns true if the count of the Redirect invocations corresponds the number of defined expectations

func (*UseCaseMock) MinimockRedirectInspect

func (m *UseCaseMock) MinimockRedirectInspect()

MinimockRedirectInspect logs each unmet expectation

func (*UseCaseMock) MinimockWait

func (m *UseCaseMock) MinimockWait(timeout mm_time.Duration)

MinimockWait waits for all mocked methods to be called the expected number of times

func (*UseCaseMock) Redirect

func (mmRedirect *UseCaseMock) Redirect(ctx context.Context, token string) (up1 *URLData, err error)

Redirect implements UseCase

func (*UseCaseMock) RedirectAfterCounter

func (mmRedirect *UseCaseMock) RedirectAfterCounter() uint64

RedirectAfterCounter returns a count of finished UseCaseMock.Redirect invocations

func (*UseCaseMock) RedirectBeforeCounter

func (mmRedirect *UseCaseMock) RedirectBeforeCounter() uint64

RedirectBeforeCounter returns a count of UseCaseMock.Redirect invocations

type UseCaseMockCreateExpectation

type UseCaseMockCreateExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

UseCaseMockCreateExpectation specifies expectation struct of the UseCase.Create

func (*UseCaseMockCreateExpectation) Then

Then sets up UseCase.Create return parameters for the expectation previously defined by the When method

type UseCaseMockCreateParams

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

UseCaseMockCreateParams contains parameters of the UseCase.Create

type UseCaseMockCreateResults

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

UseCaseMockCreateResults contains results of the UseCase.Create

type UseCaseMockGetStatExpectation

type UseCaseMockGetStatExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

UseCaseMockGetStatExpectation specifies expectation struct of the UseCase.GetStat

func (*UseCaseMockGetStatExpectation) Then

Then sets up UseCase.GetStat return parameters for the expectation previously defined by the When method

type UseCaseMockGetStatParams

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

UseCaseMockGetStatParams contains parameters of the UseCase.GetStat

type UseCaseMockGetStatResults

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

UseCaseMockGetStatResults contains results of the UseCase.GetStat

type UseCaseMockRedirectExpectation

type UseCaseMockRedirectExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

UseCaseMockRedirectExpectation specifies expectation struct of the UseCase.Redirect

func (*UseCaseMockRedirectExpectation) Then

Then sets up UseCase.Redirect return parameters for the expectation previously defined by the When method

type UseCaseMockRedirectParams

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

UseCaseMockRedirectParams contains parameters of the UseCase.Redirect

type UseCaseMockRedirectResults

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

UseCaseMockRedirectResults contains results of the UseCase.Redirect

Jump to

Keyboard shortcuts

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