Source File
struct_field.go
Belonging Package
github.com/goccy/go-json/internal/runtime
package runtimeimport ()func getTag( reflect.StructField) string {return .Tag.Get("json")}func ( reflect.StructField) bool {if .PkgPath != "" {if .Anonymous {:= .Typeif .Kind() == reflect.Ptr {= .Elem()}if .Kind() != reflect.Struct {return true}} else {// private fieldreturn true}}:= getTag()return == "-"}type StructTag struct {Key stringIsTaggedKey boolIsOmitEmpty boolIsString boolField reflect.StructField}type StructTags []*StructTagfunc ( StructTags) ( string) bool {for , := range {if .Key == {return true}}return false}func isValidTag( string) bool {if == "" {return false}for , := range {switch {case strings.ContainsRune("!#$%&()*+-./:<=>?@[]^_{|}~ ", ):// Backslash and quote chars are reserved, but// otherwise any punctuation chars are allowed// in a tag name.case !unicode.IsLetter() && !unicode.IsDigit():return false}}return true}func ( reflect.StructField) *StructTag {:= .Name:= getTag():= &StructTag{Field: }:= strings.Split(, ",")if len() > 0 {if [0] != "" && isValidTag([0]) {= [0].IsTaggedKey = true}}.Key =if len() > 1 {for , := range [1:] {switch {case "omitempty":.IsOmitEmpty = truecase "string":.IsString = true}}}return}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |