decimal

package module
v0.0.0-...-86ee82c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2018 License: BSD-2-Clause Imports: 8 Imported by: 0

README

h12.io/decimal

It is a wrapper arround github.com/shopspring/decimal to support:

  • Deserialization of
    • BSON Decimal128
    • BSON float
  • JSON serialization as JSON Number rather than JSON String
  • XML serialization as XML attribute or XML chardata

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type D

type D struct {
	// contains filtered or unexported fields
}

func Float

func Float(v float64) D

func Int

func Int(v int) D

func String

func String(v string) (D, error)

func (D) Add

func (d D) Add(o D) D

func (D) Addr

func (d D) Addr() *D

func (D) Div

func (d D) Div(o D) D

func (*D) Elem

func (d *D) Elem() D

func (D) Equal

func (d D) Equal(o D) bool

func (D) Float64

func (d D) Float64() float64

func (D) GetBSON

func (d D) GetBSON() (interface{}, error)

func (D) GreaterEqual

func (d D) GreaterEqual(o D) bool

func (D) GreaterThan

func (d D) GreaterThan(o D) bool

func (D) Int

func (d D) Int() int

func (D) IsZero

func (d D) IsZero() bool

func (D) LessEqual

func (d D) LessEqual(o D) bool

func (D) LessThan

func (d D) LessThan(o D) bool

func (D) MarshalBinary

func (d D) MarshalBinary() (data []byte, err error)

func (D) MarshalJSON

func (d D) MarshalJSON() ([]byte, error)

func (D) MarshalText

func (d D) MarshalText() ([]byte, error)

func (D) MarshalXMLAttr

func (d D) MarshalXMLAttr(name xml.Name) (xml.Attr, error)

func (D) Mul

func (d D) Mul(o D) D

func (D) Round

func (d D) Round(places int32) D

func (*D) Scan

func (d *D) Scan(src interface{}) error

func (*D) SetBSON

func (d *D) SetBSON(raw bson.Raw) error

func (D) String

func (d D) String() string

func (D) Sub

func (d D) Sub(o D) D

func (*D) UnmarshalBinary

func (d *D) UnmarshalBinary(data []byte) error

func (*D) UnmarshalJSON

func (d *D) UnmarshalJSON(data []byte) error

func (*D) UnmarshalText

func (d *D) UnmarshalText(data []byte) error

func (*D) UnmarshalXMLAttr

func (d *D) UnmarshalXMLAttr(attr xml.Attr) error

func (D) Value

func (d D) Value() (driver.Value, error)

func (D) Wire

func (d D) Wire() W

type W

type W struct {
	B []byte
}

W is wire type for D

func (*W) DecodeMsg

func (z *W) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*W) EncodeMsg

func (z *W) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*W) MarshalMsg

func (z *W) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*W) Msgsize

func (z *W) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (W) Unmarshal

func (w W) Unmarshal() (d D, err error)

func (*W) UnmarshalMsg

func (z *W) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL