Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Tags: Rhymond/go-money

Tags

v1.0.15

Toggle v1.0.15's commit message
Improved function documentation and add new test

v1.0.14

Toggle v1.0.14's commit message
fix NewFromFloat to use newCurrency instead of GetCurrency

v1.0.13

Toggle v1.0.13's commit message
Fix KGS currency template

v1.0.12

Toggle v1.0.12's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
GH-44 implement driver.Valuer and sql.Scanner for Amount and Currency (

…#99)

* GH-44 implement driver.Valuer and sql.Scanner for money.Currency

This allows any Golang ORM which supports the sql.Scanner to
serialize (via sql.Driver) and deserialize (via sql.Scanner) a
money.Currency instance.

money.Amount is now a type alias to int64 which is already supported
by sql.Scanner as one of the core built-in data types

* GH-44 implement driver.Value and sql.Scanner for money.Money

Money's Value() function enables compatible
sql drivers to serialize a money.Money instance
to a single comma-delimited string value of
"amount,currency_code"

Money's Scan() function assumes that it receives
a single column where the src value is a comma-
delimited string in the format
"amount,currency_code"

While the storage format is up to the client when
the amount and currency are stored separately
a compatible scanner value can be created in
SQLite like this:

    SELECT amount || "," || currency as 'amount'

It is left to the client to decide to use Money's
Valuer implementation with a db annotation on
a property of type Money or else to store the
Amount and Currency values as two separate
columns and return them as a single joined
string field.

* GH-44 fix an edge case

strings.Split(src,,) will return
a slice with length 2 even if
one of the strings is empty

* fix: money.value tests

* refactor out the currency separator and make it customizable

clients can set money.DBMoneyValueSeparator to determine which
separator (e.g. "," "|" ";" ":" "AS" etc) to use when creating a single
driver.Value object to represent a money.Money instance as a single
string database field.

this allows the money package to support string values such as

10@USD
20;CAD
30|IRD
40 in GBP

etc

---------

Co-authored-by: Raymond <[email protected]>

v1.0.11

Toggle v1.0.11's commit message
update workflow and run tests on latest go version

v1.0.10

Toggle v1.0.10's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Use appropriate number symbol for ZWL. ZWD should have unique code cu…

…rrency. (#133)

v1.0.9

Toggle v1.0.9's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
add NewFromFloat #108 (#116)

v1.0.8

Toggle v1.0.8's commit message
update: Fix ARS decimal and thousand separators

v1.0.7

Toggle v1.0.7's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Add XOF and MGA currencies (#110)

This patch adds West African CFA franc (XOF) and Malagasy ariary (MGA)
currencies in order to provide them in go-money library.

See also:
- [West African CFA
  franc](https://en.wikipedia.org/wiki/West_African_CFA_franc);
- [Malagasy ariary](https://en.wikipedia.org/wiki/Malagasy_ariary);

Closes #109

Signed-off-by: r1cm3d <[email protected]>

v1.0.6

Toggle v1.0.6's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
#106 Split of small negative values doesn't work properly (#107)