handler

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package handler provides request handling functionality for the application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(e *echo.Echo, db *gorm.DB)

Register registers the routes for the application.

Types

type CreateRequest

type CreateRequest struct {
	Task string `json:"task" validate:"required"`
}

CreateRequest is the request parameter for creating a new todo

type CustomValidator

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

CustomValidator is a custom validator for the echo framework

func (*CustomValidator) Validate

func (cv *CustomValidator) Validate(i interface{}) error

Validate validates the input struct

type DeleteRequest

type DeleteRequest struct {
	ID int `param:"id" validate:"required"`
}

DeleteRequest is the request parameter for deleting a todo

type Error

type Error struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

Error is the error structure for the application.

type FindRequest

type FindRequest struct {
	ID int `param:"id" validate:"required"`
}

FindRequest is the request parameter for finding a todo

type Handler

type Handler struct{}

Handler is the request handler for the application.

func (Handler) MustBind

func (h Handler) MustBind(c echo.Context, req interface{}) error

MustBind はリクエストのバインドとバリデーションを行います。

type HealthHandler

type HealthHandler interface {
	Healthz(c echo.Context) error
}

HealthHandler is the request handler for the health endpoint.

func NewHealth

func NewHealth() HealthHandler

NewHealth returns a new instance of the health handler.

type ResponseData

type ResponseData struct {
	// Data is the response data.
	Data interface{} `json:"data,omitempty"`
}

ResponseData is the response structure for the application.

type ResponseError

type ResponseError struct {
	// Errors is the response errors.
	Errors []Error `json:"errors,omitempty"`
}

ResponseError is the response structure for the application.

type TodoHandler

type TodoHandler interface {
	Create(c echo.Context) error
	Update(c echo.Context) error
	Delete(c echo.Context) error
	Find(c echo.Context) error
	FindAll(c echo.Context) error
}

TodoHandler is the request handler for the todo endpoint.

func NewTodo

func NewTodo(s service.Todo) TodoHandler

NewTodo returns a new instance of the todo handler.

type UpdateRequest

type UpdateRequest struct {
	UpdateRequestBody
	UpdateRequestPath
}

UpdateRequest is the request parameter for updating a todo

type UpdateRequestBody

type UpdateRequestBody struct {
	Task   string       `json:"task,omitempty"`
	Status model.Status `json:"status,omitempty"`
}

UpdateRequestBody is the request body for updating a todo

type UpdateRequestPath

type UpdateRequestPath struct {
	ID int `param:"id" validate:"required"`
}

UpdateRequestPath is the request parameter for updating a todo

Jump to

Keyboard shortcuts

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