form

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package form 用于处理 www-form-urlencoded 编码

func read(w http.ResponseWriter, r *http.Request) {
    ctx := web.New(w, r)
    vals := urls.Values{}
    !ctx.Read(vals)
}

func write(w http.ResponseWriter, r *http.Request) {
    ctx := web.New(w, r)
    vals := urls.Values{}
    vals.Add("name", "caixw")
    ctx.Render(http.StatusOK, vals, nil)
}

Index

Constants

View Source
const MimeType = "application/x-www-form-urlencoded"

MimeType 当前编码的媒体类型

Variables

This section is empty.

Functions

func Marshal

func Marshal(v interface{}) ([]byte, error)

Marshal 针对 www-form-urlencoded 内容的 MarshalFunc 实现

func Unmarshal

func Unmarshal(data []byte, v interface{}) error

Unmarshal 针对 www-form-urlencoded 内容的 UnmarshalFunc 实现

Types

type Marshaler

type Marshaler interface {
	MarshalForm() ([]byte, error)
}

Marshaler 将一个普通对象转换成 form 类型

type Unmarshaler

type Unmarshaler interface {
	UnmarshalForm([]byte) error
}

Unmarshaler 将 form 类型转换成一个对象

Jump to

Keyboard shortcuts

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