shared

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dict

type Dict interface {
	Lookup(key string) (Value, bool)
	AsValue() Value
	Keys() []string
}

A dictionary.

We use this type instead of raw type conversions to decrease the risk of confusion whenever manipulating `any` and to allow us to work with cases in which we do not have direct access to a dictionary.

type Driver

type Driver interface {
	// Return true if we have a specific implementation of deserialization
	// for a given type, for instance, if that type implements a specific
	// deserialization interface.
	ShouldUnmarshal(reflect.Type) bool

	// Perform unmarshaling for a value.
	Unmarshal(any, *any) error

	// Wrap a basic value as a `Value`.
	WrapValue(any) Value
}

A driver for a specific type of deserialization.

type Parser added in v0.3.0

type Parser func(source string) (any, error)

A parser for strings into primitive values.

func LookupParser added in v0.3.0

func LookupParser(fieldType reflect.Type) *Parser

type UnmarshalDict added in v0.3.0

type UnmarshalDict interface {
	UnmarshalDict(Dict) error
}

A type that can be deserialized from a shared.Dict.

type Value

type Value interface {
	AsDict() (Dict, bool)
	AsSlice() ([]Value, bool)
	Interface() any
}

A value in a dictionary.

We use this type instead of raw type conversions to decrease the risk of confusion whenever manipulating `any` and to allow us to work with cases in which we do not have direct access to a dictionary.

Jump to

Keyboard shortcuts

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