usecase

package
v0.0.0-...-3c201f0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoardInteractor

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

BoardInteractor includes repogitories and a logger.

func NewBoardInteractor

func NewBoardInteractor(
	txRepo TransactionRepository,
	boardRepo BoardRepository,
	listRepo ListRepository,
	itemRepo ItemRepository,
	logger Logger,
) (BoardInteractor, error)

NewBoardInteractor generates new interactor for a Board.

func (*BoardInteractor) Create

func (i *BoardInteractor) Create(board model.Board) (model.Board, error)

Create saves new Board to a repository and returns created Board.

func (*BoardInteractor) Delete

func (i *BoardInteractor) Delete(board model.Board) error

Delete removes Board in repository.

func (*BoardInteractor) Get

func (i *BoardInteractor) Get(board model.Board) (model.Board, error)

Get returns Board embedded all data.

func (*BoardInteractor) GetBoards

func (i *BoardInteractor) GetBoards(user model.User) (model.Boards, error)

GetBoards returns User's Boards.

func (*BoardInteractor) Move

func (i *BoardInteractor) Move(board model.Board) error

Move moves Boards.

func (*BoardInteractor) Update

func (i *BoardInteractor) Update(board model.Board) (model.Board, error)

Update replaces a Board and returns new Board.

type BoardRepository

type BoardRepository interface {
	Create(tx Transaction, board model.Board) error
	Update(tx Transaction, board model.Board, updates map[string]interface{}) error
	Delete(tx Transaction, board model.Board) error
	FindByID(tx Transaction, id, userID string) (model.Board, error)
	Find(tx Transaction, condititons map[string]interface{}) (model.Boards, error)
}

BoardRepository is interface. It defines CURD methods for Board.

type BoardUsecase

type BoardUsecase interface {
	Get(board model.Board) (model.Board, error)
	GetBoards(user model.User) (model.Boards, error)
	Create(board model.Board) (model.Board, error)
	Delete(board model.Board) error
	Update(board model.Board) (model.Board, error)
	Move(board model.Board) error
}

BoardUsecase is interface. It defines to control a Board.

type ItemInteractor

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

ItemInteractor includes repogitories and a logger.

func NewItemInteractor

func NewItemInteractor(
	txRepo TransactionRepository,
	itemRepo ItemRepository,
	listRepo ListRepository,
	tagRepo TagRepository,
	logger Logger,
) (ItemInteractor, error)

NewItemInteractor generates new interactor for a Item.

func (*ItemInteractor) Create

func (i *ItemInteractor) Create(item model.Item) (model.Item, error)

Create saves new Item to a repository and returns created Item.

func (*ItemInteractor) Delete

func (i *ItemInteractor) Delete(item model.Item) error

Delete removes Item in repository.

func (*ItemInteractor) Move

func (i *ItemInteractor) Move(item model.Item) error

Move moves Items.

func (*ItemInteractor) Update

func (i *ItemInteractor) Update(item model.Item) (model.Item, error)

Update replaces a Item and returns new Item.

type ItemRepository

type ItemRepository interface {
	Create(tx Transaction, item model.Item) error
	Update(tx Transaction, item model.Item, updates map[string]interface{}) error
	Delete(tx Transaction, item model.Item) error
	FindByID(tx Transaction, id, userID string) (model.Item, error)
	Find(tx Transaction, conditions map[string]interface{}) (model.Items, error)
}

ItemRepository is interface. It defines CURD methods for Item.

type ItemUsecase

type ItemUsecase interface {
	Create(item model.Item) (model.Item, error)
	Delete(item model.Item) error
	Update(item model.Item) (model.Item, error)
	Move(item model.Item) error
}

ItemUsecase is interface. It defines to control a Item.

type ListInteractor

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

ListInteractor includes repogitories and a logger.

func NewListInteractor

func NewListInteractor(
	txRepo TransactionRepository,
	itemRepo ItemRepository,
	listRepo ListRepository,
	boardRepo BoardRepository,
	logger Logger,
) (ListInteractor, error)

NewListInteractor generates new interactor for a List.

func (*ListInteractor) Create

func (i *ListInteractor) Create(list model.List) (model.List, error)

Create saves new List to a repository and returns created List.

func (*ListInteractor) Delete

func (i *ListInteractor) Delete(list model.List) error

Delete removes List in repository.

func (*ListInteractor) Move

func (i *ListInteractor) Move(list model.List) error

Move moves Items.

func (*ListInteractor) Update

func (i *ListInteractor) Update(list model.List) (model.List, error)

Update replaces a List and returns new List.

type ListRepository

type ListRepository interface {
	Create(tx Transaction, list model.List) error
	Update(tx Transaction, list model.List, updates map[string]interface{}) error
	Delete(tx Transaction, list model.List) error
	FindByID(tx Transaction, id, UserID string) (model.List, error)
	Find(tx Transaction, conditions map[string]interface{}) (model.Lists, error)
}

ListRepository is interface. It defines CURD methods for List.

type ListUsecase

type ListUsecase interface {
	Create(list model.List) (model.List, error)
	Delete(list model.List) error
	Update(list model.List) (model.List, error)
	Move(list model.List) error
}

ListUsecase is interface. It defines to control a List.

type Logger

type Logger interface {
	Debug(msg string)
	Info(msg string)
	Error(msg string)
}

Logger is interface. It defines logging methods.

type ResourceInteractor

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

ResourceInteractor includes repogitories and a logger.

func NewResourceInteractor

func NewResourceInteractor(
	txRepo TransactionRepository,
	tagRepo TagRepository,
	logger Logger,
) (ResourceInteractor, error)

NewResourceInteractor generates new interactor for resources.

func (*ResourceInteractor) GetAllTagsandColors

func (i *ResourceInteractor) GetAllTagsandColors() (model.Tags, model.Colors, error)

GetAllTagsandColors returns all Tags and Colors.

type ResourceUsecase

type ResourceUsecase interface {
	GetAllTagsandColors() (model.Tags, model.Colors, error)
}

ResourceUsecase is interface. It defines getter for tags and colors.

type TagRepository

type TagRepository interface {
	Create(tx Transaction, tag model.Tag) error
	Find(tx Transaction, conditions map[string]interface{}) (model.Tags, error)
}

TagRepository is interface. It defines CR methods for Tag.

type Transaction

type Transaction interface {
	Commit()
	Rollback()
	DB() interface{}
}

Transaction is interface. It defined transaction methods.

type TransactionRepository

type TransactionRepository interface {
	BeginTransaction(on bool) Transaction
}

TransactionRepository is interface. It defines Transaction getter.

type UserInteractor

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

UserInteractor includes repogitories and a logger.

func NewUserInteractor

func NewUserInteractor(
	txRepo TransactionRepository,
	userRepo UserRepository,
	logger Logger,
) (UserInteractor, error)

NewUserInteractor generates new interactor for a User.

func (*UserInteractor) SignIn

func (i *UserInteractor) SignIn(user model.User) (model.User, error)

SignIn returns User data if a user succeds at authentication.

func (*UserInteractor) SignUp

func (i *UserInteractor) SignUp(user model.User) (model.User, error)

SignUp registers new User to repository.

type UserRepository

type UserRepository interface {
	Create(tx Transaction, user model.User) error
	Find(tx Transaction, conditions map[string]interface{}) (model.User, error)
}

UserRepository is interface. It defines CR methods for User.

type UserUsecase

type UserUsecase interface {
	SignUp(user model.User) (model.User, error)
	SignIn(user model.User) (model.User, error)
}

UserUsecase is interface. It defines to control a User authentication.

Jump to

Keyboard shortcuts

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