usecase

package
v0.0.0-...-c62bbba Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsoleCreate

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

ConsoleCreate is a use case for creating a console.

func NewConsoleCreate

func NewConsoleCreate(repo ConsoleRepositoryCreator) *ConsoleCreate

NewConsoleCreate creates a new console create use case.

func (*ConsoleCreate) Create

func (c *ConsoleCreate) Create(ctx context.Context, input model.ConsoleInsert) (*model.Console, error)

Create creates a console.

type ConsoleRepositoryCreator

type ConsoleRepositoryCreator interface {
	Save(ctx context.Context, console *entity.Console) error
}

ConsoleRepositoryCreator is an interface for creating a console in the repository.

type ConsoleRepositoryFinder

type ConsoleRepositoryFinder interface {
	FindByID(ctx context.Context, id string) (*entity.Console, error)
}

ConsoleRepositoryFinder is an interface for finding a console from the repository.

type ConsoleSearch

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

ConsoleSearch is a use case for searching a console.

func NewConsoleSearch

func NewConsoleSearch(repo ConsoleRepositoryFinder) *ConsoleSearch

NewConsoleSearch creates a new console search use case.

func (*ConsoleSearch) Search

func (c *ConsoleSearch) Search(ctx context.Context, id string) (*model.Console, error)

Search searches a console.

type GameSearch

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

GameSearch is a use case for searching a game.

func NewGameSearch

func NewGameSearch(igdbClient IgdbGameFinder) *GameSearch

NewGameSearch creates a new game search use case.

func (*GameSearch) Search

func (c *GameSearch) Search(ctx context.Context, name string) ([]model.Game, error)

Search searches games by the given name.

type IgdbGameFinder

type IgdbGameFinder interface {
	Games(ctx context.Context, name string) ([]igdb.Game, error)
	Genres(ctx context.Context, ids []int) ([]igdb.Genre, error)
	Platforms(ctx context.Context, ids []int) ([]igdb.Platform, error)
}

IgdbGameFinder is an interface for finding games from IGDB.

type MockConsoleRepositoryCreator

type MockConsoleRepositoryCreator struct {
	mock.Mock
}

MockConsoleRepositoryCreator is an autogenerated mock type for the ConsoleRepositoryCreator type

func NewMockConsoleRepositoryCreator

func NewMockConsoleRepositoryCreator(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockConsoleRepositoryCreator

NewMockConsoleRepositoryCreator creates a new instance of MockConsoleRepositoryCreator. 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 (*MockConsoleRepositoryCreator) Save

Save provides a mock function with given fields: ctx, console

type MockConsoleRepositoryFinder

type MockConsoleRepositoryFinder struct {
	mock.Mock
}

MockConsoleRepositoryFinder is an autogenerated mock type for the ConsoleRepositoryFinder type

func NewMockConsoleRepositoryFinder

func NewMockConsoleRepositoryFinder(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockConsoleRepositoryFinder

NewMockConsoleRepositoryFinder creates a new instance of MockConsoleRepositoryFinder. 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 (*MockConsoleRepositoryFinder) FindByID

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

Jump to

Keyboard shortcuts

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