todo

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCreateUseCase

func NewCreateUseCase(repo Repository) *createUseCase

func NewListUseCase

func NewListUseCase(repo Repository) *listUseCase

Types

type CreateHandler

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

func NewCreateHandler

func NewCreateHandler(useCase CreateUseCase) *CreateHandler

func (*CreateHandler) Handle

func (h *CreateHandler) Handle(c echo.Context) error

type CreateTodo

type CreateTodo struct {
	Description string `json:"description" validate:"required"`
}

type CreateUseCase

type CreateUseCase interface {
	Execute(request CreateTodo) (Todo, error)
}

type GormTodo

type GormTodo struct {
	ID          uint      `gorm:"primaryKey"`
	Description string    `gorm:"column:content"`
	CreatedAt   time.Time `gorm:"autoCreateTime"`
}

func (GormTodo) FromDomain

func (e GormTodo) FromDomain(t Todo) GormTodo

func (GormTodo) TableName

func (GormTodo) TableName() string

func (GormTodo) ToDomain

func (e GormTodo) ToDomain() Todo

ToDomain Converts the Database entity into Domain entity

type ListTodoHandler

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

func NewListTodoHandler

func NewListTodoHandler(useCase ListUseCase) *ListTodoHandler

func (*ListTodoHandler) Handle

func (h *ListTodoHandler) Handle(c echo.Context) error

type ListUseCase

type ListUseCase interface {
	Execute() ([]Todo, error)
}

type MockCreateUseCase

type MockCreateUseCase struct {
	mock.Mock
}

MockCreateUseCase is an autogenerated mock type for the CreateUseCase type

func (*MockCreateUseCase) Execute

func (_m *MockCreateUseCase) Execute(request CreateTodo) (Todo, error)

Execute provides a mock function with given fields: request

type MockListUseCase

type MockListUseCase struct {
	mock.Mock
}

MockListUseCase is an autogenerated mock type for the ListUseCase type

func (*MockListUseCase) Execute

func (_m *MockListUseCase) Execute() ([]Todo, error)

Execute provides a mock function with given fields:

type MockRepository

type MockRepository struct {
	mock.Mock
}

MockRepository is an autogenerated mock type for the Repository type

func (*MockRepository) Create

func (_m *MockRepository) Create(todo Todo) (Todo, error)

Create provides a mock function with given fields: todo

func (*MockRepository) FindAll

func (_m *MockRepository) FindAll() ([]Todo, error)

FindAll provides a mock function with given fields:

type PgRepository

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

func NewPgRepository

func NewPgRepository(db *gorm.DB) *PgRepository

func (*PgRepository) Create

func (repo *PgRepository) Create(todo Todo) (Todo, error)

func (*PgRepository) FindAll

func (repo *PgRepository) FindAll() ([]Todo, error)

type Repository

type Repository interface {
	FindAll() ([]Todo, error)
	Create(todo Todo) (Todo, error)
}

type Todo

type Todo struct {
	ID          uint      `json:"id"`
	Description string    `json:"description"`
	CreatedAt   time.Time `json:"created_at"`
}

func NewTodo

func NewTodo(description string) Todo

Jump to

Keyboard shortcuts

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