Documentation ¶
Index ¶
- Constants
- Variables
- func CheckRequiredFields(data JSONObject, fields []string) error
- func GetAnyString(json JSONObject, keys []string) string
- func GetAnyString2(json JSONObject, keys []string) (string, string)
- func GetQueryStringArray(query JSONObject, key string) []string
- func GetStringArray(o JSONObject, key ...string) ([]string, error)
- func IsImplementStdMarshaler(v reflect.Value) json.Marshaler
- func IsImplementStdUnmarshaler(v reflect.Value) json.Unmarshaler
- func JSONArray2StringArray(arr []JSONObject) []string
- func JSONDeserialize(objType reflect.Type, strVal string) (gotypes.ISerializable, error)
- func QueryBoolean(query JSONObject, key string, defVal bool) bool
- func Update(dst, src interface{}) error
- type JSONArray
- func (this *JSONArray) Add(objs ...JSONObject)
- func (this *JSONArray) Copy() *JSONArray
- func (this *JSONArray) DeepCopy() interface{}
- func (arr *JSONArray) Equals(json JSONObject) bool
- func (this *JSONArray) GetArray(keys ...string) ([]JSONObject, error)
- func (this *JSONArray) GetAt(i int, keys ...string) (JSONObject, error)
- func (this *JSONArray) GetString(keys ...string) (string, error)
- func (this *JSONArray) GetStringArray() []string
- func (self *JSONArray) Interface() interface{}
- func (this *JSONArray) IsZero() bool
- func (this *JSONArray) Length() int
- func (this *JSONArray) PrettyString() string
- func (this *JSONArray) SetAt(idx int, obj JSONObject)
- func (this *JSONArray) Size() int
- func (this *JSONArray) String() string
- func (this *JSONArray) Unmarshal(obj interface{}, keys ...string) error
- func (this *JSONArray) Value() []JSONObject
- func (this *JSONArray) YAMLString() string
- type JSONBool
- func (this *JSONBool) Bool(keys ...string) (bool, error)
- func (this *JSONBool) DeepCopy() interface{}
- func (o *JSONBool) Equals(json JSONObject) bool
- func (this *JSONBool) GetArray(keys ...string) ([]JSONObject, error)
- func (this *JSONBool) GetString(keys ...string) (string, error)
- func (self *JSONBool) Interface() interface{}
- func (this *JSONBool) IsZero() bool
- func (this *JSONBool) PrettyString() string
- func (this *JSONBool) String() string
- func (this *JSONBool) Value() bool
- func (this *JSONBool) YAMLString() string
- type JSONDict
- func (this *JSONDict) Add(o JSONObject, keys ...string) error
- func (this *JSONDict) Bool(keys ...string) (bool, error)
- func (this *JSONDict) Contains(keys ...string) bool
- func (this *JSONDict) ContainsIgnoreCases(keys ...string) bool
- func (this *JSONDict) Copy(excludes ...string) *JSONDict
- func (this *JSONDict) CopyExcludes(excludes ...string) *JSONDict
- func (this *JSONDict) CopyIncludes(includes ...string) *JSONDict
- func (this *JSONDict) DeepCopy() interface{}
- func (dict *JSONDict) Equals(json JSONObject) bool
- func (this *JSONDict) Float(keys ...string) (float64, error)
- func (this *JSONDict) Get(keys ...string) (JSONObject, error)
- func (this *JSONDict) GetArray(keys ...string) ([]JSONObject, error)
- func (this *JSONDict) GetAt(i int, keys ...string) (JSONObject, error)
- func (this *JSONDict) GetIgnoreCases(keys ...string) (JSONObject, error)
- func (this *JSONDict) GetMap(keys ...string) (map[string]JSONObject, error)
- func (this *JSONDict) GetString(keys ...string) (string, error)
- func (this *JSONDict) GetTime(keys ...string) (time.Time, error)
- func (this *JSONDict) Int(keys ...string) (int64, error)
- func (self *JSONDict) Interface() interface{}
- func (this *JSONDict) IsZero() bool
- func (this *JSONDict) Length() int
- func (this *JSONDict) PrettyString() string
- func (this *JSONDict) QueryString() string
- func (this *JSONDict) Remove(key string) bool
- func (this *JSONDict) RemoveIgnoreCase(key string) bool
- func (this *JSONDict) Set(key string, value JSONObject)
- func (this *JSONDict) Size() int
- func (this *JSONDict) SortedKeys() []string
- func (this *JSONDict) String() string
- func (this *JSONDict) Unmarshal(obj interface{}, keys ...string) error
- func (dict *JSONDict) Update(json JSONObject)
- func (dict *JSONDict) UpdateDefault(json JSONObject)
- func (this *JSONDict) Value() map[string]JSONObject
- func (this *JSONDict) YAMLString() string
- type JSONError
- type JSONFloat
- func (this *JSONFloat) DeepCopy() interface{}
- func (o *JSONFloat) Equals(json JSONObject) bool
- func (this *JSONFloat) Float(keys ...string) (float64, error)
- func (this *JSONFloat) GetArray(keys ...string) ([]JSONObject, error)
- func (this *JSONFloat) GetString(keys ...string) (string, error)
- func (self *JSONFloat) Interface() interface{}
- func (this *JSONFloat) IsZero() bool
- func (this *JSONFloat) PrettyString() string
- func (this *JSONFloat) String() string
- func (this *JSONFloat) Value() float64
- func (this *JSONFloat) YAMLString() string
- type JSONInt
- func (this *JSONInt) DeepCopy() interface{}
- func (o *JSONInt) Equals(json JSONObject) bool
- func (this *JSONInt) Float(keys ...string) (float64, error)
- func (this *JSONInt) GetArray(keys ...string) ([]JSONObject, error)
- func (this *JSONInt) GetString(keys ...string) (string, error)
- func (this *JSONInt) Int(keys ...string) (int64, error)
- func (self *JSONInt) Interface() interface{}
- func (this *JSONInt) IsZero() bool
- func (this *JSONInt) PrettyString() string
- func (this *JSONInt) String() string
- func (this *JSONInt) Value() int64
- func (this *JSONInt) YAMLString() string
- type JSONObject
- func DeepCopy(obj JSONObject) JSONObject
- func GetArrayOfPrefix(json JSONObject, prefix string) []JSONObject
- func Marshal(obj interface{}) JSONObject
- func MarshalAll(obj interface{}) JSONObject
- func Parse(str []byte) (JSONObject, error)
- func ParseQueryString(str string) (JSONObject, error)
- func ParseString(str string) (JSONObject, error)
- func ParseYAML(str string) (JSONObject, error)
- type JSONPair
- type JSONString
- func (this *JSONString) Bool(keys ...string) (bool, error)
- func (this *JSONString) DeepCopy() interface{}
- func (o *JSONString) Equals(json JSONObject) bool
- func (this *JSONString) Float(keys ...string) (float64, error)
- func (this *JSONString) GetArray(keys ...string) ([]JSONObject, error)
- func (this *JSONString) GetString(keys ...string) (string, error)
- func (this *JSONString) GetTime(keys ...string) (time.Time, error)
- func (this *JSONString) Int(keys ...string) (int64, error)
- func (self *JSONString) Interface() interface{}
- func (this *JSONString) IsZero() bool
- func (this *JSONString) Length() int
- func (this *JSONString) PrettyString() string
- func (this *JSONString) String() string
- func (this *JSONString) Unmarshal(obj interface{}, keys ...string) error
- func (this *JSONString) Value() string
- func (this *JSONString) YAMLString() string
- type JSONValue
- func (this *JSONValue) Bool(keys ...string) (bool, error)
- func (this *JSONValue) Contains(keys ...string) bool
- func (this *JSONValue) ContainsIgnoreCases(keys ...string) bool
- func (o *JSONValue) Equals(json JSONObject) bool
- func (this *JSONValue) Float(keys ...string) (float64, error)
- func (this *JSONValue) Get(keys ...string) (JSONObject, error)
- func (this *JSONValue) GetArray(keys ...string) ([]JSONObject, error)
- func (this *JSONValue) GetAt(i int, keys ...string) (JSONObject, error)
- func (this *JSONValue) GetIgnoreCases(keys ...string) (JSONObject, error)
- func (this *JSONValue) GetMap(keys ...string) (map[string]JSONObject, error)
- func (this *JSONValue) GetString(keys ...string) (string, error)
- func (this *JSONValue) GetTime(keys ...string) (time.Time, error)
- func (this *JSONValue) Int(keys ...string) (int64, error)
- func (self *JSONValue) Interface() interface{}
- func (this *JSONValue) IsZero() bool
- func (this *JSONValue) PrettyString() string
- func (this *JSONValue) QueryString() string
- func (this *JSONValue) String() string
- func (this *JSONValue) Unmarshal(obj interface{}, keys ...string) error
- func (this *JSONValue) YAMLString() string
Constants ¶
View Source
const ( ErrJsonDictFailInsert = errors.Error("fail to insert object") ErrInvalidJsonDict = errors.Error("not a valid JSONDict") ErrInvalidJsonArray = errors.Error("not a valid JSONArray") ErrInvalidJsonInt = errors.Error("not a valid number") ErrInvalidJsonFloat = errors.Error("not a valid float") ErrInvalidJsonBoolean = errors.Error("not a valid boolean") ErrInvalidJsonString = errors.Error("not a valid string") ErrJsonDictKeyNotFound = errors.Error("key not found") ErrUnsupported = errors.Error("unsupported operation") ErrOutOfKeyRange = errors.Error("out of key range") ErrOutOfIndexRange = errors.Error("out of index range") ErrInvalidChar = errors.Error("invalid char") ErrInvalidHex = errors.Error("invalid hex") ErrInvalidRune = errors.Error("invalid 4 byte rune") ErrTypeMismatch = errors.Error("unmarshal type mismatch") ErrArrayLengthMismatch = errors.Error("unmarshal array length mismatch") ErrInterfaceUnsupported = errors.Error("do not known how to deserialize json into this interface type") ErrMapKeyMustString = errors.Error("map key must be string") ErrMissingInputField = errors.Error("missing input field") ErrNilInputField = errors.Error("nil input field") ErrYamlMissingDictKey = errors.Error("Cannot find JSONDict key") ErrYamlIllFormat = errors.Error("Illformat") )
View Source
const (
TAG_DEPRECATED_BY = reflectutils.TAG_DEPRECATED_BY
)
Variables ¶
View Source
var ( JSONNull = &JSONValue{} JSONTrue = &JSONBool{data: true} JSONFalse = &JSONBool{data: false} )
View Source
var ( JSONDictType reflect.Type JSONArrayType reflect.Type JSONStringType reflect.Type JSONIntType reflect.Type JSONFloatType reflect.Type JSONBoolType reflect.Type JSONDictPtrType reflect.Type JSONArrayPtrType reflect.Type JSONStringPtrType reflect.Type JSONIntPtrType reflect.Type JSONFloatPtrType reflect.Type JSONBoolPtrType reflect.Type JSONObjectType reflect.Type )
Functions ¶
func CheckRequiredFields ¶
func CheckRequiredFields(data JSONObject, fields []string) error
func GetAnyString ¶
func GetAnyString(json JSONObject, keys []string) string
func GetAnyString2 ¶
func GetAnyString2(json JSONObject, keys []string) (string, string)
func GetQueryStringArray ¶
func GetQueryStringArray(query JSONObject, key string) []string
func GetStringArray ¶
func GetStringArray(o JSONObject, key ...string) ([]string, error)
func IsImplementStdUnmarshaler ¶
func IsImplementStdUnmarshaler(v reflect.Value) json.Unmarshaler
func JSONArray2StringArray ¶
func JSONArray2StringArray(arr []JSONObject) []string
func JSONDeserialize ¶
func QueryBoolean ¶
func QueryBoolean(query JSONObject, key string, defVal bool) bool
Types ¶
type JSONArray ¶
type JSONArray struct { JSONValue // contains filtered or unexported fields }
func NewArray ¶
func NewArray(objs ...JSONObject) *JSONArray
func NewStringArray ¶
func (*JSONArray) Add ¶
func (this *JSONArray) Add(objs ...JSONObject)
func (*JSONArray) Equals ¶
func (arr *JSONArray) Equals(json JSONObject) bool
func (*JSONArray) GetStringArray ¶
func (*JSONArray) PrettyString ¶
func (*JSONArray) SetAt ¶
func (this *JSONArray) SetAt(idx int, obj JSONObject)
func (*JSONArray) YAMLString ¶
type JSONBool ¶
type JSONBool struct { JSONValue // contains filtered or unexported fields }
func (*JSONBool) Equals ¶
func (o *JSONBool) Equals(json JSONObject) bool
func (*JSONBool) PrettyString ¶
func (*JSONBool) YAMLString ¶
type JSONDict ¶
type JSONDict struct { JSONValue // contains filtered or unexported fields }
func (*JSONDict) ContainsIgnoreCases ¶
func (*JSONDict) CopyExcludes ¶
func (*JSONDict) CopyIncludes ¶
func (*JSONDict) Equals ¶
func (dict *JSONDict) Equals(json JSONObject) bool
func (*JSONDict) GetIgnoreCases ¶
func (this *JSONDict) GetIgnoreCases(keys ...string) (JSONObject, error)
func (*JSONDict) GetMap ¶
func (this *JSONDict) GetMap(keys ...string) (map[string]JSONObject, error)
func (*JSONDict) PrettyString ¶
func (*JSONDict) QueryString ¶
func (*JSONDict) RemoveIgnoreCase ¶
func (*JSONDict) Set ¶
func (this *JSONDict) Set(key string, value JSONObject)
func (*JSONDict) SortedKeys ¶
func (*JSONDict) Update ¶
func (dict *JSONDict) Update(json JSONObject)
func (*JSONDict) UpdateDefault ¶
func (dict *JSONDict) UpdateDefault(json JSONObject)
func (*JSONDict) YAMLString ¶
type JSONFloat ¶
type JSONFloat struct { JSONValue // contains filtered or unexported fields }
func NewFloat32 ¶
func NewFloat64 ¶
func (*JSONFloat) Equals ¶
func (o *JSONFloat) Equals(json JSONObject) bool
func (*JSONFloat) PrettyString ¶
func (*JSONFloat) YAMLString ¶
type JSONInt ¶
type JSONInt struct { JSONValue // contains filtered or unexported fields }
func (*JSONInt) Equals ¶
func (o *JSONInt) Equals(json JSONObject) bool
func (*JSONInt) PrettyString ¶
func (*JSONInt) YAMLString ¶
type JSONObject ¶
type JSONObject interface { gotypes.ISerializable // String() string PrettyString() string YAMLString() string QueryString() string Contains(keys ...string) bool ContainsIgnoreCases(keys ...string) bool Get(keys ...string) (JSONObject, error) GetIgnoreCases(keys ...string) (JSONObject, error) GetAt(i int, keys ...string) (JSONObject, error) Int(keys ...string) (int64, error) Float(keys ...string) (float64, error) Bool(keys ...string) (bool, error) GetMap(keys ...string) (map[string]JSONObject, error) GetArray(keys ...string) ([]JSONObject, error) GetTime(keys ...string) (time.Time, error) GetString(keys ...string) (string, error) Unmarshal(obj interface{}, keys ...string) error Equals(obj JSONObject) bool // IsZero() bool Interface() interface{} // contains filtered or unexported methods }
func DeepCopy ¶
func DeepCopy(obj JSONObject) JSONObject
func GetArrayOfPrefix ¶
func GetArrayOfPrefix(json JSONObject, prefix string) []JSONObject
func Marshal ¶
func Marshal(obj interface{}) JSONObject
func MarshalAll ¶
func MarshalAll(obj interface{}) JSONObject
func Parse ¶
func Parse(str []byte) (JSONObject, error)
func ParseQueryString ¶
func ParseQueryString(str string) (JSONObject, error)
func ParseString ¶
func ParseString(str string) (JSONObject, error)
func ParseYAML ¶
func ParseYAML(str string) (JSONObject, error)
type JSONString ¶
type JSONString struct { JSONValue // contains filtered or unexported fields }
func NewString ¶
func NewString(val string) *JSONString
func NewTimeString ¶
func NewTimeString(tm time.Time) *JSONString
func (*JSONString) DeepCopy ¶
func (this *JSONString) DeepCopy() interface{}
func (*JSONString) Equals ¶
func (o *JSONString) Equals(json JSONObject) bool
func (*JSONString) GetArray ¶
func (this *JSONString) GetArray(keys ...string) ([]JSONObject, error)
func (*JSONString) Interface ¶
func (self *JSONString) Interface() interface{}
func (*JSONString) IsZero ¶
func (this *JSONString) IsZero() bool
func (*JSONString) Length ¶
func (this *JSONString) Length() int
func (*JSONString) PrettyString ¶
func (this *JSONString) PrettyString() string
func (*JSONString) String ¶
func (this *JSONString) String() string
func (*JSONString) Unmarshal ¶
func (this *JSONString) Unmarshal(obj interface{}, keys ...string) error
func (*JSONString) YAMLString ¶
func (this *JSONString) YAMLString() string
type JSONValue ¶
type JSONValue struct { }
func (*JSONValue) ContainsIgnoreCases ¶
func (*JSONValue) Equals ¶
func (o *JSONValue) Equals(json JSONObject) bool
func (*JSONValue) GetIgnoreCases ¶
func (this *JSONValue) GetIgnoreCases(keys ...string) (JSONObject, error)
func (*JSONValue) GetMap ¶
func (this *JSONValue) GetMap(keys ...string) (map[string]JSONObject, error)
func (*JSONValue) PrettyString ¶
func (*JSONValue) QueryString ¶
func (*JSONValue) YAMLString ¶
Source Files ¶
- access.go
- clone.go
- compond.go
- consts.go
- currency.go
- dict.go
- doc.go
- equals.go
- errors.go
- interface.go
- iszero.go
- json_pointer_trace.go
- jsonpointer.go
- jsonutils.go
- length.go
- marshal.go
- marshal_session.go
- parse_session.go
- querystring.go
- reflect.go
- size.go
- std_json.go
- string.go
- stringsegment.go
- unmarshal.go
- unmarshal_session.go
- update.go
- utils.go
- values.go
- write.go
- yamlutils.go
Click to show internal directories.
Click to hide internal directories.