handler

package
v0.0.0-...-474bbe5 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Define interfaces to exclude the references to other packages

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RespondJSON

func RespondJSON(ctx context.Context, w http.ResponseWriter, body any, status int)

Types

type AddTask

type AddTask struct {
	Service   AddTaskService
	Validator *validator.Validate
}

func (*AddTask) ServeHTTP

func (at *AddTask) ServeHTTP(w http.ResponseWriter, r *http.Request)

Http handler to add a new task

type AddTaskService

type AddTaskService interface {
	AddTask(ctx context.Context, title string) (*entity.Task, error)
}

type ErrResponse

type ErrResponse struct {
	Message string   `json:"message"`
	Details []string `json:"details,omitempty"`
}

type ListTask

type ListTask struct {
	Service ListTasksService
}

func (*ListTask) ServeHTTP

func (lt *ListTask) ServeHTTP(w http.ResponseWriter, r *http.Request)

Http handler to get all tasks

type ListTasksService

type ListTasksService interface {
	ListTasks(ctx context.Context) (entity.Tasks, error)
}

Jump to

Keyboard shortcuts

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