godynstruct

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2020 License: GPL-3.0 Imports: 7 Imported by: 2

README

go-dyn-struct

Dynamic struct for go with others filed

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DynMarshalBSON

func DynMarshalBSON(_struct reflect.Value, extraFields map[string]interface{}, extraFieldsName string) ([]byte, error)

DynMarshalBSON return the BSON encoding of the dynamic struct _struct _struct contains the reflect.Value of the struct extraFields is the map that contains the extra fields extraFieldsName is the name of the field in the struct that contains the extra fields

func DynMarshalJSON

func DynMarshalJSON(_struct reflect.Value, extraFields map[string]interface{}, extraFieldsName string) ([]byte, error)

DynMarshalJSON return the JSON encoding of the dynamic struct _struct _struct contains the reflect.Value of the struct extraFields is the map that contains the extra fields extraFieldsName is the name of the field in the struct that contains the extra fields

func DynUnmarshalBSON

func DynUnmarshalBSON(data []byte, ptrStruct reflect.Value, extraFieldsPtr *map[string]interface{}, extraFieldsName string) error

DynUnmarshalBSON parses the BSON encoded data and store the result into ptrStruct. The fields that aren't part of the struct are set inside extraFieldsPtr data contains the BSON encoded rappresentation of the data ptrStruct contains a reflect.Value pointer to the struct extraFieldsPtr is the pointer to the extraFields map

func DynUnmarshalJSON

func DynUnmarshalJSON(data []byte, ptrStruct reflect.Value, extraFieldsPtr *map[string]interface{}, extraFieldsName string) error

DynUnmarshalJSON parses the JSON encoded data and store the result into ptrStruct. The fields that aren't part of the struct are set inside extraFieldsPtr data contains the JSON encoded rappresentation of the data ptrStruct contains a reflect.Value pointer to the struct extraFieldsPtr is the pointer to the extraFields map

Types

This section is empty.

Jump to

Keyboard shortcuts

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