Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/emmanuelsilva/elixir-account
Simple project in Elixir to deposit, withdraw and transfer money between accounts
https://github.com/emmanuelsilva/elixir-account
Last synced: 12 days ago
JSON representation
Simple project in Elixir to deposit, withdraw and transfer money between accounts
- Host: GitHub
- URL: https://github.com/emmanuelsilva/elixir-account
- Owner: emmanuelsilva
- Created: 2024-05-14T23:58:15.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-05-22T20:00:30.000Z (8 months ago)
- Last Synced: 2024-05-22T21:25:02.863Z (8 months ago)
- Language: Elixir
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Account
Simple Elixir project to test the GenServer concept.
For it, I created an Account GenServer, which holds an account balance and exposes deposit, withdraw, and transfer money to other accounts operations.
### Example
You can test using `iex -S mix` and then play with some commands, for example:
```elixir
{:ok, acc1} = Account.start_link(1000)
{:ok, acc2} = Account.start_link(500)Account.deposit(acc1, 250)
Account.deposit(acc2, 100)Account.withdraw(acc1, 50)
Account.withdraw(acc2, 100)Account.transfer(acc1, acc2, 75)
Account.balance(acc1)
Account.balance(acc2)
```## Test
Run `mix test`