response

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusSuccess = "success"
	StatusFailure = "failure"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiResponse

type ApiResponse struct {
	Response       Response
	HttpStatusCode int
}

func Format

func Format(action string, err *er.WdbError, data interface{}, notices ...string) ApiResponse

func (ApiResponse) Marshal

func (r ApiResponse) Marshal() []byte

type Error

type Error struct {
	Code  string     `json:"code,omitempty"`
	Stack ErrorStack `json:"stack,omitempty"`
}

type ErrorStack

type ErrorStack []string

type Response

type Response struct {
	Action   string       `json:"action"`
	Status   string       `json:"status"`
	Error    *Error       `json:"error,omitempty"`
	Data     *interface{} `json:"data,omitempty"` // would be removed in future in favour of Response. See : https://github.com/TanmoySG/wunderDB/issues/121
	Response *interface{} `json:"response,omitempty"`
	Notices  []string     `json:"notices,omitempty"`
}

Jump to

Keyboard shortcuts

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