models

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Shared models for Spanreed ecosystem.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PagingReq

type PagingReq struct {
	// How far to offset the page.
	Offset int
	// Maximum item count to return.
	Limit int
}

Paging parameters for request.

func PagingReqFromParams

func PagingReqFromParams(
	headers valueFetcher, defaultLimit int,
) (pagingReq *PagingReq, err error)

Generates a PagingReq object from request parameters.

func (*PagingReq) ToParams

func (pagingReq *PagingReq) ToParams(params valueSetter)

Dumps paging information to request URL params.

type PagingResp

type PagingResp struct {
	*PagingReq
	TotalItems  int
	TotalPages  int
	CurrentPage int
	Next        string
	Previous    string
}

func PagingRespFromHeaders

func PagingRespFromHeaders(
	params valueFetcher, defaultLimit int,
) (pagingResp *PagingResp, err error)

PagingRespFromHeaders generates a PagingResp object from response headers.

func (*PagingResp) ToHeaders

func (pagingResp *PagingResp) ToHeaders(headers valueSetter)

type SpanError

type SpanError = spanerrors.SpanError

Alias to errors_api.SpanError

type SpanErrorType

type SpanErrorType = spanerrors.SpanErrorType

Alias to errors_api.SpanErrorType

Jump to

Keyboard shortcuts

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