task

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeHTTPHandler

func MakeHTTPHandler(s Service, logger log.Logger) http.Handler

Types

type CreateRequest

type CreateRequest struct {
	Task *Task `json:"task,omitempty"`
}

type CreateResponse

type CreateResponse struct {
	Task *Task `json:"task,omitempty"`
	Err  error `json:"error,omitempty"`
}

type DeleteRequest

type DeleteRequest struct {
	ID uuid.UUID `json:"id,omitempty"`
}

type DeleteResponse

type DeleteResponse struct {
	Err error `json:"error,omitempty"`
}

type GetByIDRequest

type GetByIDRequest struct {
	ID uuid.UUID `json:"id,omitempty"`
}

type GetByIDResponse

type GetByIDResponse struct {
	Task *Task `json:"task,omitempty"`
	Err  error `json:"error,omitempty"`
}

type GetListRequest

type GetListRequest struct{}

type GetListResponse

type GetListResponse struct {
	Tasks []*Task `json:"tasks,omitempty"`
	Err   error   `json:"error,omitempty"`
}

type Repository

type Repository interface {
	Create(context.Context, *Task) (*Task, error)
	GetList(context.Context) []*Task
	GetByID(ctx context.Context, ID uuid.UUID) (*Task, error)
	Update(ctx context.Context, t *Task) (*Task, error)
	Delete(ctx context.Context, ID uuid.UUID) error
}

type Service

type Service interface {
	Create(context.Context, *Task) (*Task, error)
	GetList(context.Context) []*Task
	GetByID(ctx context.Context, ID uuid.UUID) (*Task, error)
	Update(ctx context.Context, t *Task) (*Task, error)
	Delete(ctx context.Context, ID uuid.UUID) error
}

func NewLoggingService

func NewLoggingService(logger log.Logger, s Service) Service

NewLoggingService returns a new instance of a logging Service.

func NewService

func NewService(repo Repository) Service

type Task

type Task struct {
	ID          uuid.UUID `json:"id"`
	Title       string    `json:"title"`
	Description string    `json:"description"`
}

type UpdateRequest

type UpdateRequest struct {
	Task *Task `json:"task,omitempty"`
}

type UpdateResponse

type UpdateResponse struct {
	Task *Task `json:"task,omitempty"`
	Err  error `json:"error,omitempty"`
}

Jump to

Keyboard shortcuts

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