cmsdomain

package
v0.0.0-...-81386c3 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadRequest = APIError{
		StatusCode: http.StatusBadRequest,
		Type:       "client-error",
		Error:      "Default",
		Message:    "Cannot process current request",
		Method:     "Default",
	}
	ErrInvalidJSON = APIError{
		StatusCode: http.StatusBadRequest,
		Type:       "invalid-json",
		Error:      "Default",
		Message:    "Invalid or malformed JSON",
		Method:     "Default",
	}
	ErrInternalServer = APIError{
		StatusCode: http.StatusInternalServerError,
		Type:       "server-error",
		Error:      "Default",
		Message:    "Internal server error",
		Method:     "Default",
	}
)

Functions

This section is empty.

Types

type APIError

type APIError struct {
	StatusCode int    `json:"-"`
	Type       string `json:"type"`
	Error      string `json:"error"`
	Message    string `json:"message,omitempty"`
	Method     string `json:"method,omitempty"`
}

func (APIError) Send

func (a APIError) Send(w http.ResponseWriter) error

type ResponseAPI

type ResponseAPI struct {
	Success bool        `json:"success"`
	Status  int         `json:"status,omitempty"`
	Result  interface{} `json:"result,omitempty"`
}

func Success

func Success(result interface{}, status int) *ResponseAPI

func (*ResponseAPI) Send

func (r *ResponseAPI) Send(w http.ResponseWriter) error

Jump to

Keyboard shortcuts

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