api

package
v0.0.0-...-22ae5b0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DebugFromContext

func DebugFromContext(ctx context.Context) bool

DebugFromContext returns remote IP address from context

func DebugToContext

func DebugToContext(production bool) func(next http.Handler) http.Handler

Packs remote address to context

func OK

func OK() *successWrap

OK returns the default Success message

func RemoteAddrFromContext

func RemoteAddrFromContext(ctx context.Context) string

RemoteAddrFromContext returns remote IP address from context

func RemoteAddrToContext

func RemoteAddrToContext(next http.Handler) http.Handler

Packs remote address to context

func Send

func Send(w http.ResponseWriter, r *http.Request, rr ...interface{})

Send handles first non-nil (and non-empty) payload and encodes it or it's results (when fn)

See encode() for details

func Success

func Success(success ...string) *successWrap

Success returns a structured success message for API responses

Types

type CallFrame

type CallFrame struct {
	Function string `json:"function"`
	File     string `json:"file"`
	Line     int    `json:"line"`
}

type ErrorPayload

type ErrorPayload struct {
	Message   string                 `json:"message"`
	Context   map[string]interface{} `json:"context,omitempty"`
	Callstack []*CallFrame           `json:"callstack,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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