endpoint

package
v1.14.2 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Paginate added in v1.8.0

func Paginate(data interface{}, page, limit, total int64) interface{}

Paginate transfer object

Types

type Endpoint

type Endpoint func(ctx context.Context, request interface{}) (response EndpointResponse, err error)

Endpoint is the fundamental building block of servers and clients. It represents a single RPC method.

type EndpointResponse added in v1.6.0

type EndpointResponse interface {
	Code() int
	Data() interface{}
}

EndpointResponse the request result.

func Nop

func Nop(context.Context, interface{}) (EndpointResponse, error)

Nop is an endpoint that does nothing and returns a nil error. Useful for tests.

func Response added in v1.6.0

func Response(code int, data interface{}) EndpointResponse

Response transfer object

type EntityPaging added in v1.9.0

type EntityPaging struct {
	Data   interface{} `json:"data"`
	Paging Paging      `json:"paging"`
}

type Middleware

type Middleware func(Endpoint) Endpoint

Middleware is a chainable behavior modifier for endpoints.

type Paging added in v1.9.0

type Paging struct {
	Page  int64 `json:"page"`
	Total int64 `json:"total"`
	Limit int64 `json:"limit"`
}

Jump to

Keyboard shortcuts

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