MCPcopy
hub / github.com/jmoiron/sqlx / NewMapperTagFunc

Function NewMapperTagFunc

reflectx/reflect.go:82–89  ·  view source on GitHub ↗

NewMapperTagFunc returns a new mapper which contains a mapper for field names AND a mapper for tag values. This is useful for tags like json which can have values like "name,omitempty".

(tagName string, mapFunc, tagMapFunc func(string) string)

Source from the content-addressed store, hash-verified

80// AND a mapper for tag values. This is useful for tags like json which can
81// have values like "name,omitempty".
82func NewMapperTagFunc(tagName string, mapFunc, tagMapFunc func(string) string) *Mapper {
83 return &Mapper{
84 cache: make(map[reflect.Type]*StructMap),
85 tagName: tagName,
86 mapFunc: mapFunc,
87 tagMapFunc: tagMapFunc,
88 }
89}
90
91// NewMapperFunc returns a new mapper which optionally obeys a field tag and
92// a struct field name mapper func given by f. Tags will take precedence, but

Callers 4

TestInlineStructFunction · 0.85
TestPtrFieldsFunction · 0.85
TestNamedPtrFieldsFunction · 0.85
TestTagNameMappingFunction · 0.85

Calls

no outgoing calls

Tested by 4

TestInlineStructFunction · 0.68
TestPtrFieldsFunction · 0.68
TestNamedPtrFieldsFunction · 0.68
TestTagNameMappingFunction · 0.68