decoder

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFieldValue

func GetFieldValue(reqValue reflect.Value, parentIndex []int) reflect.Value

func GetNonNilReferenceValue

func GetNonNilReferenceValue(v reflect.Value) (reflect.Value, int)

func ReferenceValue

func ReferenceValue(v reflect.Value, ptrDepth int) reflect.Value

ReferenceValue convert T to *T, the ptrDepth is the count of '*'.

Types

type CustomizeDecodeFunc

type CustomizeDecodeFunc func(req *protocol.Request, params param.Params, text string) (reflect.Value, error)

type DecodeConfig

type DecodeConfig struct {
	LooseZeroMode                      bool
	DisableDefaultTag                  bool
	DisableStructFieldResolve          bool
	EnableDecoderUseNumber             bool
	EnableDecoderDisallowUnknownFields bool
	ValidateTag                        string
	TypeUnmarshalFuncs                 map[reflect.Type]CustomizeDecodeFunc
}

type Decoder

type Decoder func(req *protocol.Request, params param.Params, rv reflect.Value) error

func GetReqDecoder

func GetReqDecoder(rt reflect.Type, byTag string, config *DecodeConfig) (Decoder, bool, error)

type TagInfo

type TagInfo struct {
	Key         string
	Value       string
	JSONName    string
	Required    bool
	Skip        bool
	Default     string
	Options     []string
	Getter      getter
	SliceGetter sliceGetter
}

type TextDecoder

type TextDecoder interface {
	UnmarshalString(s string, fieldValue reflect.Value, looseZeroMode bool) error
}

func SelectTextDecoder

func SelectTextDecoder(rt reflect.Type) (TextDecoder, error)

Jump to

Keyboard shortcuts

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