Documentation
¶
Index ¶
- Variables
- func JavaScriptReplace(s string, pattern *regexp.Regexp, ...) string
- func NormalizeName(name string) string
- func ParseNumberType(type1, type2 string) string
- func ParseType(t any) (rtype string, comment string)
- func RegularizeName(name string) string
- func Unmarshal(data []byte, name string) ([]byte, error)
- type Converter
Constants ¶
This section is empty.
Variables ¶
View Source
var Abbreviation = map[string]struct{}{ "API": Void, "ASCII": Void, "CPU": Void, "CSS": Void, "DNS": Void, "EOF": Void, "GUID": Void, "HTML": Void, "HTTP": Void, "HTTPS": Void, "ID": Void, "IP": Void, "JSON": Void, "LHS": Void, "QPS": Void, "RAM": Void, "RHS": Void, "RPC": Void, "SLA": Void, "SMTP": Void, "SSH": Void, "TCP": Void, "TLS": Void, "TTL": Void, "UDP": Void, "UI": Void, "UID": Void, "UUID": Void, "URI": Void, "URL": Void, "UTF8": Void, "VM": Void, "XML": Void, "XSRF": Void, "XSS": Void, }
需要保持全大写的缩写字典 可自行修改
View Source
var DefaultConverter = NewConverter(true, false)
View Source
var ErrInvalidDelim = errors.New("req: invalid delim")
View Source
var ErrInvalidToken = errors.New("req: invalid token")
View Source
var Void = struct{}{}
Functions ¶
func JavaScriptReplace ¶
func JavaScriptReplace(s string, pattern *regexp.Regexp, fn func(match string, submatch ...string) string) string
仿 JavaScript 的字符串替换函数
func ParseNumberType ¶
解析 array 中类型名
因为 json 的 array 里面允许不同类型的值,所以需要一个函数来判断到底用哪个
如果都是数字就取范围最大的那个,如果有非数字类型则用 any
Types ¶
Click to show internal directories.
Click to hide internal directories.