response

package
v0.0.0-...-ac81adf Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Errors []string `json:"errors"`
	// contains filtered or unexported fields
}

Error defines the structure of success for http responses

func NewError

func NewError(err error, status int) *Error

NewError creates new Error

func NewErrors

func NewErrors(errs []error, status int) *Error

NewErrors creates new Error

func (Error) Send

func (e Error) Send(w http.ResponseWriter) error

Send returns a response with JSON format

type Success

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

Success defines the structure of success for http responses

func NewSuccess

func NewSuccess(result interface{}, status int) Success

NewSuccess creates new Success

func (Success) Send

func (r Success) Send(w http.ResponseWriter) error

Send returns a response with JSON format

Jump to

Keyboard shortcuts

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