wrapper

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DataField    = "data"
	TraceIDField = "trace_id"
	SuccessField = "success"
	// CodeField     = "code"
	MessageField  = "message"
	TotalField    = "total"
	MetadataField = "metadata"
)

Variables

This section is empty.

Functions

func Translate

func Translate(c echo.Context, res Response) error

Translate response

func Wrap

func Wrap(fn EchoHandlerFunc) echo.HandlerFunc

Types

type EchoHandlerFunc

type EchoHandlerFunc func(c echo.Context) Response

type FailResponse added in v0.2.2

type FailResponse struct {
	Success bool   `json:"success" example:"false"`
	Message string `json:"message" example:"Example message"`
}

For API docs

type Response

type Response struct {
	Error        error
	Data         interface{}
	Status       int
	Total        int64
	IncludeTotal bool
}

Response body

type SuccessResponse added in v0.2.2

type SuccessResponse struct {
	Success  bool        `json:"success" example:"true"`
	Data     interface{} `json:"data"`
	Metadata interface{} `json:"metadata"`
}

For API docs

Jump to

Keyboard shortcuts

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