MCPcopy Create free account
hub / github.com/brimdata/super / parseTag

Function parseTag

pkg/unpack/tag.go:18–32  ·  view source on GitHub ↗
(which string, f reflect.StructField)

Source from the content-addressed store, hash-verified

16var ErrSkip = errors.New("unpack skip tag can only appear once")
17
18func parseTag(which string, f reflect.StructField) (string, bool, []string) {
19 tag, ok := f.Tag.Lookup(which)
20 if !ok {
21 return "", false, nil
22 }
23 if tag == "" {
24 return "", true, nil
25 }
26 elems := strings.Split(tag, tagSep)
27 var opts []string
28 if len(elems) > 1 {
29 opts = elems[1:]
30 }
31 return elems[0], true, opts
32}
33
34func jsonFieldName(f reflect.StructField) (string, bool) {
35 s, ok, _ := parseTag(tagJSON, f)

Callers 2

jsonFieldNameFunction · 0.85
structToUnpackRuleFunction · 0.85

Calls 2

SplitMethod · 0.80
LookupMethod · 0.65

Tested by

no test coverage detected