response

package
v0.0.0-...-bba364d Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: Apache-2.0 Imports: 3 Imported by: 5

Documentation

Index

Constants

View Source
const (
	// RecordNotFound : Code error for not found
	RecordNotFound = 20023
	// ResourceNotFound : Code error for recurse not found
	ResourceNotFound = 20022
	// BadRequest : Code error for invalid request
	BadRequest = 20001
	// InternalServerError : Code error for internal server error
	InternalServerError = 10000
	// Unauthorized : Code error for request unauthorized
	Unauthorized = 30001
)

Variables

This section is empty.

Functions

func GenerateHTTPResponse

func GenerateHTTPResponse(w http.ResponseWriter, statusCode int, response interface{})

GenerateHTTPResponse : Generate http response

Types

type ErrorResponse

type ErrorResponse struct {
	DeveloperMessage string `json:"developerMessage"`
	UserMessage      string `json:"userMessage"`
	ErrorCode        int    `json:"errorCode"`
	MoreInfo         string `json:"moreInfo"`
}

ErrorResponse : Struct of error for response

func GenerateErrorResponse

func GenerateErrorResponse(errorCode int, developerMessage, userMessage string) ErrorResponse

GenerateErrorResponse : Generate error response

type SuccessResponse

type SuccessResponse struct {
	Meta    meta        `json:"meta"`
	Records interface{} `json:"records"`
}

SuccessResponse : Struct of success for response

func GenerateSuccessResponse

func GenerateSuccessResponse(obj interface{}, limit, offset, recordCount int) SuccessResponse

GenerateSuccessResponse : Generate response of success

Jump to

Keyboard shortcuts

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