jsonapichi

package module
v0.0.0-...-8221f3d Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

README

jsonapi-chi

Is the golang Chi router jsonapi handler helper.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetID

func GetID(next http.Handler) http.Handler

GetID is the middleware that stores the 'id' in the request context with the key specified in the `jsonapi-handler.IDKey`.

func GroupModel

func GroupModel(creator *handler.Creator, model interface{}, endpoints ...EndpointType) chi.Router

GroupModel creates chi router group for given 'model' with provided 'endpoints' for the Default neuron Controller. By default all endpoints are set.

func GroupModelC

func GroupModelC(c *controller.Controller, creator *handler.Creator, model interface{}, endpoints ...EndpointType) chi.Router

GroupModelC creates chi router group for given 'model' with provided 'endpoints' for given 'c' controller. By default all endpoints are set.

func RouteModel

func RouteModel(r chi.Router, creator *handler.Creator, model interface{}, endpoints ...EndpointType)

RouteModel routes model endpoints for given 'r' chi Router. By default all endpoints are set.

func RouteModelC

func RouteModelC(c *controller.Controller, r chi.Router, creator *handler.Creator, model interface{}, endpoints ...EndpointType)

RouteModelC routes model endpoints for given 'r' chi Router for given 'c' neuron controller. By default all endpoints are set.

Types

type EndpointType

type EndpointType int
const (
	Create EndpointType = iota
	Get
	GetRelatedFields
	GetRelationships
	List
	Patch
	PatchRelationships
	Delete
)

func AllEndpoints

func AllEndpoints() []EndpointType

AllEndpoints returns all endpoint types.

Jump to

Keyboard shortcuts

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