RepositoryGoGBVương quốc Anh
RH

Rhymond/go-money

Go implementation of Fowler's Money pattern

1.9ksao
165fork
14issue
4lượt xem

Thành tựu nổi bật

Những danh hiệu mới nhất của dự án

1
TINIX TRENDING·Chủ đề: fowler-money-pattern

#1 Repository của tuần

1
TINIX TRENDING·Chủ đề: money-library

#1 Repository của tuần

1
TINIX TRENDING·Chủ đề: currency

#1 Repository của tuần

💰 go-money: Thư viện tiền tệ chính xác theo Fowler's Money pattern

Xử lý giá trị tiền tệ bằng số nguyên đơn vị nhỏ nhất, tránh lỗi làm tròn kiểu float.

go-money là thư viện Go cài đặt Fowler's Money pattern, lưu trữ số tiền dưới dạng số nguyên theo đơn vị nhỏ nhất của đồng tiền (ví dụ: 100 = 1 GBP), hỗ trợ các phép toán như cộng, trừ, nhân, chia, so sánh và phân bổ tiền mà không mất xu do làm tròn.

✨ Điểm nổi bật

  • Money struct: lưu trữ số tiền và đồng tiền.
  • Số nguyên thay thế float: tránh lỗi làm tròn.
  • So sánh: Equals, GreaterThan, LessThan, Compare...
  • Phép toán: Add, Subtract, Multiply, Absolute, Negative.
  • Phân bổ: Split và Allocate phân phối đồng xu còn lại đều cho các bên.
  • Định dạng: Display() và AsMajorUnits().

💡 Vì sao đáng chú ý

go-money áp dụng nguyên tắc lưu trữ tiền tệ dưới dạng số nguyên đơn vị nhỏ nhất, tránh các sai số phổ biến khi dùng float. Phù hợp cho ứng dụng tài chính, thương mại điện tử hoặc bất kỳ hệ thống nào cần tính toán tiền tệ chính xác.


#FowlerMoneyPattern #Go #Currency #MoneyLibrary #TiniX

Dự án tương tự

Khám phá các dự án và mô hình AI khác có sự tương đồng.

RepositoryPHP
moneyphp/money

PHP implementation of Fowler's Money pattern.

4.9k
Nov 23, 2026
RepositoryTypeScript
frolovdev/easymoney

Library for operating with monetary values in JavaScript and Typescript 💵

162
Sep 28, 2026
RepositoryTypeScript
dinerojs/dinero.js

Create, calculate, and format money in JavaScript and TypeScript

6.8k
Nov 25, 2026
RepositoryRuby
lineofflight/frankfurter

💱 Currency data API

2.2k
Dec 1, 2026
RepositoryPHP
brick/money

A money and currency library for PHP

1.9k
Oct 6, 2026
RepositoryPHP
florianv/swap

PHP currency conversion library for retrieving exchange rates from 30 providers, with caching and fallback. Maintained since 2014.

1.3k
Nov 26, 2026
RepositorySwift
Flight-School/Money

A precise, type-safe representation of a monetary amount in a given currency

907
Aug 31, 2023
RepositoryPHP
akaunting/laravel-money

Currency formatting and conversion package for Laravel

790
Nov 29, 2026
RepositoryTypeScript
xxczaki/cashify

💸 Lightweight currency conversion library, successor of money.js

407
Nov 26, 2026