leafHttpResponse

package
v0.0.0-...-0829b1e Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const ApiResponse = "api-response"

Variables

This section is empty.

Functions

func NewJSONResponse

func NewJSONResponse(
	eCtx echo.Context,
	statusCode int,
	data interface{},
) error

Types

type BasePagingResponse

type BasePagingResponse struct {
	Count       int          `json:"count"`
	CurrentPage int          `json:"currentPage"`
	TotalPage   int          `json:"totalPages"`
	Params      PagingParams `json:"params"`
}

func (BasePagingResponse) Val

func (p BasePagingResponse) Val() interface{}

type Error

type Error struct {
	Message string       `json:"message"`
	Code    int          `json:"code"`
	Errors  []ErrorField `json:"errors,omitempty"`
}

type ErrorField

type ErrorField struct {
	Field  string `json:"field"`
	Reason string `json:"reason"`
}

type ItemsResponse

type ItemsResponse struct {
	Items []interface{} `json:"items"`
}

type PagingParams

type PagingParams struct {
	Page   int         `json:"page"`
	Limit  int         `json:"limit"`
	Sort   []string    `json:"sort"`
	Filter interface{} `json:"filter,omitempty"`
}

type PagingResponse

type PagingResponse struct {
	Count       int          `json:"count"`
	CurrentPage int          `json:"currentPage"`
	TotalPage   int          `json:"totalPages"`
	Params      PagingParams `json:"params"`
	Items       interface{}  `json:"items"`
}

func (PagingResponse) Val

func (p PagingResponse) Val() interface{}

type Response

type Response interface {
	Val() interface{}
}

type SimplePagingResponse

type SimplePagingResponse struct {
	CurrentPage int          `json:"currentPage"`
	Next        bool         `json:"next"`
	Params      PagingParams `json:"params"`
}

Jump to

Keyboard shortcuts

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