Back to godoc.org

Package reqdata

v0.3.1
Latest Go to latest

The latest major version is .

Published: Apr 4, 2020 | License: MIT | Module: git.xdrm.io/go/aicra

Index

Constants

const ErrInvalidJSON = cerr("invalid json")

ErrInvalidJSON is returned when json parse failed

const ErrInvalidMultipart = cerr("invalid multipart")

ErrInvalidMultipart is returned when multipart parse failed

const ErrInvalidType = cerr("invalid type")

ErrInvalidType - parameter value does not satisfy its type

const ErrMissingRequiredParam = cerr("missing required param")

ErrMissingRequiredParam - required param is missing

const ErrMissingURIParameter = cerr("missing URI parameter")

ErrMissingURIParameter - missing an URI parameter

const ErrParseParameter = cerr("cannot parse parameter")

ErrParseParameter is returned when a parameter fails when parsing

const ErrUnknownType = cerr("unknown type")

ErrUnknownType is returned when encountering an unknown type

type T

type T struct {
	Data map[string]interface{}
	// contains filtered or unexported fields
}

T represents all data that can be caught from an http request for a specific configuration Service; it features: - URI (from the URI) - GET (standard url data) - POST (from json, form-data, url-encoded)

- 'application/json'                  => key-value pair is parsed as json into the map
- 'application/x-www-form-urlencoded' => standard parameters as QUERY parameters
- 'multipart/form-data'               => parse form-data format

func New

func New(service *config.Service) *T

New creates a new empty store.

func (*T) GetForm

func (i *T) GetForm(req http.Request) error

GetForm parameters the from request - parse 'form-data' if not supported for non-POST requests - parse 'x-www-form-urlencoded' - parse 'application/json'

func (*T) GetQuery

func (i *T) GetQuery(req http.Request) error

GetQuery data from the url query parameters

func (*T) GetURI

func (i *T) GetURI(req http.Request) error

GetURI parameters

Package Files

  • errors.go
  • set.go
Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier