response

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: May 23, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrZeroCode = errors.New("0 is not a valid code")

Functions

This section is empty.

Types

type ErrMarshal added in v0.0.15

type ErrMarshal struct {
	// contains filtered or unexported fields
}

func (ErrMarshal) Error added in v0.0.15

func (e ErrMarshal) Error() string

type ErrWrite added in v0.0.15

type ErrWrite struct {
	// contains filtered or unexported fields
}

func (ErrWrite) Error added in v0.0.15

func (e ErrWrite) Error() string

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) error

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) error

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