Documentation
¶
Index ¶
- func Decode(r io.Reader, obj interface{}) error
- func DecodeBytes(src []byte, obj interface{}) error
- func Log(v interface{})
- func Marshal(v interface{}) ([]byte, error)
- func MarshalIndent(v interface{}, prefix, indent string) ([]byte, error)
- func Unmarshal(data []byte, v interface{}) error
- func UnmarshalFile(fileName string, v interface{}) (err error)
- func UnmarshalReader(r io.Reader, v interface{}) error
- type JSONDecoder
- func (s *JSONDecoder) Current() JSONTokenType
- func (s *JSONDecoder) Decode(v interface{}) (err error)
- func (s *JSONDecoder) DecodeRaw(v interface{}) error
- func (s *JSONDecoder) EmbeddedLevel() int
- func (s *JSONDecoder) IsObjectClosed() bool
- func (s *JSONDecoder) IsObjectKey() bool
- func (s *JSONDecoder) JSONTypeCheck(rv *reflect.Value) (t Type)
- func (s *JSONDecoder) Next() error
- func (s *JSONDecoder) Token() (t json.Token, err error)
- type JSONFinisher
- type JSONInterface
- type JSONObject
- type JSONTokenType
- type Map
- func (s Map) Bool(key string, defaultVal bool) bool
- func (s Map) Byte(key string, defaultVal byte) byte
- func (s Map) Bytes(key string, defaultVal []byte) []byte
- func (s Map) BytesWithError(key string, defaultVal []byte) ([]byte, error)
- func (s Map) Copy() (res Map)
- func (s Map) EachMap(key string, each func(int, Map) bool)
- func (s Map) EachSlice(key string, each func(int, any) bool)
- func (s Map) Float32(key string, defaultVal float32) float32
- func (s Map) Float64(key string, defaultVal float64) float64
- func (s Map) Int(key string, defaultVal int64) int64
- func (s Map) Int32(key string, defaultVal int) int
- func (s Map) IsBoolean(key string) bool
- func (s Map) IsEmpty() bool
- func (s Map) IsInt(key string) bool
- func (s Map) IsNil(key string) bool
- func (s Map) JSON() (res []byte)
- func (s Map) JSONIndent(prefix, indent string) (res []byte)
- func (s Map) JSONPrettyString() (res string)
- func (s Map) JSONString() (res string)
- func (s Map) KeyExists(key string) bool
- func (s Map) KeysExists(keys []string) string
- func (s Map) LogPretty()
- func (s Map) Map(key string, defaultVal Map) (res Map)
- func (s Map) Slice(key string, defaultVal []interface{}) (res []interface{})
- func (s Map) StorePtr(key string, val interface{}) interface{}
- func (s Map) String(key, defaultVal string) string
- func (s Map) StringSlice(key string, defaultVal []string) (res []string)
- func (s Map) StringVal(key, defaultVal string) string
- func (s Map) StringWithError(key, defaultVal string) (string, error)
- func (s Map) ToMap() map[string]interface{}
- func (s Map) Update(m Map)
- func (s Map) Value(key string, defaultVal interface{}) interface{}
- func (s Map) ValueJSON(key string, defaultVal []byte) (res []byte)
- func (s Map) Variable(key string, ptr interface{}) bool
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeBytes ¶
func MarshalIndent ¶
func UnmarshalFile ¶
func UnmarshalReader ¶
Types ¶
type JSONDecoder ¶
func InitJSONDecoder ¶
func InitJSONDecoder(r io.Reader) *JSONDecoder
func InitJSONDecoderFromSource ¶
func InitJSONDecoderFromSource(src []byte) *JSONDecoder
func (*JSONDecoder) Current ¶
func (s *JSONDecoder) Current() JSONTokenType
func (*JSONDecoder) Decode ¶
func (s *JSONDecoder) Decode(v interface{}) (err error)
func (*JSONDecoder) DecodeRaw ¶
func (s *JSONDecoder) DecodeRaw(v interface{}) error
func (*JSONDecoder) EmbeddedLevel ¶
func (s *JSONDecoder) EmbeddedLevel() int
func (*JSONDecoder) IsObjectClosed ¶
func (s *JSONDecoder) IsObjectClosed() bool
func (*JSONDecoder) IsObjectKey ¶
func (s *JSONDecoder) IsObjectKey() bool
func (*JSONDecoder) JSONTypeCheck ¶
func (s *JSONDecoder) JSONTypeCheck(rv *reflect.Value) (t Type)
func (*JSONDecoder) Next ¶
func (s *JSONDecoder) Next() error
type JSONFinisher ¶
type JSONInterface ¶
type JSONInterface interface {
JSONDecode(*JSONDecoder) (isNil bool, err error)
}
type JSONObject ¶
type JSONTokenType ¶
type JSONTokenType byte
const ( JSON_INVALID JSONTokenType = iota JSON_ARRAY JSON_OBJECT JSON_VALUE )
func (JSONTokenType) String ¶
func (s JSONTokenType) String() string
type Map ¶
type Map map[string]interface{}
Map type
func MapFromInterface ¶
func MapFromInterface(iface interface{}) (res Map)
FromInterface convert map[string]interface{} or Map interface to Map
func (Map) BytesWithError ¶
func (Map) Int ¶
Int returns int64 value by key. If key isn't defined will be returned defaultVal arg value
func (Map) JSONIndent ¶
JSONIndent returns JSON source of the self object with indent
func (Map) JSONPrettyString ¶
func (Map) JSONString ¶
func (Map) KeysExists ¶
KeysExists check values exists by keys list. Returns the first blank key found. If all keys are defined, an empty string will be returned
func (Map) Map ¶
Map returns Map object by key If key isn't defined or have other type will be returned defaultVal arg value
func (Map) Slice ¶
Slce returns slice of interface{} by key If key isn't defined or have a different type will be returned defaultVal arg value
func (Map) String ¶
String returns string value by key If key isn't defined will be returned defaultVal arg value
func (Map) StringSlice ¶
StringSlice returns string slice by key If key isn't defined will be returned defaultVal arg value
func (Map) Value ¶
Value returns interface object with attempt to convert to defaultVal type. If key isn't defined will be returned defaultVal arg value