money

package
v0.0.0-...-7ead755 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Money

type Money int64

Money 表示金钱, 单位为分.

func (Money) MarshalJSON

func (m Money) MarshalJSON() (text []byte, err error)

MarshalJSON 将 Money 编码成 "xxxx.yz" 这样以 '元' 为单位的字符串.

func (Money) MarshalText

func (m Money) MarshalText() (text []byte, err error)

MarshalText 将 Money 编码成 xxxx.yz 这样以 '元' 为单位的字符串.

func (Money) MarshalXML

func (m Money) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)

MarshalXML 将 Money 编码成 xxxx.yz 这样以 '元' 为单位的字符串.

func (Money) Text

func (m Money) Text() string

Text 将 Money 编码成 xxxx.yz 这样以 '元' 为单位的字符串.

func (*Money) UnmarshalJSON

func (m *Money) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON 将 "xxxx.yz" 这样以 '元' 为单位的字符串解码到 Money 中.

func (*Money) UnmarshalText

func (m *Money) UnmarshalText(text []byte) (err error)

UnmarshalText 将 xxxx.yz 这样以 '元' 为单位的字符串解码到 Money 中.

func (*Money) UnmarshalTextString

func (m *Money) UnmarshalTextString(text string) (err error)

UnmarshalTextString 将 xxxx.yz 这样以 '元' 为单位的字符串解码到 Money 中.

func (*Money) UnmarshalXML

func (m *Money) UnmarshalXML(d *xml.Decoder, start xml.StartElement) (err error)

UnmarshalXML 将 xxxx.yz 这样以 '元' 为单位的字符串解码到 Money 中.

type Money2

type Money2 int64

Money2 表示金钱, 单位为分.

Money2 是 Money 的扩展, 支持数据库 decimal(x.2) 类型的直接存取.

func (Money2) MarshalJSON

func (m Money2) MarshalJSON() ([]byte, error)

MarshalJSON 将 Money2 编码成 "xxxx.yz" 这样以 '元' 为单位的字符串.

func (Money2) MarshalText

func (m Money2) MarshalText() (text []byte, err error)

MarshalText 将 Money2 编码成 xxxx.yz 这样以 '元' 为单位的字符串.

func (Money2) MarshalXML

func (m Money2) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)

MarshalXML 将 Money2 编码成 xxxx.yz 这样以 '元' 为单位的字符串.

func (*Money2) Scan

func (m *Money2) Scan(value interface{}) error

Scan 实现了 sql.Scanner 接口, 将 decimal(.2) 字段解码到 Money2 中.

func (Money2) Text

func (m Money2) Text() string

Text 将 Money2 编码成 xxxx.yz 这样以 '元' 为单位的字符串.

func (*Money2) UnmarshalJSON

func (m *Money2) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON 将 "xxxx.yz" 这样以 '元' 为单位的字符串解码到 Money2 中.

func (*Money2) UnmarshalText

func (m *Money2) UnmarshalText(text []byte) (err error)

UnmarshalText 将 xxxx.yz 这样以 '元' 为单位的字符串解码到 Money2 中.

func (*Money2) UnmarshalTextString

func (m *Money2) UnmarshalTextString(text string) (err error)

UnmarshalTextString 将 xxxx.yz 这样以 '元' 为单位的字符串解码到 Money2 中.

func (*Money2) UnmarshalXML

func (m *Money2) UnmarshalXML(d *xml.Decoder, start xml.StartElement) (err error)

UnmarshalXML 将 xxxx.yz 这样以 '元' 为单位的字符串解码到 Money2 中.

func (Money2) Value

func (m Money2) Value() (driver.Value, error)

Value 实现了 driver.Valuer 接口, 将 Money2 编码成 decimal(.2) 格式.

type NullMoney

type NullMoney struct {
	Money Money
	Valid bool
}

NullMoney represents an Money that may be null. NullMoney implements the Scanner interface so it can be used as a scan destination, similar to NullString.

func (*NullMoney) Scan

func (m *NullMoney) Scan(value interface{}) error

Scan implements the sql.Scanner interface.

func (NullMoney) Value

func (m NullMoney) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

type NullMoney2

type NullMoney2 struct {
	Money Money2
	Valid bool
}

NullMoney2 represents an Money2 that may be null. NullMoney2 implements the Scanner interface so it can be used as a scan destination, similar to NullString.

func (*NullMoney2) Scan

func (m *NullMoney2) Scan(value interface{}) error

Scan implements the sql.Scanner interface.

func (NullMoney2) Value

func (m NullMoney2) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

Jump to

Keyboard shortcuts

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