rest

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package rest provides utilities shared across the gateway and scheduler adapters to build REST APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorInternal

func ErrorInternal(res http.ResponseWriter, req *http.Request)

ErrorInternal handles HTTP 500 error responses. When called, the calling function must return to avoid writing several times on the HTTP response writer.

func ErrorNotFound

func ErrorNotFound(res http.ResponseWriter, req *http.Request)

ErrorNotFound handles HTTP 404 error responses. When called, the calling function must return to avoid writing several times on the HTTP response writer.

func Middleware

func Middleware(next http.Handler) http.Handler

Middleware is the default HTTP middleware used in the gateway and scheduler services. It can be replaced by any in-house function to control the HTTP request / response lifecycle of your application.

Types

type Pagination added in v0.14.0

type Pagination struct {

	// Current is the current page.
	Current uint16 `json:"current"`

	// Previous is the previous page. It will be nil if there is no previous page.
	Previous *uint16 `json:"previous"`

	// Next is the next page. It will be nil if there is no next page.
	Next *uint16 `json:"next"`

	// First is the first page. It will always be 1.
	First uint16 `json:"first"`

	// Last is the last page.
	Last uint16 `json:"last"`
}

Pagination holds the pagination details when looking for entries in the REST API.

Jump to

Keyboard shortcuts

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