serialization

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 8 Imported by: 1,389

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultParseNodeFactoryInstance = NewParseNodeFactoryRegistry()

DefaultParseNodeFactoryInstance is the default singleton instance of the registry to be used when registering new factories that should be available by default.

View Source
var DefaultSerializationWriterFactoryInstance = NewSerializationWriterFactoryRegistry()

DefaultSerializationWriterFactoryInstance is the default singleton instance of the registry to be used when registering new factories that should be available by default.

Functions

func MergeDeserializersForIntersectionWrapper added in v0.10.0

func MergeDeserializersForIntersectionWrapper(targets ...Parsable) (map[string]func(ParseNode) error, error)

MergeDeserializersForIntersectionWrapper merges the given fields deserializers for an intersection type into a single collection.

func Serialize added in v1.4.0

func Serialize(contentType string, model Parsable) ([]byte, error)

Serialize serializes the given model into a byte array.

func SerializeCollection added in v1.4.0

func SerializeCollection(contentType string, models []Parsable) ([]byte, error)

SerializeCollection serializes the given models into a byte array.

func SerializeCollectionToJson added in v1.4.0

func SerializeCollectionToJson(models []Parsable) ([]byte, error)

SerializeCollectionToJson serializes the given models to JSON

func SerializeToJson added in v1.4.0

func SerializeToJson(model Parsable) ([]byte, error)

SerializeToJson serializes the given model to JSON

Types

type AdditionalDataHolder

type AdditionalDataHolder interface {
	// GetAdditionalData returns additional data of the object that doesn't belong to a field.
	GetAdditionalData() map[string]interface{}
	// SetAdditionalData sets additional data of the object that doesn't belong to a field.
	SetAdditionalData(value map[string]interface{})
}

AdditionalDataHolder defines a contract for models that can hold additional data besides the described properties.

type ComposedTypeWrapper added in v1.1.0

type ComposedTypeWrapper interface {
	// GetIsComposedType returns true if the type is composed, false otherwise.
	GetIsComposedType() bool
}

ComposedTypeWrapper defines a contract for models that are wrappers for composed types.

type DateOnly

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

DateOnly is a struct that represents a date only from a date time (Time).

func NewDateOnly

func NewDateOnly(t time.Time) *DateOnly

NewDateOnly creates a new DateOnly from a time.Time.

func ParseDateOnly

func ParseDateOnly(s string) (*DateOnly, error)

ParseDateOnly parses a string into a DateOnly following the RFC3339 standard.

func (DateOnly) String

func (t DateOnly) String() string

String returns the date only as a string following the RFC3339 standard.

type EnumFactory added in v0.8.0

type EnumFactory func(string) (interface{}, error)

EnumFactory is a factory for creating Enum.

type ISODuration

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

ISODuration represents an ISO 8601 duration

func FromDuration

func FromDuration(d time.Duration) *ISODuration

FromDuration returns an ISODuration from a time.Duration.

func NewDuration

func NewDuration(years int, weeks int, days int, hours int, minutes int, seconds int, milliSeconds int) *ISODuration

NewISODuration creates a new ISODuration from primitive values.

func ParseISODuration

func ParseISODuration(s string) (*ISODuration, error)

ParseISODuration parses a string into an ISODuration following the ISO 8601 standard.

func (ISODuration) GetDays

func (i ISODuration) GetDays() int

GetDays returns the number of days.

func (ISODuration) GetHours

func (i ISODuration) GetHours() int

GetHours returns the number of hours.

func (ISODuration) GetMilliSeconds

func (i ISODuration) GetMilliSeconds() int

GetMilliSeconds returns the number of milliseconds.

func (ISODuration) GetMinutes

func (i ISODuration) GetMinutes() int

GetMinutes returns the number of minutes.

func (ISODuration) GetSeconds

func (i ISODuration) GetSeconds() int

GetSeconds returns the number of seconds.

func (ISODuration) GetWeeks

func (i ISODuration) GetWeeks() int

GetWeeks returns the number of weeks.

func (ISODuration) GetYears

func (i ISODuration) GetYears() int

GetYears returns the number of years.

func (ISODuration) SetDays

func (i ISODuration) SetDays(days int)

SetDays sets the number of days.

func (ISODuration) SetHours

func (i ISODuration) SetHours(hours int)

SetHours sets the number of hours.

func (ISODuration) SetMilliSeconds

func (i ISODuration) SetMilliSeconds(milliSeconds int)

SetMilliSeconds sets the number of milliseconds.

func (ISODuration) SetMinutes

func (i ISODuration) SetMinutes(minutes int)

SetMinutes sets the number of minutes.

func (ISODuration) SetSeconds

func (i ISODuration) SetSeconds(seconds int)

SetSeconds sets the number of seconds.

func (ISODuration) SetWeeks

func (i ISODuration) SetWeeks(weeks int)

SetWeeks sets the number of weeks.

func (ISODuration) SetYears

func (i ISODuration) SetYears(years int)

SetYears sets the number of years.

func (ISODuration) String

func (i ISODuration) String() string

String returns the ISO 8601 representation of the duration.

func (ISODuration) ToDuration

func (d ISODuration) ToDuration() (time.Duration, error)

ToDuration returns the time.Duration representation of the ISODuration.

type NodeParser added in v0.11.0

type NodeParser func(ParseNode) error

NodeParser defines serializer's parse executor

type Parsable

type Parsable interface {
	// Serialize writes the objects properties to the current writer.
	Serialize(writer SerializationWriter) error
	// GetFieldDeserializers returns the deserialization information for this object.
	GetFieldDeserializers() map[string]func(ParseNode) error
}

Parsable defines a serializable model object.

func CreateUntypedNodeFromDiscriminatorValue added in v1.6.0

func CreateUntypedNodeFromDiscriminatorValue(parseNode ParseNode) (Parsable, error)

CreateUntypedNodeFromDiscriminatorValue a new untyped node and from a parse node.

func Deserialize added in v1.4.0

func Deserialize(contentType string, content []byte, parsableFactory ParsableFactory) (Parsable, error)

Deserialize deserializes the given byte array into a model.

func DeserializeCollection added in v1.4.0

func DeserializeCollection(contentType string, content []byte, parsableFactory ParsableFactory) ([]Parsable, error)

DeserializeCollection deserializes the given byte array into a collection of models.

func DeserializeCollectionFromJson added in v1.4.0

func DeserializeCollectionFromJson(content []byte, parsableFactory ParsableFactory) ([]Parsable, error)

DeserializeCollectionFromJson deserializes the given JSON to a collection of models

func DeserializeFromJson added in v1.4.0

func DeserializeFromJson(content []byte, parsableFactory ParsableFactory) (Parsable, error)

DeserializeFromJson deserializes the given JSON to a model

type ParsableAction added in v0.17.0

type ParsableAction func(Parsable) error

ParsableAction Encapsulates a method with a single Parsable parameter

type ParsableFactory

type ParsableFactory func(parseNode ParseNode) (Parsable, error)

ParsableFactory is a factory for creating Parsable.

type ParsableWriter added in v0.17.0

type ParsableWriter func(Parsable, SerializationWriter) error

ParsableWriter Encapsulates a method that receives a Parsable and SerializationWriter as parameters

type ParseNode

type ParseNode interface {
	// GetChildNode returns a new parse node for the given identifier.
	GetChildNode(index string) (ParseNode, error)
	// GetCollectionOfObjectValues returns the collection of Parsable values from the node.
	GetCollectionOfObjectValues(ctor ParsableFactory) ([]Parsable, error)
	// GetCollectionOfPrimitiveValues returns the collection of primitive values from the node.
	GetCollectionOfPrimitiveValues(targetType string) ([]interface{}, error)
	// GetCollectionOfEnumValues returns the collection of Enum values from the node.
	GetCollectionOfEnumValues(parser EnumFactory) ([]interface{}, error)
	// GetObjectValue returns the Parsable value from the node.
	GetObjectValue(ctor ParsableFactory) (Parsable, error)
	// GetStringValue returns a String value from the nodes.
	GetStringValue() (*string, error)
	// GetBoolValue returns a Bool value from the nodes.
	GetBoolValue() (*bool, error)
	// GetInt8Value returns a int8 value from the nodes.
	GetInt8Value() (*int8, error)
	// GetByteValue returns a Byte value from the nodes.
	GetByteValue() (*byte, error)
	// GetFloat32Value returns a Float32 value from the nodes.
	GetFloat32Value() (*float32, error)
	// GetFloat64Value returns a Float64 value from the nodes.
	GetFloat64Value() (*float64, error)
	// GetInt32Value returns a Int32 value from the nodes.
	GetInt32Value() (*int32, error)
	// GetInt64Value returns a Int64 value from the nodes.
	GetInt64Value() (*int64, error)
	// GetTimeValue returns a Time value from the nodes.
	GetTimeValue() (*time.Time, error)
	// GetISODurationValue returns a ISODuration value from the nodes.
	GetISODurationValue() (*ISODuration, error)
	// GetTimeOnlyValue returns a TimeOnly value from the nodes.
	GetTimeOnlyValue() (*TimeOnly, error)
	// GetDateOnlyValue returns a DateOnly value from the nodes.
	GetDateOnlyValue() (*DateOnly, error)
	// GetUUIDValue returns a UUID value from the nodes.
	GetUUIDValue() (*uuid.UUID, error)
	// GetEnumValue returns a Enum value from the nodes.
	GetEnumValue(parser EnumFactory) (interface{}, error)
	// GetByteArrayValue returns a ByteArray value from the nodes.
	GetByteArrayValue() ([]byte, error)
	// GetRawValue returns the values of the node as an interface of any type.
	GetRawValue() (interface{}, error)
	// GetOnBeforeAssignFieldValues returns a callback invoked before the node is deserialized.
	GetOnBeforeAssignFieldValues() ParsableAction
	// SetOnBeforeAssignFieldValues sets a callback invoked before the node is deserialized.
	SetOnBeforeAssignFieldValues(ParsableAction) error
	// GetOnAfterAssignFieldValues returns a callback invoked after the node is deserialized.
	GetOnAfterAssignFieldValues() ParsableAction
	// SetOnAfterAssignFieldValues sets a callback invoked after the node is deserialized.
	SetOnAfterAssignFieldValues(ParsableAction) error
}

ParseNode Interface for a deserialization node in a parse tree. This interface provides an abstraction layer over serialization formats, libraries and implementations.

type ParseNodeFactory

type ParseNodeFactory interface {
	// GetValidContentType returns the content type this factory's parse nodes can deserialize.
	GetValidContentType() (string, error)
	// GetRootParseNode return a new ParseNode instance that is the root of the content
	GetRootParseNode(contentType string, content []byte) (ParseNode, error)
}

ParseNodeFactory defines the contract for a factory that creates new ParseNode.

type ParseNodeFactoryRegistry

type ParseNodeFactoryRegistry struct {

	// ContentTypeAssociatedFactories maps content types onto the relevant factory.
	//
	// When interacting with this field, please make use of Lock and Unlock methods to ensure thread safety.
	ContentTypeAssociatedFactories map[string]ParseNodeFactory
	// contains filtered or unexported fields
}

ParseNodeFactoryRegistry holds a list of all the registered factories for the various types of nodes.

func NewParseNodeFactoryRegistry added in v0.19.1

func NewParseNodeFactoryRegistry() *ParseNodeFactoryRegistry

func (*ParseNodeFactoryRegistry) GetRootParseNode

func (m *ParseNodeFactoryRegistry) GetRootParseNode(contentType string, content []byte) (ParseNode, error)

GetRootParseNode returns a new ParseNode instance that is the root of the content

func (*ParseNodeFactoryRegistry) GetValidContentType

func (m *ParseNodeFactoryRegistry) GetValidContentType() (string, error)

GetValidContentType returns the valid content type for the ParseNodeFactoryRegistry

func (*ParseNodeFactoryRegistry) Lock added in v0.19.1

func (m *ParseNodeFactoryRegistry) Lock()

func (*ParseNodeFactoryRegistry) Unlock added in v0.19.1

func (m *ParseNodeFactoryRegistry) Unlock()

type ParseNodeProxyFactory added in v0.17.0

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

func NewParseNodeProxyFactory added in v0.17.0

func NewParseNodeProxyFactory(
	factory ParseNodeFactory,
	onBeforeAction ParsableAction,
	onAfterAction ParsableAction,
) *ParseNodeProxyFactory

NewParseNodeProxyFactory constructs a new instance of ParseNodeProxyFactory

func (*ParseNodeProxyFactory) GetRootParseNode added in v0.17.0

func (p *ParseNodeProxyFactory) GetRootParseNode(contentType string, content []byte) (ParseNode, error)

func (*ParseNodeProxyFactory) GetValidContentType added in v0.17.0

func (p *ParseNodeProxyFactory) GetValidContentType() (string, error)

type SerializationWriter

type SerializationWriter interface {
	i.Closer
	// WriteStringValue writes a String value to underlying the byte array.
	WriteStringValue(key string, value *string) error
	// WriteBoolValue writes a Bool value to underlying the byte array.
	WriteBoolValue(key string, value *bool) error
	// WriteInt8Value writes a int8 value to underlying the byte array.
	WriteInt8Value(key string, value *int8) error
	// WriteByteValue writes a Byte value to underlying the byte array.
	WriteByteValue(key string, value *byte) error
	// WriteInt32Value writes a Int32 value to underlying the byte array.
	WriteInt32Value(key string, value *int32) error
	// WriteInt64Value writes a Int64 value to underlying the byte array.
	WriteInt64Value(key string, value *int64) error
	// WriteFloat32Value writes a Float32 value to underlying the byte array.
	WriteFloat32Value(key string, value *float32) error
	// WriteFloat64Value writes a Float64 value to underlying the byte array.
	WriteFloat64Value(key string, value *float64) error
	// WriteByteArrayValue writes a ByteArray value to underlying the byte array.
	WriteByteArrayValue(key string, value []byte) error
	// WriteTimeValue writes a Time value to underlying the byte array.
	WriteTimeValue(key string, value *time.Time) error
	// WriteTimeOnlyValue writes the time part of a Time value to underlying the byte array.
	WriteTimeOnlyValue(key string, value *TimeOnly) error
	// WriteDateOnlyValue writes the date part of a Time value to underlying the byte array.
	WriteDateOnlyValue(key string, value *DateOnly) error
	// WriteISODurationValue writes a ISODuration value to underlying the byte array.
	WriteISODurationValue(key string, value *ISODuration) error
	// WriteUUIDValue writes a UUID value to underlying the byte array.
	WriteUUIDValue(key string, value *uuid.UUID) error
	// WriteObjectValue writes a Parsable value to underlying the byte array.
	WriteObjectValue(key string, item Parsable, additionalValuesToMerge ...Parsable) error
	// WriteCollectionOfObjectValues writes a collection of Parsable values to underlying the byte array.
	WriteCollectionOfObjectValues(key string, collection []Parsable) error
	// WriteCollectionOfStringValues writes a collection of String values to underlying the byte array.
	WriteCollectionOfStringValues(key string, collection []string) error
	// WriteCollectionOfBoolValues writes a collection of Bool values to underlying the byte array.
	WriteCollectionOfBoolValues(key string, collection []bool) error
	// WriteCollectionOfInt8Values writes a collection of Int8 values to underlying the byte array.
	WriteCollectionOfInt8Values(key string, collection []int8) error
	// WriteCollectionOfByteValues writes a collection of Byte values to underlying the byte array.
	WriteCollectionOfByteValues(key string, collection []byte) error
	// WriteCollectionOfInt32Values writes a collection of Int32 values to underlying the byte array.
	WriteCollectionOfInt32Values(key string, collection []int32) error
	// WriteCollectionOfInt64Values writes a collection of Int64 values to underlying the byte array.
	WriteCollectionOfInt64Values(key string, collection []int64) error
	// WriteCollectionOfFloat32Values writes a collection of Float32 values to underlying the byte array.
	WriteCollectionOfFloat32Values(key string, collection []float32) error
	// WriteCollectionOfFloat64Values writes a collection of Float64 values to underlying the byte array.
	WriteCollectionOfFloat64Values(key string, collection []float64) error
	// WriteCollectionOfTimeValues writes a collection of Time values to underlying the byte array.
	WriteCollectionOfTimeValues(key string, collection []time.Time) error
	// WriteCollectionOfISODurationValues writes a collection of ISODuration values to underlying the byte array.
	WriteCollectionOfISODurationValues(key string, collection []ISODuration) error
	// WriteCollectionOfDateOnlyValues writes a collection of DateOnly values to underlying the byte array.
	WriteCollectionOfDateOnlyValues(key string, collection []DateOnly) error
	// WriteCollectionOfTimeOnlyValues writes a collection of TimeOnly values to underlying the byte array.
	WriteCollectionOfTimeOnlyValues(key string, collection []TimeOnly) error
	// WriteCollectionOfUUIDValues writes a collection of UUID values to underlying the byte array.
	WriteCollectionOfUUIDValues(key string, collection []uuid.UUID) error
	// GetSerializedContent returns the resulting byte array from the serialization writer.
	GetSerializedContent() ([]byte, error)
	// WriteNullValue writes a null value for the specified key.
	WriteNullValue(key string) error
	// WriteAdditionalData writes additional data to underlying the byte array.
	WriteAdditionalData(value map[string]interface{}) error
	// WriteAnyValue an object of unknown type as a json value
	WriteAnyValue(key string, value interface{}) error
	// GetOnBeforeSerialization returns a callback invoked before the serialization process starts.
	GetOnBeforeSerialization() ParsableAction
	// SetOnBeforeSerialization sets a callback invoked before the serialization process starts.
	SetOnBeforeSerialization(ParsableAction) error
	// GetOnAfterObjectSerialization returns a callback invoked after the serialization process completes.
	GetOnAfterObjectSerialization() ParsableAction
	// SetOnAfterObjectSerialization sets a callback invoked after the serialization process completes.
	SetOnAfterObjectSerialization(ParsableAction) error
	// GetOnStartObjectSerialization returns a callback invoked right after the serialization process starts.
	GetOnStartObjectSerialization() ParsableWriter
	// SetOnStartObjectSerialization sets a callback invoked right after the serialization process starts.
	SetOnStartObjectSerialization(ParsableWriter) error
}

SerializationWriter defines an interface for serialization of models to a byte array.

type SerializationWriterFactory

type SerializationWriterFactory interface {
	// GetValidContentType returns the valid content type for the SerializationWriterFactoryRegistry
	GetValidContentType() (string, error)
	// GetSerializationWriter returns the relevant SerializationWriter instance for the given content type
	GetSerializationWriter(contentType string) (SerializationWriter, error)
}

SerializationWriterFactory defines the contract for a factory that creates SerializationWriter instances.

type SerializationWriterFactoryRegistry

type SerializationWriterFactoryRegistry struct {

	// ContentTypeAssociatedFactories list of factories that are registered by content type.
	//
	// When interacting with this field, please make use of Lock and Unlock methods to ensure thread safety.
	ContentTypeAssociatedFactories map[string]SerializationWriterFactory
	// contains filtered or unexported fields
}

SerializationWriterFactoryRegistry is a factory holds a list of all the registered factories for the various types of nodes.

func NewSerializationWriterFactoryRegistry added in v0.19.1

func NewSerializationWriterFactoryRegistry() *SerializationWriterFactoryRegistry

func (*SerializationWriterFactoryRegistry) GetSerializationWriter

func (m *SerializationWriterFactoryRegistry) GetSerializationWriter(contentType string) (SerializationWriter, error)

GetSerializationWriter returns the relevant SerializationWriter instance for the given content type

func (*SerializationWriterFactoryRegistry) GetValidContentType

func (m *SerializationWriterFactoryRegistry) GetValidContentType() (string, error)

GetValidContentType returns the valid content type for the SerializationWriterFactoryRegistry

func (*SerializationWriterFactoryRegistry) Lock added in v0.19.1

func (*SerializationWriterFactoryRegistry) Unlock added in v0.19.1

type SerializationWriterProxyFactory added in v0.17.0

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

SerializationWriterProxyFactory factory that allows the composition of before and after callbacks on existing factories.

func NewSerializationWriterProxyFactory added in v0.17.0

func NewSerializationWriterProxyFactory(
	factory SerializationWriterFactory,
	onBeforeAction ParsableAction,
	onAfterAction ParsableAction,
	onSerializationStart ParsableWriter,
) *SerializationWriterProxyFactory

NewSerializationWriterProxyFactory constructs a new instance of SerializationWriterProxyFactory

func (*SerializationWriterProxyFactory) GetSerializationWriter added in v0.17.0

func (s *SerializationWriterProxyFactory) GetSerializationWriter(contentType string) (SerializationWriter, error)

func (*SerializationWriterProxyFactory) GetValidContentType added in v0.17.0

func (s *SerializationWriterProxyFactory) GetValidContentType() (string, error)

type TimeOnly

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

TimeOnly is represents the time part of a date time (time) value.

func NewTimeOnly

func NewTimeOnly(t time.Time) *TimeOnly

NewTimeOnly creates a new TimeOnly from a time.Time.

func ParseTimeOnly

func ParseTimeOnly(s string) (*TimeOnly, error)

ParseTimeOnly parses a string into a TimeOnly following the RFC3339 standard.

func (TimeOnly) String

func (t TimeOnly) String() string

String returns the time only as a string following the RFC3339 standard.

type UntypedArray added in v1.6.0

type UntypedArray struct {
	UntypedNode
}

UntypedArray defines an untyped collection.

func NewUntypedArray added in v1.6.0

func NewUntypedArray(collection []UntypedNodeable) *UntypedArray

NewUntypedArray creates a new UntypedArray object.

func (*UntypedArray) GetValue added in v1.6.0

func (un *UntypedArray) GetValue() []UntypedNodeable

GetValue returns a collection of UntypedNode.

type UntypedBoolean added in v1.6.0

type UntypedBoolean struct {
	UntypedNode
}

UntypedBoolean defines an untyped boolean object.

func NewUntypedBoolean added in v1.6.0

func NewUntypedBoolean(boolValue bool) *UntypedBoolean

NewUntypedBoolean creates a new UntypedBoolean object.

func (*UntypedBoolean) GetValue added in v1.6.0

func (un *UntypedBoolean) GetValue() *bool

GetValue returns the bool value.

type UntypedDouble added in v1.6.0

type UntypedDouble struct {
	UntypedNode
}

UntypedDouble defines an untyped float64 object.

func NewUntypedDouble added in v1.6.0

func NewUntypedDouble(float64Value float64) *UntypedDouble

NewUntypedDouble creates a new UntypedDouble object.

func (*UntypedDouble) GetValue added in v1.6.0

func (un *UntypedDouble) GetValue() *float64

GetValue returns the float64 value.

type UntypedFloat added in v1.6.0

type UntypedFloat struct {
	UntypedNode
}

UntypedFloat defines an untyped float32 value.

func NewUntypedFloat added in v1.6.0

func NewUntypedFloat(float32Value float32) *UntypedFloat

NewUntypedFloat creates a new UntypedFloat object.

func (*UntypedFloat) GetValue added in v1.6.0

func (un *UntypedFloat) GetValue() *float32

GetValue returns the float32 value.

type UntypedInteger added in v1.6.0

type UntypedInteger struct {
	UntypedNode
}

UntypedInteger defines an untyped integer value.

func NewUntypedInteger added in v1.6.0

func NewUntypedInteger(int32Value int32) *UntypedInteger

NewUntypedInteger creates a new UntypedInteger object.

func (*UntypedInteger) GetValue added in v1.6.0

func (un *UntypedInteger) GetValue() *int32

GetValue returns the int32 value.

type UntypedLong added in v1.6.0

type UntypedLong struct {
	UntypedNode
}

UntypedLong defines an untyped int64 value.

func NewUntypedLong added in v1.6.0

func NewUntypedLong(int64Value int64) *UntypedLong

NewUntypedLong creates a new UntypedLong object.

func (*UntypedLong) GetValue added in v1.6.0

func (un *UntypedLong) GetValue() *int64

GetValue returns the int64 value.

type UntypedNode added in v1.6.0

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

Base model for an untyped object.

func NewUntypedNode added in v1.6.0

func NewUntypedNode(value any) *UntypedNode

NewUntypedNode instantiates a new untyped node and sets the default values.

func (*UntypedNode) GetFieldDeserializers added in v1.6.0

func (m *UntypedNode) GetFieldDeserializers() map[string]func(ParseNode) error

GetFieldDeserializers returns the deserialization information for this object.

func (*UntypedNode) GetIsUntypedNode added in v1.6.0

func (m *UntypedNode) GetIsUntypedNode() bool

GetIsUntypedNode returns true if the node is untyped, false otherwise.

func (*UntypedNode) GetValue added in v1.6.0

func (m *UntypedNode) GetValue() any

GetValue gets the underlying object value.

func (*UntypedNode) Serialize added in v1.6.0

func (m *UntypedNode) Serialize(writer SerializationWriter) error

Serialize writes the objects properties to the current writer.

type UntypedNodeable added in v1.6.0

type UntypedNodeable interface {
	Parsable
	GetIsUntypedNode() bool
}

type UntypedNull added in v1.6.0

type UntypedNull struct {
	UntypedNode
}

UntypedNull defines a untyped nil object.

func NewUntypedNull added in v1.6.0

func NewUntypedNull() *UntypedNull

NewUntypedString creates a new UntypedNull object.

func (*UntypedNull) GetValue added in v1.6.0

func (un *UntypedNull) GetValue() any

GetValue returns a nil value.

type UntypedObject added in v1.6.0

type UntypedObject struct {
	UntypedNode
}

UntypedObject defines an untyped object.

func NewUntypedObject added in v1.6.0

func NewUntypedObject(properties map[string]UntypedNodeable) *UntypedObject

NewUntypedObject creates a new UntypedObject object.

func (*UntypedObject) GetValue added in v1.6.0

func (un *UntypedObject) GetValue() map[string]UntypedNodeable

GetValue gets a map of the properties of the object.

type UntypedString added in v1.6.0

type UntypedString struct {
	UntypedNode
}

UntypedString defines an untyped string object.

func NewUntypedString added in v1.6.0

func NewUntypedString(stringValue string) *UntypedString

NewUntypedString creates a new UntypedString object.

func (*UntypedString) GetValue added in v1.6.0

func (un *UntypedString) GetValue() *string

GetValue returns the string object.

Jump to

Keyboard shortcuts

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