MCPcopy Create free account
hub / github.com/google/go-cloud / ParseStandardTag

Function ParseStandardTag

docstore/internal/fields/fields.go:484–494  ·  view source on GitHub ↗

ParseStandardTag extracts the sub-tag named by key, then parses it using the de facto standard format introduced in encoding/json: "-" means "ignore this tag", unless it has options (that is, is followed by a comma), in which case it is treated a name. " " provides an alternative name f

(key string, t reflect.StructTag)

Source from the content-addressed store, hash-verified

482//
483// The options are returned as a []string.
484func ParseStandardTag(key string, t reflect.StructTag) (name string, keep bool, options []string) {
485 s := t.Get(key)
486 parts := strings.Split(s, ",")
487 if parts[0] == "-" && len(parts) == 1 {
488 return "", false, nil
489 }
490 if len(parts) > 1 {
491 options = parts[1:]
492 }
493 return parts[0], true, options
494}

Callers 2

parseTagFunction · 0.92
jsonTagParserFunction · 0.85

Calls 1

GetMethod · 0.45

Tested by 1

jsonTagParserFunction · 0.68