checklist

package
v0.0.0-...-359b0be Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNonNumericTaskID = errors.New("task id in path must be numeric")
	ErrResourceNotFound = errors.New("resource not found")
	ErrMethodNotAllowed = errors.New("method not allowed")
)

Functions

func NewServer

func NewServer(service Service, logger log.Logger) http.Handler

Types

type ErrInvalidRequestBody

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

func (ErrInvalidRequestBody) Error

func (e ErrInvalidRequestBody) Error() string

type Middleware

type Middleware func(Service) Service

Middleware describes a Service middleware.

func LoggingMiddleware

func LoggingMiddleware(logger log.Logger) Middleware

LoggingMiddleware takes a logger as a dependency and returns a service Middleware.

type Service

type Service interface {
	Save(context.Context, todo.Task) (*todo.Task, error)
	List(context.Context) ([]todo.Task, error)
	ToggleDone(ctx context.Context, id int64) error
	Remove(ctx context.Context, id int64) error
	Update(context.Context, todo.Task) (task *todo.Task, isCreated bool, err error)
}

Service is an application service that lets us interact with a list of tasks.

func NewService

func NewService(repository todo.TaskRepository) Service

Jump to

Keyboard shortcuts

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