Documentation
¶
Index ¶
- type Amount
- type Options
- type Value
- func (m Value[T]) Amount() T
- func (m Value[T]) Cmp(other Value[T]) (int, error)
- func (m Value[T]) Combine(other Value[T], op func(T, T) T) (Value[T], error)
- func (m Value[T]) Currency() string
- func (m Value[T]) DecimalPlaces() int
- func (m Value[T]) MarshalJSON() ([]byte, error)
- func (m Value[T]) MarshalText() ([]byte, error)
- func (m Value[T]) String() string
- func (m Value[T]) Validate() error
- func (m Value[T]) WithAmount(amount T) (Value[T], error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Value ¶
type Value[T Amount[T]] struct { // contains filtered or unexported fields }
func (Value[T]) Combine ¶
Combine applies op to two amounts of the same currency; the result keeps the wider display places.
func (Value[T]) DecimalPlaces ¶
func (Value[T]) MarshalJSON ¶
func (Value[T]) MarshalText ¶
func (Value[T]) String ¶
String formats an uninitialized value as an empty string; MarshalJSON and Validate still reject it.
func (Value[T]) WithAmount ¶
WithAmount returns amount in m's currency with at least m's display places.
Click to show internal directories.
Click to hide internal directories.