params

package module
v0.0.0-...-89dc9f1 Latest Latest
Warning

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

Go to latest
Published: May 3, 2015 License: MIT Imports: 5 Imported by: 0

README

params

Create encoded url parameters from structs

Install

go get github.com/calce/params

Example

import "github.com/calce/params"

type Params struct {
	local string		// unexported fields are ignored
	BeginTime string	`param:"begin_time"`
	EndTime string		`param:"end_time"`
	Ninja string		`param:"_"`	// fields with param tag "_" are ignored
	Number int			`param:"number"`
	Money float64		`param:"money"`	
}

p := Params{
	local: "things",
	BeginTime: "2013-01-15T00:00:00Z",
	EndTime: "2013-01-31T00:00:00Z",
	Ninja: "things",
	Number: 999,
	Money: 999.999,
}
s, err := params.Encode(&p)
// "begin_time=2013-01-15T00%3A00%3A00Z&end_time=2013-01-31T00%3A00%3A00Z&money=999.999&number=999"

Documentation

Overview

Params create url encoded strings from structs Supported field types: string, int, float

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encode

func Encode(s interface{}) (string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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