response

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReturnInternalServerError

func ReturnInternalServerError()

ReturnInternalServerError can be called from anywhere in the application in order to terminate the current flow and return `500 Internal Server Error` response.

Types

type Error

type Error struct {
	Operation string            `json:"operation,omitempty"`
	Message   string            `json:"message,omitempty"`
	Errors    map[string]string `json:"errors,omitempty"`
}

func NewError

func NewError() *Error

NewError returns `*Error` instance.

func (Error) Write

func (e Error) Write(w http.ResponseWriter, code int, headers map[string]string)

Write calls `write` function to write error response.

type Success

type Success struct {
	Operation string      `json:"operation,omitempty"`
	Data      interface{} `json:"data,omitempty"`
	Meta      interface{} `json:"meta,omitempty"`
}

func NewSuccess

func NewSuccess() *Success

NewSuccess returns `*Success` instance.

func (Success) Write

func (s Success) Write(w http.ResponseWriter, code int, headers map[string]string)

Write calls `write` function to write success response.

Jump to

Keyboard shortcuts

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