response

package
v0.0.0-...-a94409f Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2021 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package response provides data structure to build HTTP JSON response structure.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EmptyMeta

type EmptyMeta struct{}

EmptyMeta represents an empty struct.

type Error

type Error struct {
	// Errors represents list of errors that are visible in response.
	Errors []error `json:"errors"`
	// Meta represents auxiliary data that is visible in response.
	Meta interface{} `json:"meta"`
}

Error represents error response.

func NewError

func NewError(errors ...error) *Error

NewError creates an instance of Error response.

type Success

type Success struct {
	// Data represents any primary data that is visible in response.
	Data interface{} `json:"data"`
	// Meta represents auxiliary data that is visible in response.
	Meta interface{} `json:"meta"`
}

Success represents success response.

func NewSuccess

func NewSuccess(data, meta interface{}) *Success

NewSuccess creates an instance of Success response.

Jump to

Keyboard shortcuts

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