Documentation
¶
Index ¶
- Constants
- Variables
- func ConvertInterfaceNumberToFloat64(val interface{}) (float64, error)
- func ConvertInterfaceNumberToInt64(val interface{}) (int64, error)
- func EncodePrimitiveValue(v interface{}) ([]byte, error)
- func EncodeToJsonString(input string) []byte
- func FlattenJsonStructForUnmarshal(workItem reflect.Value) map[string]*JSONStructField
- func IsNumberStartingCharacter(b byte) bool
- func IsPrimitiveType(value reflect.Value) bool
- func IsSpaces(b byte) bool
- func RemoveBytes(b []byte, b2remove []byte) []byte
- func RepairUTF8(s string) string
- type JSONStructField
- type JsonExtendOptions
- type JsonTagOptions
- type OrderedMap
- type Stack
- func (s *Stack[T]) Clear()
- func (s *Stack[T]) Clone() *Stack[T]
- func (s *Stack[T]) Get(i int) (T, error)
- func (s *Stack[T]) GetSlice() []T
- func (s *Stack[T]) IsEmpty() bool
- func (s *Stack[T]) Length() int
- func (s *Stack[T]) Peek() (T, error)
- func (s *Stack[T]) Pop() (T, error)
- func (s *Stack[T]) Push(v T)
- func (s *Stack[T]) PushElements(v []T)
Constants ¶
View Source
const (
EMPTY_STACK = "Empty Stack"
)
Variables ¶
View Source
var ( ErrorInputNil = errors.New("input is nil") ErrorInputNotNumber = errors.New("input is not a number") ErrorVariableDataKind = errors.New("unsupported variable data kind") ErrorUnsupportedDataKindConvertNumber = errors.New("unsupported data kind for number conversion") ErrorEndOfStack = errors.New("end of stack") )
View Source
var RegStringWithVariable regexp.Regexp = *regexp.MustCompile(`\$\{([a-zA-Z\_]+\w*?)\}`)
Functions ¶
func ConvertInterfaceNumberToFloat64 ¶ added in v0.4.2
json input value is always float64, convert to different numeric value based on out element kind
func ConvertInterfaceNumberToInt64 ¶ added in v0.4.2
func EncodePrimitiveValue ¶ added in v0.4.0
func EncodeToJsonString ¶ added in v0.4.0
given non-ASCII UTF-8 strings encode it to json string align with RFC 7159
func FlattenJsonStructForUnmarshal ¶ added in v0.4.0
func FlattenJsonStructForUnmarshal(workItem reflect.Value) map[string]*JSONStructField
this is for Unmarshal, the main differences relies on the fact that when unmarshalling, we cannot use workItem's value and omityempty field to drop field that will be returned from here, as the values has not yet been unmarshal into the workItem
func IsPrimitiveType ¶ added in v0.4.0
func RemoveBytes ¶ added in v0.3.0
func RepairUTF8 ¶ added in v0.3.2
Types ¶
type JSONStructField ¶ added in v0.4.0
type JSONStructField struct { FieldName string FieldValue reflect.Value FieldJsonTag *JsonTagOptions ExtendTag *JsonExtendOptions }
func FlattenJsonStructForMarshal ¶ added in v0.4.0
func FlattenJsonStructForMarshal(workItem reflect.Value) []*JSONStructField
FlattenJsonStruct flatten a struct into a list of JSONStructField, will drop field base on json tag settings, as the workItem already have all the information set.
func (*JSONStructField) ShouldDropFieldIfSetValue ¶ added in v0.4.0
func (j *JSONStructField) ShouldDropFieldIfSetValue(valueToUnmarshal reflect.Value) bool
type JsonExtendOptions ¶ added in v0.4.2
type JsonTagOptions ¶ added in v0.4.0
type JsonTagOptions struct { Omitempty bool StringEncode bool // contains filtered or unexported fields }
func GetFieldNameAndOptions ¶ added in v0.4.0
func GetFieldNameAndOptions(jsonTag string) *JsonTagOptions
type OrderedMap ¶ added in v0.4.0
type OrderedMap struct {
// contains filtered or unexported fields
}
func NewOrderedMap ¶ added in v0.4.0
func NewOrderedMap() *OrderedMap
func (*OrderedMap) Add ¶ added in v0.4.0
func (om *OrderedMap) Add(key string, value interface{})
Add a new key-value pair
func (*OrderedMap) Get ¶ added in v0.4.0
func (om *OrderedMap) Get(key string) (interface{}, bool)
Get the value for a key
func (*OrderedMap) Iterate ¶ added in v0.4.0
func (om *OrderedMap) Iterate(f func(key string, value interface{}))
Iterate through the key-value pairs in order
Click to show internal directories.
Click to hide internal directories.