structtags

package
v0.0.0-...-2c5f5e2 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(structObj interface{}, tagName string, defResults ...ParsedTag) (map[FieldName]ParsedTag, error)

解析结构的中所有字段的某种tag exp. `tagName:"valWithoutKey,a:1,b:2,c:3"` => map[string][string]string{"id":map[string]string{"":"valWithoutKey","a":"1","b":"2","c":"3"}} 如果tag不存在,不会填充 defResult 特殊值,key为空字符串的值,只能有一个, 多个的话,后面的覆盖前面的

Types

type FieldName

type FieldName = string

type ParsedTag

type ParsedTag = map[string]string

map[tag fieldName][tag fieldValue]

func ParseString

func ParseString(tagStr string, defResults ...ParsedTag) ParsedTag

type TagName

type TagName = string

Jump to

Keyboard shortcuts

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