common

package
v0.0.1-beta Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateErrorResponse

func GenerateErrorResponse(c echo.Context, data interface{}, message string) error

GenerateErrorResponse Http error response

func GenerateForbiddenResponse

func GenerateForbiddenResponse(c echo.Context, data interface{}, message string) error

GenerateForbiddenResponse Http forbidden response

func GenerateSuccessResponse

func GenerateSuccessResponse(c echo.Context, data interface{}, metadata *MetaData, message string) error

GenerateSuccessResponse Http success response

func GenerateUnauthorizedResponse

func GenerateUnauthorizedResponse(c echo.Context, data interface{}, message string) error

GenerateUnauthorizedResponse Http unauthorized response

Types

type MetaData

type MetaData struct {
	Page       int64               `json:"page"`
	PerPage    int64               `json:"per_page"`
	PageCount  int64               `json:"page_count"`
	TotalCount int64               `json:"total_count"`
	Links      []map[string]string `json:"links"`
}

MetaData Http response metadata

func GetPaginationMetadata

func GetPaginationMetadata(page, limit, totalRecords, totalPaginatedRecords int64) MetaData

GetPaginationMetadata return pagination metadata

type ResponseDTO

type ResponseDTO struct {
	Data    interface{} `json:"data" msgpack:"data" xml:"data"`
	Status  string      `json:"status" msgpack:"status" xml:"status"`
	Message string      `json:"message" msgpack:"message" xml:"message"`
}

ResponseDTO Http response dto

type ResponseDTOWithPagination

type ResponseDTOWithPagination struct {
	Metadata *MetaData   `json:"_metadata"`
	Data     interface{} `json:"data" msgpack:"data" xml:"data"`
	Status   string      `json:"status" msgpack:"status" xml:"status"`
	Message  string      `json:"message" msgpack:"message" xml:"message"`
}

ResponseDTOWithPagination Http response dto with pagination

Jump to

Keyboard shortcuts

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