marshal

package module
v0.0.0-...-ad39fb3 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: MIT Imports: 3 Imported by: 0

README

marshal

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmptyContext = ParsingContext{}
View Source
var PrimitivesParser = &primitivesParser{}

Functions

func IsPrimitive

func IsPrimitive(kind reflect.Kind) bool

Types

type ArrayParser

type ArrayParser struct {
	// contains filtered or unexported fields
}

func NewArrayParser

func NewArrayParser(config *Config) *ArrayParser

func (*ArrayParser) Parse

func (parser *ArrayParser) Parse(from reflect.Value, into reflect.Value, ctx ParsingContext) error

type Config

type Config struct {
	TagName       string
	ValueResolver func(ctx ParsingContext) (reflect.Value, error)
}

type InterfaceParser

type InterfaceParser struct {
	// contains filtered or unexported fields
}

func NewInterfaceParser

func NewInterfaceParser(config *Config) *InterfaceParser

func (*InterfaceParser) Parse

func (parser *InterfaceParser) Parse(from reflect.Value, into reflect.Value, ctx ParsingContext) error

type MapParser

type MapParser struct {
	// contains filtered or unexported fields
}

func NewMapParser

func NewMapParser(config *Config) *MapParser

func (*MapParser) Parse

func (parser *MapParser) Parse(from reflect.Value, into reflect.Value, ctx ParsingContext) error

type Parser

type Parser interface {
	Parse(from reflect.Value, into reflect.Value, ctx ParsingContext) error
}

type ParsingContext

type ParsingContext struct {

	// Represents the key within the father that we're trying to parse right now.
	KeyInFather string

	// The entire "from" data in which the father was constructed.
	FromFather map[string]interface{}

	// The reflect.Value of the father.
	FatherVal reflect.Value
}

type PointerParser

type PointerParser struct {
	// contains filtered or unexported fields
}

func NewPointerParser

func NewPointerParser(config *Config) *PointerParser

func (*PointerParser) Parse

func (parser *PointerParser) Parse(from reflect.Value, into reflect.Value, ctx ParsingContext) error

handlePointer when the destination field is a pointer currently we support POINTERS TO STRUCTS only

Checking if the pointer is to nil, if so - creating a new empty struct and pointing to it. Then letting the structParser to handle the assignment into the struct.

type ResolverParser

type ResolverParser struct {
	// contains filtered or unexported fields
}

func NewResolverParser

func NewResolverParser(config *Config) *ResolverParser

func (*ResolverParser) Parse

func (parser *ResolverParser) Parse(from reflect.Value, into reflect.Value, ctx ParsingContext) error

type StructParser

type StructParser struct {
	// contains filtered or unexported fields
}

func NewStructParser

func NewStructParser(config *Config) *StructParser

func (*StructParser) Parse

func (parser *StructParser) Parse(from reflect.Value, into reflect.Value, ctx ParsingContext) error

type UnionTypeContainer

type UnionTypeContainer interface {
	ResolveType(ctx ParsingContext) (reflect.Value, error)
}

Jump to

Keyboard shortcuts

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