Replace godep with dep
This commit is contained in:
parent
1e7489927c
commit
bf5616c65b
14883 changed files with 3937406 additions and 361781 deletions
25
vendor/github.com/json-iterator/go/extra/privat_fields.go
generated
vendored
Normal file
25
vendor/github.com/json-iterator/go/extra/privat_fields.go
generated
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package extra
|
||||
|
||||
import (
|
||||
"github.com/json-iterator/go"
|
||||
"unicode"
|
||||
)
|
||||
|
||||
// SupportPrivateFields include private fields when encoding/decoding
|
||||
func SupportPrivateFields() {
|
||||
jsoniter.RegisterExtension(&privateFieldsExtension{})
|
||||
}
|
||||
|
||||
type privateFieldsExtension struct {
|
||||
jsoniter.DummyExtension
|
||||
}
|
||||
|
||||
func (extension *privateFieldsExtension) UpdateStructDescriptor(structDescriptor *jsoniter.StructDescriptor) {
|
||||
for _, binding := range structDescriptor.Fields {
|
||||
isPrivate := unicode.IsLower(rune(binding.Field.Name[0]))
|
||||
if isPrivate {
|
||||
binding.FromNames = []string{binding.Field.Name}
|
||||
binding.ToNames = []string{binding.Field.Name}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue