https://github.com/aditya-k93/transactions
Scala crud app using http4s, circe and in-memory-db (thread safe concurrent TrieMap). Stack safe recursion
https://github.com/aditya-k93/transactions
circe http4s scala
Last synced: 2 months ago
JSON representation
Scala crud app using http4s, circe and in-memory-db (thread safe concurrent TrieMap). Stack safe recursion
- Host: GitHub
- URL: https://github.com/aditya-k93/transactions
- Owner: aditya-K93
- Created: 2021-05-31T02:09:04.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-08-05T04:24:27.000Z (about 1 year ago)
- Last Synced: 2025-03-01T11:33:32.903Z (7 months ago)
- Topics: circe, http4s, scala
- Language: Scala
- Homepage:
- Size: 21.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# README
- Install [sbt](https://www.scala-sbt.org/1.x/docs/Setup.html) (Scala Build Tool)
- Compile `sbt clean compile`
- Test `sbt test`
- Run `sbt run`Transitive Sum (recursive definition)
```parent(B) = A
parent(C) = A
parent(D) = B
parent(B) = C
for any given txn x: transitive_sum(x) => f(x) + transitive_sum(children(x)) where f(x) is cost of txn x
transitive_sum(A) = f(A) + transitive_sum(C)
transitive_sum(B) = f(B) + transitive_sum(D)
transitive_sum(C) = f(C) + transitive_sum(B)
transitive_sum(D) = f(D)transitive_sum(B) = f(B) + transitive_sum(D)
= f(B) + f(D)
transitive_sum(C) = f(C) + transitive_sum(B)
= f(C) + f(B) + f(D)
transitive_sum(A) = f(A) + transitive_sum(C)
= f(A) + f(C) + f(B) + f(D)
```Example commands (GET, POST, PUT):
- `POST/PUT`
curl -v -H "Content-Type: application/json" -X PUT http://localhost:8080/transactionservice/transaction/10 -d '{ "type":"cars","amount" : 5000}'- `POST/PUT`
curl -v -H "Content-Type: application/json" -X PUT http://localhost:8080/transactionservice/transaction/11 -d '{ "type":"shopping","amount" : 10000, "parent_id":10}'- `GET`
curl -v http://localhost:8080/transactionservice/types/cars- `GET`
curl -v http://localhost:8080/transactionservice/sum/10- `GET`
curl -v http://localhost:8080/transactionservice/sum/11