resource

package
v0.0.0-...-be41bbe Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2018 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BadRequest

func BadRequest(payload interface{}) error

BadRequest http 400 error

func CreateMethod

func CreateMethod(e *echo.Group, newFn newInstanceFn, crFn createFn)

CreateMethod creates an instance of a Resource

func Created

func Created(c echo.Context, id uint) error

Created http 201 response

func DeleteMethod

func DeleteMethod(e *echo.Group, fn deleteFn)

DeleteMethod creates a standard delete method for a resource

func GetMethod

func GetMethod(e *echo.Group, fn getByIDFn)

GetMethod creates a get method to retrieve a resource by ID

func InternalServerError

func InternalServerError(payload interface{}) error

InternalServerError http 500 error

func NotFound

func NotFound(payload interface{}) error

NotFound http 404 error

func PatchMethod

func PatchMethod(e *echo.Group, newFn newInstanceFn, pFn patchFn)

PatchMethod creates a standard restful patch method

func Unauthorized

func Unauthorized() error

Unauthorized http 401 status

func UpdateMethod

func UpdateMethod(e *echo.Group, newFn newInstanceFn, upFn updateFn)

UpdateMethod creates a standard restful update method

Types

type HTTPParam

type HTTPParam struct {
	// contains filtered or unexported fields
}

HTTPParam descriptor for an HTTP parameter

func Param

func Param(name string) *HTTPParam

Param creates an HTTPParam

func (*HTTPParam) InPath

func (p *HTTPParam) InPath() *HTTPParam

InPath identifies the parameter in the request path

func (*HTTPParam) Int

func (p *HTTPParam) Int(c echo.Context, value *int) error

Int sets the param's type to int

func (*HTTPParam) Optional

func (p *HTTPParam) Optional(defaultValue string) *HTTPParam

Optional sets the param as optional

func (*HTTPParam) Required

func (p *HTTPParam) Required() *HTTPParam

Required sets the param as required

func (*HTTPParam) String

func (p *HTTPParam) String(c echo.Context, value *string) error

Int sets the param's type to int

type HTTPParamValue

type HTTPParamValue struct {
	IntValue    int
	UIntValue   uint
	StringValue string
}

HTTPParamValue parameter value for http

type Location

type Location int

Location type of parameter on an HTTP Request

const (
	// Query parameter is on the HTTP query string
	Query Location = iota

	// Path parameter is part of the HTTP Request path
	Path
)

type ValueType

type ValueType int

ValueType The type of values allowed

const (
	// Int type
	Int ValueType = iota

	// String type
	String
)

Jump to

Keyboard shortcuts

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