Documentation
¶
Overview ¶
Package jsonname is a provider of json property names from go properties.
Index ¶
- Variables
- type NameProvider
- func (n *NameProvider) GetGoName(subject interface{}, name string) (string, bool)
- func (n *NameProvider) GetGoNameForType(tpe reflect.Type, name string) (string, bool)
- func (n *NameProvider) GetJSONName(subject interface{}, name string) (string, bool)
- func (n *NameProvider) GetJSONNameForType(tpe reflect.Type, name string) (string, bool)
- func (n *NameProvider) GetJSONNames(subject interface{}) []string
Constants ¶
This section is empty.
Variables ¶
var DefaultJSONNameProvider = NewNameProvider()
DefaultJSONNameProvider is the default cache for types.
Functions ¶
This section is empty.
Types ¶
type NameProvider ¶
type NameProvider struct {
// contains filtered or unexported fields
}
NameProvider represents an object capable of translating from go property names to json property names.
This type is thread-safe.
See github.com/go-openapi/jsonpointer.Pointer for an example.
func NewNameProvider ¶
func NewNameProvider() *NameProvider
NewNameProvider creates a new name provider
func (*NameProvider) GetGoName ¶
func (n *NameProvider) GetGoName(subject interface{}, name string) (string, bool)
GetGoName gets the go name for a json property name
func (*NameProvider) GetGoNameForType ¶
GetGoNameForType gets the go name for a given type for a json property name
func (*NameProvider) GetJSONName ¶
func (n *NameProvider) GetJSONName(subject interface{}, name string) (string, bool)
GetJSONName gets the json name for a go property name
func (*NameProvider) GetJSONNameForType ¶
GetJSONNameForType gets the json name for a go property name on a given type
func (*NameProvider) GetJSONNames ¶
func (n *NameProvider) GetJSONNames(subject interface{}) []string
GetJSONNames gets all the json property names for a type