jmoiron/sqlx — pull request #93 by liaoliaopro (2014-10-16 12:11:35+00:00)
Title: Fix #92, add tagNameFunc to handle complicated tag value.

Fix #92, add an extra tagNameFunc to handle complicated tag value. eg. the following struct B have complicated tag values, we can set customized handler function to fetch correct tag values.

```go
// example struct B, have complicated tag value.
type B struct {
FieldName string `json:"field_name,omitempty"`
StrategyId string `protobuf:"bytes,1,opt,name=strategy_id" json:"strategy_id,omitempty"`
}

func HandleJson(tagName string, value string) string {
if strings.Contains(value, ",") {
return strings.Split(value, ",")[0]
} else {
return value
}
}

func HandleProtobuf(tagName string, value string) string {
...
}

// handle complicated json
db.Mapper = reflectx.NewMapperTagNameFunc("json", HandleJson)

// handle complicated protobuf
db.Mapper = reflectx.NewMapperTagNameFunc("protobuf", HandleProtobuf)
```