Documentation
¶
Overview ¶
This file contains a few routines for parsing form values
Index ¶
- func AddPrefixedValues(addedTo url.Values, toBeAdded url.Values, prefix string)
- func AddValues(addedTo url.Values, toBeAdded url.Values)
- func DateRangeToCGIArgs(s, e time.Time) string
- func DateRangeToValues(s, e time.Time) url.Values
- func ExtractAllCGIArgs(r *http.Request) url.Values
- func FormValueCheckbox(r *http.Request, name string) bool
- func FormValueCommaSepStrings(r *http.Request, name string) []string
- func FormValueCommaSpaceSepStrings(r *http.Request, name string) []string
- func FormValueDateRange(r *http.Request) (s, e time.Time, err error)
- func FormValueDuration(r *http.Request, name string) time.Duration
- func FormValueEpochTime(r *http.Request, name string) time.Time
- func FormValueFloat64(w http.ResponseWriter, r *http.Request, name string) float64
- func FormValueFloat64EatErrs(r *http.Request, name string) float64
- func FormValueFloat64WithDefault(r *http.Request, name string, dflt float64) float64
- func FormValueInt64(r *http.Request, name string) int64
- func FormValueIntWithDefault(r *http.Request, name string, dflt int) int
- func GetTemplates(ctx context.Context) *template.Template
- func ParseRecursive(t *template.Template, dir string) *template.Template
- func URLStringReplacingGETArgs(r *http.Request, vals *url.Values) string
- func ValuesIntoTemplateParams(stem string, values url.Values, params map[string]interface{})
- type BaseHandler
- type ContextHandler
- type CtxMaker
- type Presenter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddPrefixedValues ¶
func DateRangeToCGIArgs ¶
func ExtractAllCGIArgs ¶
ExtractAllCGIArgs gets both GET and POST arguments into a single map
func FormValueCommaSpaceSepStrings ¶
Separate by comma, or space
func FormValueDateRange ¶
Return values:
s will be the first second of the first day; e will be the last second of the last day;
For ranges of exactly one day, e and s will be in the same day.
Formats:
?date=today ?date=yesterday ?date=day&day=2006/01/02 ?date=range&range_from=2006/01/01&range_to=2018/01/01
func FormValueDuration ¶
As well as the normal syntax, we support "7d", where a day is 24*time.Hour.
func FormValueFloat64 ¶
func FormValueIntWithDefault ¶
func GetTemplates ¶
GetFoo: given a context, extracts the object (or panics; should not be optional)
func ParseRecursive ¶
ParseRecursive walks the directory structure, loading all the files it finds. Will panic on failure. Follows symlinks.
func URLStringReplacingGETArgs ¶
Creates a URL that matches the request, adding the vals as CGI GET parameters
Types ¶
type BaseHandler ¶
type BaseHandler func(http.ResponseWriter, *http.Request)
func WithCtx ¶
func WithCtx(f CtxMaker, ch ContextHandler) BaseHandler
Outermost wrapper; all other wrappers take (and return) contexthandlers
func WithCtxTmpl ¶
func WithCtxTmpl(f CtxMaker, t *template.Template, ch ContextHandler) BaseHandler
type ContextHandler ¶
func WithTemplates ¶
func WithTemplates(t *template.Template, ch ContextHandler) ContextHandler
WithFoo: injects relevant object into the context