data

package module
v0.0.0-...-eec7e72 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2014 License: MIT Imports: 3 Imported by: 2

README

martini-data is a martini middleware wrapper around github.com/albrow/go-data-parser. It automatically parses data from the request body and the url query parameters, provides helper methods for converting data to other types, and supports validations.

Installation and Usage

Install like you would any other package:

go get github.com/albrow/martini-data

Don't forget to import:

import "github.com/albrow/martini-data"

Then add to your martini middleware stack:

m.Use(data.Parser())

Now you can access a Data object in your handler functions:

func MyHandler(data data.Data, res http.ResponseWriter) {
	// ...
}

Note: the Data type comes from the github.com/albrow/go-data-parser package, so you will need to import it as well.

import "github.com/albrow/go-data-parser"

See github.com/albrow/go-data-parser for more information about Data and Validator.

Documentation

Overview

Package data is a martini middleware wrapper around github.com/albrow/go-data-parser.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parser

func Parser() martini.Handler

Returns a martini middleware which injects a data object into the martini context. The data object is composed of form data from the body of the request and url query parameters. See http://godoc.org/github.com/albrow/go-data-parser

Types

type Data

type Data map[string]string

Jump to

Keyboard shortcuts

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