Documentation
¶
Overview ¶
********************************************************************** MicroCore Copyright 2017 - 2020 by Danyil Dobryvechir (dobrivecher@yahoo.com ddobryvechir@gmail.com) ***********************************************************************
********************************************************************** MicroCore Copyright 2017 - 2020 by Danyil Dobryvechir (dobrivecher@yahoo.com ddobryvechir@gmail.com) ***********************************************************************
********************************************************************** MicroCore Copyright 2020 - 2020 by Danyil Dobryvechir (dobrivecher@yahoo.com ddobryvechir@gmail.com) ***********************************************************************
Index ¶
- Constants
- Variables
- func ConvertByteArrayToIntOrDouble(data []byte) (interface{}, bool)
- func ConvertDvFieldInfoArrayIntoMap(data []*DvFieldInfo) map[string]*DvFieldInfo
- func ConvertFieldItemArrayIntoMap(info *DvFieldInfo, keyField string, valueField string, defValue string) (res map[string]string, err error)
- func ConvertSimpleKindAndValueToInterface(kind int, data []byte) (interface{}, bool)
- func ConvertSimpleStringMapToJson(data map[string]string, includeBrackets bool) string
- func ConvertStringArrayToByteByteArray(data []string) [][]byte
- func ConvertToDouble(v interface{}) float64
- func ConvertToFloat(v interface{}) float32
- func ConvertToUnsignedLong(v interface{}) uint64
- func ExpressionEvaluation(expr string, resolver ExpressionResolver) (string, error)
- func GetIntValueFromFieldMap(data map[string]*DvFieldInfo, fieldName string) (int, bool)
- func GetKeyContentPecularities(key string) int
- func GetNextPathPartByKey(key string) string
- func GetStringValueFromFieldMap(data map[string]*DvFieldInfo, fieldName string) (string, bool)
- func IsCurrentFormatJson(data []byte) bool
- func IsJsonNumber(d []byte) bool
- func IsJsonString(str []byte) bool
- func IsValueSimple(v interface{}) bool
- func MakeCrudHandler(crudInfo *DvCrudDetails) dvmeta.HandlerFunc
- func MatchDvFieldInfo(model *DvFieldInfo, pattern *DvFieldInfo) bool
- func QuoteEscapedJsonBytes(b []byte) []byte
- func QuoteEscapedJsonBytesToString(b []byte) string
- func QuoteEscapedJsonString(s string) string
- func ReformatJson(json []byte, indent int, trash [][]byte, crlf int) ([]byte, error)
- type DvCrud
- type DvCrudDetails
- type DvCrudInfo
- type DvCrudItem
- type DvCrudParsingInfo
- type DvFieldInfo
- func ConvertDvCrudItemToDvFieldInfo(src *DvCrudItem) (dst *DvFieldInfo)
- func ConvertDvCrudParsingInfoToDvFieldInfo(crudParsingInfo *DvCrudParsingInfo) *DvFieldInfo
- func CreateDvFieldInfoObject() *DvFieldInfo
- func ExecuteProcessorFunction(name string, params string, parent *DvFieldInfo) (*DvFieldInfo, error)
- func FindInArray(parent *DvFieldInfo, pattern *DvFieldInfo, fromIndex int) (*DvFieldInfo, error)
- func JsonFullParser(body []byte) (*DvFieldInfo, error)
- func ProcessorFind(parent *DvFieldInfo, params string) (*DvFieldInfo, error)
- func ReadJsonAsDvFieldInfo(data []byte) (*DvFieldInfo, error)
- func ReadYamlAsDvFieldInfo(data []byte) (*DvFieldInfo, error)
- func (field *DvFieldInfo) AddField(item *DvFieldInfo) bool
- func (field *DvFieldInfo) AddStringField(key string, value string) bool
- func (item *DvFieldInfo) ConvertSimpleValueToInterface() (interface{}, bool)
- func (item *DvFieldInfo) ConvertValueToInterface() (interface{}, bool)
- func (item *DvFieldInfo) GetStringValue() string
- func (dvEntry *DvFieldInfo) PrintToJson(indent int) []byte
- func (dvEntry *DvFieldInfo) PrintToJsonAtLevel(res []byte, level int, indent int, noIndentAtFirst bool) []byte
- func (dvEntry *DvFieldInfo) PrintToYaml(indent int) []byte
- func (dvEntry *DvFieldInfo) PrintToYamlAtLevel(res []byte, level int, indent int, noIndentAtFirst bool) []byte
- func (item *DvFieldInfo) ReadChild(childName string, resolver ExpressionResolver) (res *DvFieldInfo, err error)
- func (item *DvFieldInfo) ReadChildStringValue(fieldName string) string
- func (item *DvFieldInfo) ReadSimpleChild(fieldName string) *DvFieldInfo
- func (item *DvFieldInfo) ReadSimpleChildValue(fieldName string) string
- func (item *DvFieldInfo) ReadSimpleString() (string, error)
- func (item *DvFieldInfo) ReadSimpleStringList(data []string) ([]string, error)
- func (item *DvFieldInfo) ReadSimpleStringMap(data map[string]string) error
- type ExpressionResolver
- type JsonWriter
- func (w *JsonWriter) Close()
- func (w *JsonWriter) EndArray()
- func (w *JsonWriter) EndObject()
- func (w *JsonWriter) Flush()
- func (w *JsonWriter) GetError() error
- func (w *JsonWriter) PrintKey(key string)
- func (w *JsonWriter) PrintValueInteger(value int)
- func (w *JsonWriter) PrintValueSimple(value string)
- func (w *JsonWriter) PrintValueSmart(value interface{}) bool
- func (w *JsonWriter) PrintValueString(value string)
- func (w *JsonWriter) PutData(data ...byte)
- func (w *JsonWriter) PutEscapedString(data []byte)
- func (w *JsonWriter) RepeatData(data byte, n int)
- func (w *JsonWriter) SetError(err error)
- func (w *JsonWriter) SetErrorMessage(message string)
- func (w *JsonWriter) StartArray()
- func (w *JsonWriter) StartObject()
- type OrderedItem
- type OrderedMap
- func (m *OrderedMap) Get(k interface{}) (interface{}, bool)
- func (m *OrderedMap) GetAt(pos int) (interface{}, interface{})
- func (m *OrderedMap) GetAtSafe(pos int) (interface{}, interface{}, bool)
- func (m *OrderedMap) GetByInt64Key(k int64) (interface{}, bool)
- func (m *OrderedMap) GetInt64ByInt64Key(k int64) (int64, bool)
- func (m *OrderedMap) IsSimpleArray(base int) bool
- func (m *OrderedMap) IsSimpleObject() bool
- func (m *OrderedMap) Put(k interface{}, v interface{}) bool
- func (m *OrderedMap) Remove(k interface{}) bool
- func (m *OrderedMap) RemoveAt(pos int) bool
- func (m *OrderedMap) Size() int
- type ProcessorFunction
Constants ¶
const ( OPTIONS_QUICK = iota OPTIONS_FIELDS_ENTRIES = iota OPTIONS_FIELDS_DETAILED = iota OPTIONS_ANY_OBJECT = 1 << 7 OPTIONS_LOW_MASK = 1<<7 - 1 )
const ( FIELD_EMPTY = iota FIELD_NULL FIELD_OBJECT FIELD_NUMBER FIELD_BOOLEAN FIELD_STRING FIELD_ARRAY )
const ( STATE_INITIAL = iota STATE_INITIAL_ARRAY_STARTED STATE_INITIAL_ARRAY_WAITING_COMMA_OR_END STATE_ARRAY_STARTED STATE_OBJECT_STARTED STATE_OBJECT_COLON STATE_VALUE_STARTED STATE_WAITING_END STATE_OBJECT_COMMA_OR_END_EXPECTED STATE_ARRAY_COMMA_OR_END_EXPECTED )
const ( POST_STATE_NONE = iota POST_STATE_ARRAY_CLOSE POST_STATE_OBJECT_CLOSE )
const ExtraReformatJsonProblemCleanExclamationInValue = 1
const (
FIELD_STATUS_IS_ID = 1 << iota
)
const MaxInt = int64(^uint(0) >> 1)
Variables ¶
var LogCrud, LogJson, LogProcessors bool
var ProcessorFunctions = map[string]ProcessorFunction{ "find": ProcessorFind, }
Functions ¶
func ConvertDvFieldInfoArrayIntoMap ¶
func ConvertDvFieldInfoArrayIntoMap(data []*DvFieldInfo) map[string]*DvFieldInfo
func ConvertToDouble ¶
func ConvertToDouble(v interface{}) float64
func ConvertToFloat ¶
func ConvertToFloat(v interface{}) float32
func ConvertToUnsignedLong ¶
func ConvertToUnsignedLong(v interface{}) uint64
func ExpressionEvaluation ¶
func ExpressionEvaluation(expr string, resolver ExpressionResolver) (string, error)
func GetIntValueFromFieldMap ¶
func GetIntValueFromFieldMap(data map[string]*DvFieldInfo, fieldName string) (int, bool)
func GetNextPathPartByKey ¶
func GetStringValueFromFieldMap ¶
func GetStringValueFromFieldMap(data map[string]*DvFieldInfo, fieldName string) (string, bool)
func IsCurrentFormatJson ¶
func IsJsonNumber ¶
func IsJsonString ¶
func IsValueSimple ¶
func IsValueSimple(v interface{}) bool
func MakeCrudHandler ¶
func MakeCrudHandler(crudInfo *DvCrudDetails) dvmeta.HandlerFunc
func MatchDvFieldInfo ¶
func MatchDvFieldInfo(model *DvFieldInfo, pattern *DvFieldInfo) bool
func QuoteEscapedJsonBytes ¶
func QuoteEscapedJsonString ¶
Types ¶
type DvCrudDetails ¶
type DvCrudDetails struct {
// contains filtered or unexported fields
}
type DvCrudInfo ¶
type DvCrudInfo struct {
Entities []DvCrud `json:"entities"`
}
type DvCrudItem ¶
type DvCrudItem struct {
DvFieldInfo
Id []byte
// contains filtered or unexported fields
}
type DvCrudParsingInfo ¶
type DvCrudParsingInfo struct {
Items []*DvCrudItem
Err string
Kind int
Value []byte
}
func JsonQuickParser ¶
func JsonQuickParser(body []byte, crudDetails *DvCrudDetails, highLevelObject bool, mode int) *DvCrudParsingInfo
func (*DvCrudParsingInfo) ConvertSimpleValueToInterface ¶
func (parseInfo *DvCrudParsingInfo) ConvertSimpleValueToInterface() (interface{}, bool)
func (*DvCrudParsingInfo) GetDvFieldInfoHierarchy ¶
func (parseInfo *DvCrudParsingInfo) GetDvFieldInfoHierarchy() []*DvFieldInfo
type DvFieldInfo ¶
type DvFieldInfo struct {
Name []byte
Value []byte
Kind int
Fields []*DvFieldInfo
FieldStatus int
// contains filtered or unexported fields
}
func ConvertDvCrudItemToDvFieldInfo ¶
func ConvertDvCrudItemToDvFieldInfo(src *DvCrudItem) (dst *DvFieldInfo)
func ConvertDvCrudParsingInfoToDvFieldInfo ¶
func ConvertDvCrudParsingInfoToDvFieldInfo(crudParsingInfo *DvCrudParsingInfo) *DvFieldInfo
func CreateDvFieldInfoObject ¶
func CreateDvFieldInfoObject() *DvFieldInfo
func ExecuteProcessorFunction ¶
func ExecuteProcessorFunction(name string, params string, parent *DvFieldInfo) (*DvFieldInfo, error)
func FindInArray ¶
func FindInArray(parent *DvFieldInfo, pattern *DvFieldInfo, fromIndex int) (*DvFieldInfo, error)
func JsonFullParser ¶
func JsonFullParser(body []byte) (*DvFieldInfo, error)
func ProcessorFind ¶
func ProcessorFind(parent *DvFieldInfo, params string) (*DvFieldInfo, error)
func ReadJsonAsDvFieldInfo ¶
func ReadJsonAsDvFieldInfo(data []byte) (*DvFieldInfo, error)
func ReadYamlAsDvFieldInfo ¶
func ReadYamlAsDvFieldInfo(data []byte) (*DvFieldInfo, error)
func (*DvFieldInfo) AddField ¶
func (field *DvFieldInfo) AddField(item *DvFieldInfo) bool
func (*DvFieldInfo) AddStringField ¶
func (field *DvFieldInfo) AddStringField(key string, value string) bool
func (*DvFieldInfo) ConvertSimpleValueToInterface ¶
func (item *DvFieldInfo) ConvertSimpleValueToInterface() (interface{}, bool)
func (*DvFieldInfo) ConvertValueToInterface ¶
func (item *DvFieldInfo) ConvertValueToInterface() (interface{}, bool)
func (*DvFieldInfo) GetStringValue ¶
func (item *DvFieldInfo) GetStringValue() string
func (*DvFieldInfo) PrintToJson ¶
func (dvEntry *DvFieldInfo) PrintToJson(indent int) []byte
func (*DvFieldInfo) PrintToJsonAtLevel ¶
func (*DvFieldInfo) PrintToYaml ¶
func (dvEntry *DvFieldInfo) PrintToYaml(indent int) []byte
func (*DvFieldInfo) PrintToYamlAtLevel ¶
func (*DvFieldInfo) ReadChild ¶
func (item *DvFieldInfo) ReadChild(childName string, resolver ExpressionResolver) (res *DvFieldInfo, err error)
func (*DvFieldInfo) ReadChildStringValue ¶
func (item *DvFieldInfo) ReadChildStringValue(fieldName string) string
func (*DvFieldInfo) ReadSimpleChild ¶
func (item *DvFieldInfo) ReadSimpleChild(fieldName string) *DvFieldInfo
func (*DvFieldInfo) ReadSimpleChildValue ¶
func (item *DvFieldInfo) ReadSimpleChildValue(fieldName string) string
func (*DvFieldInfo) ReadSimpleString ¶
func (item *DvFieldInfo) ReadSimpleString() (string, error)
func (*DvFieldInfo) ReadSimpleStringList ¶
func (item *DvFieldInfo) ReadSimpleStringList(data []string) ([]string, error)
func (*DvFieldInfo) ReadSimpleStringMap ¶
func (item *DvFieldInfo) ReadSimpleStringMap(data map[string]string) error
type ExpressionResolver ¶
type JsonWriter ¶
type JsonWriter struct {
CustomInfo interface{}
// contains filtered or unexported fields
}
func CreateJsonWriter ¶
func (*JsonWriter) Close ¶
func (w *JsonWriter) Close()
func (*JsonWriter) EndArray ¶
func (w *JsonWriter) EndArray()
func (*JsonWriter) EndObject ¶
func (w *JsonWriter) EndObject()
func (*JsonWriter) Flush ¶
func (w *JsonWriter) Flush()
func (*JsonWriter) GetError ¶
func (w *JsonWriter) GetError() error
func (*JsonWriter) PrintKey ¶
func (w *JsonWriter) PrintKey(key string)
func (*JsonWriter) PrintValueInteger ¶
func (w *JsonWriter) PrintValueInteger(value int)
func (*JsonWriter) PrintValueSimple ¶
func (w *JsonWriter) PrintValueSimple(value string)
func (*JsonWriter) PrintValueSmart ¶
func (w *JsonWriter) PrintValueSmart(value interface{}) bool
func (*JsonWriter) PrintValueString ¶
func (w *JsonWriter) PrintValueString(value string)
func (*JsonWriter) PutData ¶
func (w *JsonWriter) PutData(data ...byte)
func (*JsonWriter) PutEscapedString ¶
func (w *JsonWriter) PutEscapedString(data []byte)
func (*JsonWriter) RepeatData ¶
func (w *JsonWriter) RepeatData(data byte, n int)
func (*JsonWriter) SetError ¶
func (w *JsonWriter) SetError(err error)
func (*JsonWriter) SetErrorMessage ¶
func (w *JsonWriter) SetErrorMessage(message string)
func (*JsonWriter) StartArray ¶
func (w *JsonWriter) StartArray()
func (*JsonWriter) StartObject ¶
func (w *JsonWriter) StartObject()
type OrderedItem ¶
type OrderedItem struct {
// contains filtered or unexported fields
}
type OrderedMap ¶
type OrderedMap struct {
// contains filtered or unexported fields
}
func CreateOrderedMap ¶
func CreateOrderedMap(n int) *OrderedMap
func CreateOrderedMapByArray ¶
func CreateOrderedMapByArray(m []interface{}, base int) *OrderedMap
func CreateOrderedMapByMap ¶
func CreateOrderedMapByMap(m map[interface{}]interface{}) *OrderedMap
func (*OrderedMap) Get ¶
func (m *OrderedMap) Get(k interface{}) (interface{}, bool)
func (*OrderedMap) GetAt ¶
func (m *OrderedMap) GetAt(pos int) (interface{}, interface{})
func (*OrderedMap) GetAtSafe ¶
func (m *OrderedMap) GetAtSafe(pos int) (interface{}, interface{}, bool)
func (*OrderedMap) GetByInt64Key ¶
func (m *OrderedMap) GetByInt64Key(k int64) (interface{}, bool)
func (*OrderedMap) GetInt64ByInt64Key ¶
func (m *OrderedMap) GetInt64ByInt64Key(k int64) (int64, bool)
func (*OrderedMap) IsSimpleArray ¶
func (m *OrderedMap) IsSimpleArray(base int) bool
func (*OrderedMap) IsSimpleObject ¶
func (m *OrderedMap) IsSimpleObject() bool
func (*OrderedMap) Put ¶
func (m *OrderedMap) Put(k interface{}, v interface{}) bool
func (*OrderedMap) Remove ¶
func (m *OrderedMap) Remove(k interface{}) bool
func (*OrderedMap) RemoveAt ¶
func (m *OrderedMap) RemoveAt(pos int) bool
func (*OrderedMap) Size ¶
func (m *OrderedMap) Size() int
type ProcessorFunction ¶
type ProcessorFunction func(parent *DvFieldInfo, params string) (*DvFieldInfo, error)