Documentation
¶
Overview ¶
Copyright 2017-2018 OneLedger
Copyright 2017-2018 OneLedger ¶
We want encapsulated conversions for the three different pathways:
- transactions sent from Tendermint (is this a mix between wire and JSON?)
- data stored in LevelDB
- queries coming in from http
Copyright 2017-2018 OneLedger ¶
Basic stack implementation ¶
TODO: Currently reversed, which is probably not good for performance.
Copyright 2017-2018 OneLedger
Index ¶
- Constants
- func Alloc(dataType string, size int) interface{}
- func CheckValue(element reflect.Value) bool
- func CleanValue(action *Action, input interface{}) interface{}
- func Clone(base interface{}) interface{}
- func CloneNode(action *Action, input interface{}) interface{}
- func Contract(base interface{}) interface{}
- func ContractNode(action *Action, input interface{}) interface{}
- func ConvertMap(container interface{}) (map[string]interface{}, int)
- func ConvertNumber(fieldType reflect.Type, value reflect.Value) reflect.Value
- func ConvertValue(value interface{}, fieldType reflect.Type) reflect.Value
- func Deserialize(input []byte, output interface{}, medium Format) (msg interface{}, err error)
- func Extend(base interface{}) interface{}
- func ExtendNode(action *Action, input interface{}) interface{}
- func GetBaseType(base interface{}) reflect.Type
- func GetBaseTypeString(base interface{}) string
- func GetBaseValue(base interface{}) reflect.Value
- func GetInt(value string, defaultValue int) int
- func GetString(value reflect.Value) string
- func IgnoreType(dataType reflect.Type) bool
- func IgnoreVariable(value interface{}) bool
- func IsContainer(input interface{}) bool
- func IsDifficult(input interface{}) bool
- func IsInterface(input interface{}) bool
- func IsNilValue(input interface{}) bool
- func IsPointer(input interface{}) bool
- func IsPrimitive(input interface{}) bool
- func IsPrimitiveArray(input interface{}) bool
- func IsPrimitiveContainer(input interface{}) bool
- func IsPrimitiveSlice(input interface{}) bool
- func IsSerialWrapper(input interface{}) bool
- func IsSerialWrapperMap(input interface{}) bool
- func IsSpecial(input interface{}) bool
- func IsStructure(input interface{}) bool
- func Iterate(input interface{}, action *Action) interface{}
- func Print(base interface{})
- func PrintNode(action *Action, input interface{}) interface{}
- func Register(base interface{})
- func RegisterForce(name string, category Category, dataType reflect.Type, keyType *TypeEntry, ...)
- func RegisterIgnore(base interface{})
- func Serialize(input interface{}, medium Format) (buffer []byte, err error)
- func Set(parent interface{}, fieldName string, child interface{}) (status bool)
- func SetArray(parent interface{}, index int, child interface{}) bool
- func SetMap(parent interface{}, fieldName string, child interface{}) bool
- func SetProcessed(action *Action, parent string, name string, input interface{})
- func SetSlice(parent interface{}, index int, child interface{}) bool
- func SetStruct(parent interface{}, fieldName string, child interface{}) bool
- func UnderlyingType(input interface{}) reflect.Type
- func Value2String(key reflect.Value) string
- type Action
- type Category
- type Child
- type Format
- type Message
- type Parameters
- type SerialWrapper
- type Stack
- func (stack Stack) Len() int
- func (stack Stack) Peek() interface{}
- func (stack Stack) PeekN(index int) interface{}
- func (stack *Stack) Pop() interface{}
- func (stack Stack) Print()
- func (stack *Stack) Push(element interface{})
- func (stack *Stack) Shift()
- func (stack Stack) StringPeekN(index int) string
- type TypeEntry
Constants ¶
const ( UNKNOWN = iota PRIMITIVE STRUCT MAP SLICE ARRAY )
Variables ¶
This section is empty.
Functions ¶
func CheckValue ¶
func CleanValue ¶
func CleanValue(action *Action, input interface{}) interface{}
func ContractNode ¶
func ContractNode(action *Action, input interface{}) interface{}
Replace any incoming SerialWrappers with the correct structure
func ConvertMap ¶
ConvertMap takes a structure and return a map of its elements
func ConvertNumber ¶
ConvertNumber handles JSON numbers as they are float64 from the parser
func ConvertValue ¶
Convert any value to an arbitrary type
func Deserialize ¶
Given a serialized slice, put it back into the original struct format
func ExtendNode ¶
func ExtendNode(action *Action, input interface{}) interface{}
Extend the input by replacing all structures with a wrapper
func GetBaseType ¶
GetBaseType returns the underlying value, even if it is a pointer
func GetBaseTypeString ¶
func GetBaseTypeString(base interface{}) string
Find the type string that matches this variable
func GetBaseValue ¶
GetBaseValue returns the underlying value, even if it is a pointer
func IgnoreType ¶
func IgnoreVariable ¶
func IgnoreVariable(value interface{}) bool
func IsInterface ¶
func IsInterface(input interface{}) bool
func IsPrimitiveArray ¶
func IsPrimitiveArray(input interface{}) bool
func IsPrimitiveContainer ¶
func IsPrimitiveContainer(input interface{}) bool
An array or slice that is based around primtives, like []byte
func IsPrimitiveSlice ¶
func IsPrimitiveSlice(input interface{}) bool
func IsSerialWrapper ¶
func IsSerialWrapper(input interface{}) bool
Test to see if this a SerialWrapper struct
func IsSerialWrapperMap ¶
func IsSerialWrapperMap(input interface{}) bool
Can identify a map created from a SerialWrapper, explicitly depends on the SerialWrapper type
func IsStructure ¶
func IsStructure(input interface{}) bool
func Iterate ¶
func Iterate(input interface{}, action *Action) interface{}
Iterate the variables in memory, executing functions at each node in the traversal
func Print ¶
func Print(base interface{})
Print is a post order traversal (not that useful, should be pre-order)
func PrintNode ¶
func PrintNode(action *Action, input interface{}) interface{}
PrintNode is called for each node
func RegisterForce ¶
func RegisterForce(name string, category Category, dataType reflect.Type, keyType *TypeEntry, valueType *TypeEntry)
Force an entry into the table
func RegisterIgnore ¶
func RegisterIgnore(base interface{})
func SetProcessed ¶
Set the as a processed result, and handle pointers nicely.
func UnderlyingType ¶
func Value2String ¶
Types ¶
type Action ¶
type Action struct {
// Config Items
IgnorePrimitives bool
// Current Values
Path Stack
Name string
Index int
IsPointer bool
// Processing Function
ProcessField func(*Action, interface{}) interface{}
// Kids that have already been processed
Processed map[string]Parameters
}
Action is the context for the iteration, each ProcessField function gets an updated pointer
type Child ¶
Extract this info once, even though it is used in multiple levels of the recursion
func GetChildren ¶
func GetChildren(input interface{}) []Child
Get the Fields from a structure, and return them into a field array
func GetChildrenStruct ¶
func GetChildrenStruct(input interface{}) []Child
Get Children from a structure
type Parameters ¶
type Parameters struct {
Children map[string]interface{}
}
type SerialWrapper ¶
type Stack ¶
type Stack struct {
// contains filtered or unexported fields
}