echo

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2021 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GetResultData

type GetResultData struct {
	// Contains query param passed by client.
	// To cross check if server accept the correct param from client.
	Param interface{} `json:"http_param"`

	// Defines the current API response generated.
	GeneratedDate string `json:"generated_date"`

	// Describes total number of data generated by current request.
	TotalData string `json:"total_data"`

	// Request result data.
	Data interface{} `json:"data"`
}

GetResultData is the default response result data format. For method GET.

type PostResultData

type PostResultData struct {
	// Contains json body passed by client.
	// To cross check if server accept the correct param from client.
	Param interface{} `json:"http_param"`

	// Defines the current API request execution time.
	ExecutedDate string `json:"executed_date"`

	// Describes total number of data is affected by current request.
	RowsAffected int `json:"rows_affected"`
}

PostResultData is the default response result data format. For method PUT, PATCH, POST, DELETE.

type Response

type Response struct {
	// Describes api status or response code.
	Code string `json:"api_code"`

	// Describes status message that should be shown to user.
	DisplayMsg string `json:"api_display_message"`

	// Describes server real error message that should not be shown to user.
	RawMsg string `json:"api_raw_message"`

	// Used for debugging.
	// It uses client request `X-Request-ID` header.
	// If empty, generated by server instead.
	RequestID string `json:"trace_id"`

	// Describes current api generated result data.
	ResultData interface{} `json:"api_result_data"`
}

Response is the default response format.

func GetDefaultResponse

func GetDefaultResponse(c echo.Context) Response

GetDefaultResponse is the default response for http get request

func GetSuccessResponse

func GetSuccessResponse(c echo.Context, totalData int, data interface{}) Response

GetSuccessResponse is the success response for http get request

func PostDefaultResponse

func PostDefaultResponse(c echo.Context) Response

PostDefaultResponse is the default response for http post request

func PostSuccessResponse

func PostSuccessResponse(c echo.Context, param interface{}, rowsAffected int) Response

PostSuccessResponse is the success response for http post request

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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