rest

package
v1.0.0-prototype.5 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2019 License: ISC Imports: 6 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractJson

func ExtractJson(w http.ResponseWriter, r *http.Request, d interface{}, dDesc string) terror.Terror

func HandleError

func HandleError(w http.ResponseWriter, err terror.Terror) terror.Terror

func StandardResponse

func StandardResponse(w http.ResponseWriter, d interface{}, message string, searchParams *SearchParams) error

Types

type PageInfo

type PageInfo struct {
	// 1-based index
	PageIndex      int   `json:"pageIndex"`
	ItemsPerPage   int   `json:"itemsPerPage"`
	TotalItemCount int64 `json:"totalItemCount"`
	TotalPageCount int64 `json:"totalPageCount"`
}

type SearchParams

type SearchParams struct {
	// TODO: do we use scopes?
	Scopes   []string  `json:"scopes"`
	Terms    []string  `json:"terms"`
	Sort     string    `json:"sort"`
	PageInfo *PageInfo `json:"pageInfo"`
}

func (*SearchParams) EnsureSingleScope

func (sp *SearchParams) EnsureSingleScope() terror.Terror

func (*SearchParams) SetTotalPages

func (sp *SearchParams) SetTotalPages(count int64)

Jump to

Keyboard shortcuts

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