登录 注册
其他
847
Stars
—
Forks
0
Watchers
—
Open Issues
待补全
许可证
Elixir
语言
—
创建时间
最近更新

项目能做什么

基于 Fowler 货币模式实现的 Elixir 货币处理库,安全易用。
来源:AI 基于仓库事实生成 · 内容以仓库实际 README 为准

使用说明 查看原始 README 原仓库文档

中文使用说明暂未生成。下面保留原仓库 README 摘录,命令与配置均以原文为准。
原始 README 摘录(英文原文,节选前 3000 字符)
# Money

[![CI Status](https://github.com/elixirmoney/money/actions/workflows/ci.yml/badge.svg)](https://github.com/elixirmoney/money/actions/workflows/ci.yml)
[![Module Version](https://img.shields.io/hexpm/v/money.svg)](https://hex.pm/packages/money)
[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/money/)
[![Total Download](https://img.shields.io/hexpm/dt/money.svg)](https://hex.pm/packages/money)
[![License](https://img.shields.io/hexpm/l/money.svg)](https://hex.pm/packages/money)
[![Last Updated](https://img.shields.io/github/last-commit/elixirmoney/money.svg)](https://github.com/elixirmoney/money/commits/master)

Elixir library for working with Money safer, easier, and fun, is an interpretation of the Martin Fowler's [Money pattern](https://www.martinfowler.com/eaaCatalog/money.html) in functional programming.

> "If I had a dime for every time I've seen someone use FLOAT to store currency, I'd have \$999.997634" -- [Bill Karwin](https://twitter.com/billkarwin/status/347561901460447232)

In short: You shouldn't represent monetary values by a float. Wherever
you need to represent money, use `Money`.

## Installation

Money comes with no required dependencies.

Add the following to your `mix.exs`:

```elixir
def deps do
  [{:money, "~> 1.14"}]
end
```

then run [`mix deps.get`](http://elixir-lang.org/getting-started/mix-otp/introduction-to-mix).

## Usage

```elixir
five_eur         = Money.new(500, :EUR)             # %Money{amount: 500, currency: :EUR}
ten_eur          = Money.add(five_eur, five_eur)    # %Money{amount: 10_00, currency: :EUR}
hundred_eur      = Money.multiply(ten_eur, 10)      # %Money{amount: 100_00, currency: :EUR}
ninety_nine_eur  = Money.subtract(hundred_eur, 100) # %Money{amount: 99_00, currency: :EUR}
shares           = Money.divide(ninety_nine_eur, 2) # [%Money{amount: 4950, currency: :EUR}, %Money{amount: 4950, currency: :EUR}]

Money.equals?(five_eur, Money.new(500, :EUR)) # true
Money.zero?(five_eur);                        # false
Money.positive?(five_eur);                    # true

Money.Currency.symbol(:USD)                   # $
Money.Currency.symbol(Money.new(500, :AFN))   # ؋
Money.Currency.name(Money.new(500, :AFN))     # Afghani

Money.to_string(Money.new(500, :CNY))         # ¥ 5.00
Money.to_string(Money.new(1_234_56, :EUR), separator: ".", delimiter: ",", symbol: false)
"1.234,56"
Money.to_string(Money.new(1_234_56, :USD), fractional_unit: false)  # "$1,234"
Money.to_string(Money.new(1_234_50, :USD), strip_insignificant_zeros: true)  # "$1,234.5"
```

### Serialization to database with single currency

Bring `Money` to your Ecto project.
The underlying database type is `integer`

1.  Set a default currency in `config.ex`:

    ```elixir
    config :money,
      default_currency: :USD
    ```

2.  Create migration with integer type:

    ```elixir
    create table(:jobs) do
      add :amount, :integer
    end
    ```

3.  Create schema using the `Money.Ecto.Amount.Ty
阅读完整原文

项目深度分析 AI 生成

Elixir 账务与多币种计费模板 (Starter Kit)

产品构想结合Phoenix、Ecto和elixirmoney/money,开发一套包含多币种钱包、基础分账、发票生成与PostgreSQL复合类型存储最佳实践的商业源码模板。
核心功能多币种账户模型、安全分账逻辑、PostgreSQL复合类型迁移脚本、基础对账后台
目标用户需要快速搭建支付/计费模块的Elixir独立开发者及中小SaaS团队
难度/周期中 · 1-2个月 · 成本:极低(主要为个人开发时间成本)
收费模式一次性买断授权(如$99-$299/套)或按团队规模分级定价(推测)
竞争风险Elixir生态相对小众,受众天花板有限;需持续跟进Phoenix/Ecto版本更新
依据 AI推测

企业级汇率与合规扩展包 (Pro Add-on)

产品构想在MIT核心库之外,提供闭源或商业授权的扩展库,解决实时汇率自动同步、历史汇率回溯、不同国家/地区的舍入合规(如银行家舍入法扩展)等痛点。
核心功能第三方汇率API适配器、本地汇率缓存与定时同步、多币种自动换算、审计日志
目标用户有跨境交易、多币种结算需求的Elixir中大型企业团队
难度/周期中 · 1个月 · 成本:低(少量API测试及文档站点成本)
收费模式按年订阅的商业License(推测)
竞争风险开源社区可能出现免费的同类替代扩展库;需验证企业对闭源Hex包的接受度
依据 尚需验证的假设

历史数据无损迁移与技术支持服务

产品构想针对早期使用float存储金额导致精度问题的存量Elixir项目,提供向elixirmoney/money平滑迁移的定制咨询、脚本编写及长期SLA技术支持。
核心功能数据库浮点转整数/复合类型迁移方案、精度校验工具、专属Issue响应与代码审查
目标用户面临资金对账误差、急需重构货币模块的存量Elixir业务公司
难度/周期低-中 · 按项目周期(通常2-4周) · 成本:极低(纯人力时间成本)
收费模式按小时或按项目收取技术咨询费、年度SLA维护费(推测)
竞争风险获客高度依赖个人在Elixir社区的影响力,难以规模化复制
依据 尚需验证的假设
AI 基于仓库公开数据分析生成,含推测成分,不构成收益承诺。
报告会保存到 个人中心

竞品与相似项目 GitHub Search 真实检索

项目中文简介Stars语言
harry0703/MoneyPrinterTurbo 中文介绍暂未生成
利用 AI 大模型和自动化工作流,根据主题或关键词一键生成高清短视频。Generate HD short videos
143,030 Python
FujiwaraChoki/MoneyPrinterV2 中文介绍暂未生成
Automate the process of making money online.
32,416 Python
easychen/howto-make-more-money 中文介绍暂未生成
程序员如何优雅的挣零花钱,2.0版,升级为小书了。Most of this not work outside China
18,740 PHP
bleedline/aimoneyhunter 中文介绍暂未生成
ai副业赚钱大集合,教你如何利用ai做一些副业项目,赚取更多额外收益。The Ultimate Guide to Mak
18,381 -
以上为通过 GitHub 官方 Search API 检索的相似项目,功能差异与优劣势需进一步人工确认,配置 AI 后可生成对比分析。

项目优势与风险

技术成熟度创建时间待补全,最近推送 ,发布过 20 个 Release
社区活跃Star 847 / Fork 0 / Issue 0(数据支持,可自行核实)
许可证未检测到(需人工确认)
主要风险上游项目方向可能变化;同赛道竞争者较多(见竞品表);热度与需求不完全等价

安装与使用

此项目未提供 Docker 镜像,安装步骤以原仓库 README 为准(涉及依赖安装与环境配置,对新手门槛较高)。