v1

package
v0.0.0-...-0afa638 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrBadRequest

func ErrBadRequest(err error) render.Renderer

ErrBadRequest error

func ErrInternalServerError

func ErrInternalServerError(err error) render.Renderer

ErrInternalServerError error

func ErrNotFound

func ErrNotFound(err error) render.Renderer

ErrNotFound error

func Router

func Router() http.Handler

Router defines the routes for the v1 API

Types

type CollectionResponse

type CollectionResponse struct {
	Documents []map[string]interface{} `json:"documents"`
	// contains filtered or unexported fields
}

CollectionResponse returns a collection of documents

func (*CollectionResponse) Render

Render is called before the response is written

type ErrResponse

type ErrResponse struct {
	Err            error `json:"-"`          // low-level runtime error
	HTTPStatusCode int   `json:"statusCode"` // http response status code

	StatusText string      `json:"status"`           // user-level status message
	AppCode    int64       `json:"code,omitempty"`   // application-specific error code
	ErrorText  string      `json:"error,omitempty"`  // application-level error message, for debugging
	Fields     interface{} `json:"fields,omitempty"` // field validation errors
}

ErrResponse response

func (*ErrResponse) Render

func (e *ErrResponse) Render(w http.ResponseWriter, r *http.Request) error

Render runs before response is written

type JSONResponse

type JSONResponse struct {
	Document *map[string]interface{} `json:"document"`
	// contains filtered or unexported fields
}

JSONResponse is the response payload

func (*JSONResponse) Render

func (res *JSONResponse) Render(w http.ResponseWriter, r *http.Request) error

Render is called before the response is written

Jump to

Keyboard shortcuts

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