jsonname

package module
v0.0.0-...-1b223d6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package jsonname is a provider of json property names from go properties.

Index

Constants

This section is empty.

Variables

View Source
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

func (n *NameProvider) GetGoNameForType(tpe reflect.Type, name string) (string, bool)

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

func (n *NameProvider) GetJSONNameForType(tpe reflect.Type, name string) (string, bool)

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL