handler

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// 400
	ErrorAlreadyRegistered = errors.New("already registered")
	ErrorIDCannotRequest   = errors.New("ID cannot be requested")
	ErrorIDUnchangeable    = errors.New("ID is unchangeable")

	// 401
	ErrorAuthenticationFailed = errors.New("authentication failed")

	// 404
	ErrorNotFound = errors.New("not found")
)

Functions

func NewCustomValidator

func NewCustomValidator() *customValidator

func NewEcho

func NewEcho(h *Handler) *echo.Echo

Types

type Handler

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

func NewHandler

func NewHandler(logger *slog.Logger, s service.Service, config *HandlerConfig) *Handler

func (*Handler) CreatePrice

func (h *Handler) CreatePrice(c echo.Context) error

価格の登録

func (*Handler) CreateUser added in v1.0.6

func (h *Handler) CreateUser(c echo.Context) error

ユーザの登録

func (*Handler) DeletePrice

func (h *Handler) DeletePrice(c echo.Context) error

価格の削除

func (*Handler) FindPrice

func (h *Handler) FindPrice(c echo.Context) error

価格の取得

func (*Handler) FindPrices

func (h *Handler) FindPrices(c echo.Context) error

価格の一覧

func (*Handler) GenToken

func (h *Handler) GenToken(c echo.Context) error

トークン発行

func (*Handler) UpdatePrice

func (h *Handler) UpdatePrice(c echo.Context) error

価格の更新

type HandlerConfig added in v1.2.2

type HandlerConfig struct {
	JwtKey      []byte
	ValidityMin int // JWTのexp
	Location    *time.Location
	Indent      string // レスポンスのJSONのインデント
	TimeoutSec  int
}

type JwtCustomClaims

type JwtCustomClaims struct {
	jwt.RegisteredClaims

	UserId uint
}

Jump to

Keyboard shortcuts

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