usecase

package
v0.0.0-...-04f3e75 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 16 Imported by: 0

README

Use Cases

The usecase package contains the implementation of the application use cases, which represent the specific goals and tasks that the application is designed to accomplish. Each use case defines a specific business logic flow that is executed when a user interacts with the system, and interacts with the domain layer to access and modify the application entities.

By separating the use case logic from other layers of the application, the use case package promotes maintainability, testability, and flexibility of the codebase.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth interface {
	Login(ctx context.Context, username, password string) (string, error)
}

type AuthInteractor

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

func NewAuth

func NewAuth(jwtSecret []byte) *AuthInteractor

func (*AuthInteractor) Login

func (uc *AuthInteractor) Login(ctx context.Context, username, password string) (string, error)

type DelayInteractor

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

func NewDelay

func NewDelay() *DelayInteractor

func (*DelayInteractor) Process

func (uc *DelayInteractor) Process(ctx context.Context, delay time.Duration) (*Timers, error)

type DelayJob

type DelayJob interface {
	Process(ctx context.Context, delay time.Duration) (*Timers, error)
}

type Healthcheck

type Healthcheck interface {
	Execute(ctx context.Context) error
}

type HealthcheckInteractor

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

func (*HealthcheckInteractor) Execute

func (u *HealthcheckInteractor) Execute(ctx context.Context) error

type JwtCustomClaims

type JwtCustomClaims struct {
	jwt.RegisteredClaims
	User string `json:"user"`
}

type MockHealthcheck

type MockHealthcheck struct {
	mock.Mock
}

MockHealthcheck is an autogenerated mock type for the Healthcheck type

func NewMockHealthcheck

func NewMockHealthcheck(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockHealthcheck

NewMockHealthcheck creates a new instance of MockHealthcheck. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockHealthcheck) EXPECT

func (*MockHealthcheck) Execute

func (_m *MockHealthcheck) Execute(ctx context.Context) error

Execute provides a mock function with given fields: ctx

type MockHealthcheck_Execute_Call

type MockHealthcheck_Execute_Call struct {
	*mock.Call
}

MockHealthcheck_Execute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Execute'

func (*MockHealthcheck_Execute_Call) Return

func (*MockHealthcheck_Execute_Call) Run

func (*MockHealthcheck_Execute_Call) RunAndReturn

type MockHealthcheck_Expecter

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

func (*MockHealthcheck_Expecter) Execute

func (_e *MockHealthcheck_Expecter) Execute(ctx interface{}) *MockHealthcheck_Execute_Call

Execute is a helper method to define mock.On call

  • ctx context.Context

type MockProfile

type MockProfile struct {
	mock.Mock
}

MockProfile is an autogenerated mock type for the Profile type

func NewMockProfile

func NewMockProfile(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockProfile

NewMockProfile creates a new instance of MockProfile. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockProfile) EXPECT

func (_m *MockProfile) EXPECT() *MockProfile_Expecter

func (*MockProfile) GetProfile

func (_m *MockProfile) GetProfile(ctx context.Context, id int64) (*model.Profile, error)

GetProfile provides a mock function with given fields: ctx, id

func (*MockProfile) ListProfiles

func (_m *MockProfile) ListProfiles(ctx context.Context, query *request.QueryParams) (*response.ListResponse[*model.Profile], error)

ListProfiles provides a mock function with given fields: ctx, query

func (*MockProfile) RemoveProfile

func (_m *MockProfile) RemoveProfile(ctx context.Context, id int64) error

RemoveProfile provides a mock function with given fields: ctx, id

func (*MockProfile) SaveProfile

func (_m *MockProfile) SaveProfile(ctx context.Context, req *model.ProfileRequest) (*model.Profile, error)

SaveProfile provides a mock function with given fields: ctx, req

func (*MockProfile) UpdateProfile

func (_m *MockProfile) UpdateProfile(ctx context.Context, id int64, req *model.ProfileRequest) (*model.Profile, error)

UpdateProfile provides a mock function with given fields: ctx, id, req

type MockProfile_Expecter

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

func (*MockProfile_Expecter) GetProfile

func (_e *MockProfile_Expecter) GetProfile(ctx interface{}, id interface{}) *MockProfile_GetProfile_Call

GetProfile is a helper method to define mock.On call

  • ctx context.Context
  • id int64

func (*MockProfile_Expecter) ListProfiles

func (_e *MockProfile_Expecter) ListProfiles(ctx interface{}, query interface{}) *MockProfile_ListProfiles_Call

ListProfiles is a helper method to define mock.On call

  • ctx context.Context
  • query *request.QueryParams

func (*MockProfile_Expecter) RemoveProfile

func (_e *MockProfile_Expecter) RemoveProfile(ctx interface{}, id interface{}) *MockProfile_RemoveProfile_Call

RemoveProfile is a helper method to define mock.On call

  • ctx context.Context
  • id int64

func (*MockProfile_Expecter) SaveProfile

func (_e *MockProfile_Expecter) SaveProfile(ctx interface{}, req interface{}) *MockProfile_SaveProfile_Call

SaveProfile is a helper method to define mock.On call

  • ctx context.Context
  • req *model.ProfileRequest

func (*MockProfile_Expecter) UpdateProfile

func (_e *MockProfile_Expecter) UpdateProfile(ctx interface{}, id interface{}, req interface{}) *MockProfile_UpdateProfile_Call

UpdateProfile is a helper method to define mock.On call

  • ctx context.Context
  • id int64
  • req *model.ProfileRequest

type MockProfile_GetProfile_Call

type MockProfile_GetProfile_Call struct {
	*mock.Call
}

MockProfile_GetProfile_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetProfile'

func (*MockProfile_GetProfile_Call) Return

func (*MockProfile_GetProfile_Call) Run

func (*MockProfile_GetProfile_Call) RunAndReturn

type MockProfile_ListProfiles_Call

type MockProfile_ListProfiles_Call struct {
	*mock.Call
}

MockProfile_ListProfiles_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListProfiles'

func (*MockProfile_ListProfiles_Call) Return

func (*MockProfile_ListProfiles_Call) Run

func (*MockProfile_ListProfiles_Call) RunAndReturn

type MockProfile_RemoveProfile_Call

type MockProfile_RemoveProfile_Call struct {
	*mock.Call
}

MockProfile_RemoveProfile_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveProfile'

func (*MockProfile_RemoveProfile_Call) Return

func (*MockProfile_RemoveProfile_Call) Run

func (*MockProfile_RemoveProfile_Call) RunAndReturn

type MockProfile_SaveProfile_Call

type MockProfile_SaveProfile_Call struct {
	*mock.Call
}

MockProfile_SaveProfile_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SaveProfile'

func (*MockProfile_SaveProfile_Call) Return

func (*MockProfile_SaveProfile_Call) Run

func (*MockProfile_SaveProfile_Call) RunAndReturn

type MockProfile_UpdateProfile_Call

type MockProfile_UpdateProfile_Call struct {
	*mock.Call
}

MockProfile_UpdateProfile_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateProfile'

func (*MockProfile_UpdateProfile_Call) Return

func (*MockProfile_UpdateProfile_Call) Run

func (*MockProfile_UpdateProfile_Call) RunAndReturn

type Option

type Option func(m *common)

func WithTime

func WithTime(timeFn func() time.Time) Option

type Profile

type Profile interface {
	GetProfile(ctx context.Context, id int64) (*model.Profile, error)
	ListProfiles(ctx context.Context, query *request.QueryParams) (*response.ListResponse[*model.Profile], error)
	SaveProfile(ctx context.Context, req *model.ProfileRequest) (*model.Profile, error)
	UpdateProfile(ctx context.Context, id int64, req *model.ProfileRequest) (*model.Profile, error)
	RemoveProfile(ctx context.Context, id int64) error
}

type ProfileInteractor

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

func NewProfile

func NewProfile(uow uow.UnitOfWork) *ProfileInteractor

func (*ProfileInteractor) GetProfile

func (u *ProfileInteractor) GetProfile(ctx context.Context, id int64) (*model.Profile, error)

func (*ProfileInteractor) ListProfiles

func (*ProfileInteractor) RemoveProfile

func (u *ProfileInteractor) RemoveProfile(ctx context.Context, id int64) error

func (*ProfileInteractor) SaveProfile

func (u *ProfileInteractor) SaveProfile(ctx context.Context, req *model.ProfileRequest) (*model.Profile, error)

func (*ProfileInteractor) UpdateProfile

func (u *ProfileInteractor) UpdateProfile(ctx context.Context, id int64, req *model.ProfileRequest) (*model.Profile, error)

type Timers

type Timers struct {
	Start    time.Time     `json:"start"`
	Finish   time.Time     `json:"finish"`
	Duration time.Duration `json:"duration"`
}

Jump to

Keyboard shortcuts

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