Documentation
¶
Overview ¶
Decimal is a big.Float equivalent that marshals to/from JSON.
Index ¶
- Constants
- func AsArray(v interface{}) []interface{}
- func AsBool(v interface{}) bool
- func AsFloat64(v interface{}) float64
- func AsInt(v interface{}) int
- func AsInt64(v interface{}) int64
- func AsMap(v interface{}) map[string]interface{}
- func AsString(v interface{}) string
- func AsStringArray(v interface{}) []string
- func Equivalent(obj1 interface{}, obj2 interface{}) bool
- func Get(m map[string]interface{}, key string) interface{}
- func GetArray(m map[string]interface{}, key string) []interface{}
- func GetBool(m map[string]interface{}, key string) bool
- func GetInt(m map[string]interface{}, key string) int
- func GetInt64(m map[string]interface{}, key string) int64
- func GetMap(m map[string]interface{}, key string) map[string]interface{}
- func GetString(m map[string]interface{}, key string) string
- func GetStringArray(m map[string]interface{}, key string) []string
- func Json(obj interface{}) string
- func JsonKeysInOrder(data []byte) ([]string, error)
- func Kind(v interface{}) string
- func Pretty(obj interface{}) string
- func ToString(obj interface{}) string
- type Decimal
- func (d *Decimal) AsBigFloat() *big.Float
- func (d *Decimal) AsFloat64() float64
- func (d *Decimal) AsInt() int
- func (d *Decimal) AsInt32() int32
- func (d *Decimal) AsInt64() int64
- func (d Decimal) MarshalJSON() ([]byte, error)
- func (d *Decimal) String() string
- func (d *Decimal) UnmarshalJSON(b []byte) error
- type Object
- func (s *Object) Get(key string) interface{}
- func (s *Object) GetArray(key string) []interface{}
- func (s *Object) GetBool(key string) bool
- func (s *Object) GetDecimal(key string) *Decimal
- func (s *Object) GetInt(key string) int
- func (s *Object) GetInt64(key string) int64
- func (s *Object) GetMap(key string) map[string]interface{}
- func (s *Object) GetObject(key string) *Object
- func (s *Object) GetString(key string) string
- func (s *Object) GetStringArray(key string) []string
- func (s *Object) Has(key string) bool
- func (s *Object) Keys() []string
- func (s *Object) Length() int
- func (s Object) MarshalJSON() ([]byte, error)
- func (s *Object) Put(key string, val interface{})
- func (s *Object) String() string
- func (s *Object) UnmarshalJSON(data []byte) error
Constants ¶
View Source
const DecimalPrecision = uint(250)
we establish this "reasonable" max precision
Variables ¶
This section is empty.
Functions ¶
func AsStringArray ¶
func AsStringArray(v interface{}) []string
func Equivalent ¶
func Equivalent(obj1 interface{}, obj2 interface{}) bool
func GetStringArray ¶
func JsonKeysInOrder ¶
Types ¶
type Decimal ¶
func DecimalValue ¶
func GetDecimal ¶
func NewDecimal ¶
func ParseDecimal ¶
func (*Decimal) AsBigFloat ¶
func (Decimal) MarshalJSON ¶
Encode as a JSON number. The JSON spec allows for arbitrary precision, so this is the correct thing to do.
func (*Decimal) UnmarshalJSON ¶
type Object ¶
type Object struct {
// contains filtered or unexported fields
}
data.Object - a map that preserves the order of the keys (which are always converted
to strings). Values can be anything.
func ObjectFromMap ¶
func (*Object) GetDecimal ¶
func (*Object) GetStringArray ¶
func (Object) MarshalJSON ¶
func (*Object) UnmarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.