1 Star 0 Fork 0

wpkg / form

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
form.go 1.14 KB
一键复制 编辑 原始数据 按行查看 历史
arvin 提交于 2023-01-06 04:43 . sync at Fri 06 Jan 2023 04:43:23 AM CST
package form
import (
"reflect"
"time"
)
const (
blank = ""
ignore = "-"
fieldNS = "Field Namespace:"
errorText = " ERROR:"
)
var (
timeType = reflect.TypeOf(time.Time{})
)
// Mode specifies which mode the form decoder is to run
type Mode uint8
const (
// ModeImplicit tries to parse values for all
// fields that do not have an ignore '-' tag
ModeImplicit Mode = iota
// ModeExplicit only parses values for field with a field tag
// and that tag is not the ignore '-' tag
ModeExplicit
)
// AnonymousMode specifies how data should be rolled up
// or separated from anonymous structs
type AnonymousMode uint8
const (
// AnonymousEmbed embeds anonymous data when encoding
// eg. type A struct { Field string }
// type B struct { A, Field string }
// encode results: url.Values{"Field":[]string{"B FieldVal", "A FieldVal"}}
AnonymousEmbed AnonymousMode = iota
// AnonymousSeparate does not embed anonymous data when encoding
// eg. type A struct { Field string }
// type B struct { A, Field string }
// encode results: url.Values{"Field":[]string{"B FieldVal"}, "A.Field":[]string{"A FieldVal"}}
AnonymousSeparate
)
Go
1
https://gitee.com/wpkg/form.git
git@gitee.com:wpkg/form.git
wpkg
form
form
27a183b57d8f

搜索帮助