Documentation ¶
Index ¶
- Variables
- func UpperCamelCase(str string) string
- type Node
- func (that *Node) Array(size int) *[]Node
- func (that *Node) At(val ...interface{}) *Node
- func (that *Node) Copy(other *Node, deepCopy bool) *Node
- func (that *Node) DebugPrint(prefix string)
- func (that *Node) DebugProspect(indentlevel int, indentchar string)
- func (that *Node) DelKey(key string) *Node
- func (that *Node) Get() interface{}
- func (that *Node) GetKeys() []interface{}
- func (that *Node) GetType() NodeType
- func (that *Node) Len() int
- func (that *Node) Map(key string) *Node
- func (that *Node) MarshalJSON() ([]byte, error)
- func (that *Node) MustGetBool() bool
- func (that *Node) MustGetFloat32() float32
- func (that *Node) MustGetFloat64() float64
- func (that *Node) MustGetInt() int
- func (that *Node) MustGetInt16() int16
- func (that *Node) MustGetInt32() int32
- func (that *Node) MustGetInt64() int64
- func (that *Node) MustGetInt8() int8
- func (that *Node) MustGetString() string
- func (that *Node) MustGetUint() uint
- func (that *Node) MustGetUint16() uint16
- func (that *Node) MustGetUint32() uint32
- func (that *Node) MustGetUint64() uint64
- func (that *Node) MustGetUint8() uint8
- func (that *Node) Print()
- func (that *Node) SetType(t NodeType) *Node
- func (that *Node) UnmarshalDontExpand(val bool, recurse bool) *Node
- func (that *Node) UnmarshalJSON(data []byte) error
- func (that *Node) Unset()
- func (that *Node) Val(val interface{})
- type NodeType
Constants ¶
This section is empty.
Variables ¶
var ErrorArrayNegativeValue = errors.New("jsongo negative index for array")
ErrorArrayNegativeValue error if you ask for a negative index in an array
var ErrorAtUnsupportedType = errors.New("jsongo Unsupported Type as At argument")
ErrorArrayNegativeValue error if you ask for a negative index in an array
var ErrorCopyType = errors.New("jsongo: Copy: This Node is not a TypeUndefined")
ErrorCopyType error if you try to call Copy on a Node that isnt a TypeUndefined
var ErrorDeleteKey = errors.New("jsongo: DelKey: This Node is not a TypeMap")
ErrorDeleteKey error if you try to call DelKey on a Node that isnt a TypeMap
var ErrorGetKeys = errors.New("jsongo: GetKeys: Node is not a TypeMap or TypeArray")
ErrorGetKeys error if you try to get the keys from a Node that isnt a TypeMap or a TypeArray
var ErrorKeyAlreadyExist = errors.New("jsongo key already exist")
ErrorKeyAlreadyExist error if a key already exist in current Node
var ErrorMultipleType = errors.New("jsongo this node is already set to a different NodeType")
ErrorMultipleType error if a Node already got a different type of value
var ErrorRetrieveUserValue = errors.New("jsongo Cannot retrieve node's value which is not of type value")
ErrorRetrieveUserValue error if you ask the value of a node that is not a value node
var ErrorTypeUnmarshaling = errors.New("jsongo Wrong type when Unmarshaling")
ErrorTypeUnmarshaling error if you try to unmarshal something in the wrong type
var ErrorUnknowType = errors.New("jsongo Unknow NodeType")
ErrorUnknowType error if you try to use an unknow NodeType
var ErrorValNotPointer = errors.New("jsongo: Val: arguments must be a pointer and not nil")
ErrorValNotPointer error if you try to use Val without a valid pointer
Functions ¶
func UpperCamelCase ¶
UpperCamelCase converts a string to it's upper camel case version.
Types ¶
type Node ¶ added in v1.1.0
type Node struct {
// contains filtered or unexported fields
}
Node Datastructure to build and maintain Nodes
func (*Node) Array ¶ added in v1.1.0
Array Turn this Node to a TypeArray and/or set the array size (reducing size will make you loose data)
func (*Node) At ¶ added in v1.1.0
At helps you move through your node by building them on the fly
val can be string or int only
strings are keys for TypeMap
ints are index in TypeArray (it will make array grow on the fly, so you should start to populate with the biggest index first)*
func (*Node) Copy ¶ added in v1.1.0
Copy Will set this node like the one in argument. this node must be of type TypeUndefined
if deepCopy is true we will copy all the children recursively else we will share the children
return the current Node
func (*Node) DebugPrint ¶ added in v1.1.0
DebugPrint Print a Node as json withindent
func (*Node) DebugProspect ¶ added in v1.1.0
DebugProspect Print all the data the we ve got on a node and all it s children
func (*Node) Get ¶ added in v1.1.0
func (that *Node) Get() interface{}
Get Return value of a TypeValue as interface{}
func (*Node) GetKeys ¶ added in v1.1.0
func (that *Node) GetKeys() []interface{}
GetKeys Return a slice interface that represent the keys to use with the At fonction (Works only on TypeMap and TypeArray)
func (*Node) Len ¶ added in v1.1.0
Len Return the length of the current Node
if TypeUndefined return 0
if TypeValue return 1
if TypeArray return the size of the array
if TypeMap return the size of the map
func (*Node) Map ¶ added in v1.1.0
Map Turn this Node to a TypeMap and/or Create a new element for key if necessary and return it
func (*Node) MarshalJSON ¶ added in v1.1.0
MarshalJSON Make Node a Marshaler Interface compatible
func (*Node) MustGetBool ¶ added in v1.1.0
MustGetBool Return value of a TypeValue as bool will panic if cant convert the internal value or if the node is not a TypeValue
func (*Node) MustGetFloat32 ¶ added in v1.1.0
MustGetFloat32 Return value of a TypeValue as float32 will panic if cant convert the internal value or if the node is not a TypeValue
func (*Node) MustGetFloat64 ¶ added in v1.1.0
MustGetFloat64 Return value of a TypeValue as float64 will panic if cant convert the internal value or if the node is not a TypeValue
func (*Node) MustGetInt ¶ added in v1.1.0
MustGetInt Return value of a TypeValue as int will panic if cant convert the internal value or if the node is not a TypeValue
func (*Node) MustGetInt16 ¶ added in v1.1.0
MustGetInt16 Return value of a TypeValue as int16 will panic if cant convert the internal value or if the node is not a TypeValue
func (*Node) MustGetInt32 ¶ added in v1.1.0
MustGetInt32 Return value of a TypeValue as int32 will panic if cant convert the internal value or if the node is not a TypeValue
func (*Node) MustGetInt64 ¶ added in v1.1.0
MustGetInt64 Return value of a TypeValue as int64 will panic if cant convert the internal value or if the node is not a TypeValue
func (*Node) MustGetInt8 ¶ added in v1.1.0
MustGetInt8 Return value of a TypeValue as int8 will panic if cant convert the internal value or if the node is not a TypeValue
func (*Node) MustGetString ¶ added in v1.1.0
MustGetString Return value of a TypeValue as string will panic if cant convert the internal value or if the node is not a TypeValue
func (*Node) MustGetUint ¶ added in v1.1.0
MustGetUint Return value of a TypeValue as uint will panic if cant convert the internal value or if the node is not a TypeValue
func (*Node) MustGetUint16 ¶ added in v1.1.0
MustGetUint16 Return value of a TypeValue as uint16 will panic if cant convert the internal value or if the node is not a TypeValue
func (*Node) MustGetUint32 ¶ added in v1.1.0
MustGetUint32 Return value of a TypeValue as uint32 will panic if cant convert the internal value or if the node is not a TypeValue
func (*Node) MustGetUint64 ¶ added in v1.1.0
MustGetUint64 Return value of a TypeValue as uint64 will panic if cant convert the internal value or if the node is not a TypeValue
func (*Node) MustGetUint8 ¶ added in v1.1.0
MustGetUint8 Return value of a TypeValue as uint8 will panic if cant convert the internal value or if the node is not a TypeValue
func (*Node) Print ¶ added in v1.1.0
func (that *Node) Print()
Print Print all the data the we ve got on a node and all it s children as a go struct :) (FOR DEV PURPOSE)
func (*Node) SetType ¶ added in v1.1.0
SetType Is use to set the Type of a node and return the current Node you are working on
func (*Node) UnmarshalDontExpand ¶ added in v1.1.0
UnmarshalDontExpand set or not if Unmarshall will generate anything in that Node and its children
val: will change the expanding rules for this node
- The type wont be change for any type
- Array wont grow
- New keys wont be added to Map
- Values set to nil "*.Val(nil)*" will be turn into the type decide by Json
- It will respect any current mapping and will return errors if needed
recurse: if true, it will set all the children of that Node with val
func (*Node) UnmarshalJSON ¶ added in v1.1.0
UnmarshalJSON Make Node a Unmarshaler Interface compatible