Skip to content

Commit

Permalink
feat: add gomarkdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
gfyrag committed Oct 23, 2024
1 parent f5fb88f commit 06e5151
Show file tree
Hide file tree
Showing 6 changed files with 213 additions and 18 deletions.
3 changes: 3 additions & 0 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ generate:
FROM core+builder-image
RUN apk update && apk add openjdk11
RUN go install go.uber.org/mock/mockgen@latest
RUN go install github.com/princjef/gomarkdoc/cmd/gomarkdoc@latest
COPY (+sources/*) /src
WORKDIR /src
RUN go generate ./...
SAVE ARTIFACT internal AS LOCAL internal
SAVE ARTIFACT pkg AS LOCAL pkg
SAVE ARTIFACT cmd AS LOCAL cmd
SAVE ARTIFACT README.md AS LOCAL README.md

compile:
FROM +sources
Expand Down Expand Up @@ -117,6 +119,7 @@ pre-commit:
BUILD +tidy
BUILD +lint
BUILD +openapi
BUILD +generate
BUILD +generate-client
BUILD +export-docs-events

Expand Down
44 changes: 26 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
# Formance Ledger
<!-- Code generated by gomarkdoc. DO NOT EDIT -->

Formance Ledger (fka numary) is a programmable financial ledger that provides a foundation for money-moving applications. The ledger provides atomic multi-postings transactions and is programmable in [Numscript](doc:machine-instructions), a built-in language dedicated to money movements. It can be used either as a standalone micro-service or as part of the greater Formance Stack, and will shine for apps that require a lot of custom, money-moving code, e.g:
# src

* E-commerce with complex payments flows, payments splitting, such as marketplaces
* Company-issued currencies systems, e.g. Twitch Bits
* In-game currencies, inventories and trading systems, e.g. Fortnite V-Bucks
* Payment gateways using non-standard assets, e.g. learning credits
* Local currencies and complementary finance
```go
import "github.com/formancehq/ledger"
```

### Formance Ledger

Formance Ledger \(fka numary\) is a programmable financial ledger that provides a foundation for money\-moving applications. The ledger provides atomic multi\-postings transactions and is programmable in \[Numscript\]\(doc:machine\-instructions\), a built\-in language dedicated to money movements. It can be used either as a standalone micro\-service or as part of the greater Formance Stack, and will shine for apps that require a lot of custom, money\-moving code, e.g:

# Getting started
- E\-commerce with complex payments flows, payments splitting, such as marketplaces
- Company\-issued currencies systems, e.g. Twitch Bits
- In\-game currencies, inventories and trading systems, e.g. Fortnite V\-Bucks
- Payment gateways using non\-standard assets, e.g. learning credits
- Local currencies and complementary finance

Formance Ledger works as a standalone binary, the latest of which can be downloaded from the [releases page](https://github.com/formancehq/ledger/releases). You can move the binary to any executable path, such as to `/usr/local/bin`. Installations using brew, apt, yum or docker are also [available](https://docs.formance.com/docs/installation-1).
### Getting started

```SHELL
Formance Ledger works as a standalone binary, the latest of which can be downloaded from the \[releases page\]\(https://github.com/formancehq/ledger/releases\). You can move the binary to any executable path, such as to \`/usr/local/bin\`. Installations using brew, apt, yum or docker are also \[available\]\(https://docs.formance.com/docs/installation-1\).

```
docker compose up -d
# Submit a first transaction
curl -X POST \
http://localhost:3068/quickstart/transactions -d '{"postings": [{"source": "world", "destination": "bank", "amount": 100, "asset": "USD"}]}'
curl -X POST http://localhost:3068/quickstart/transactions -d '{"postings": [{"source": "world", "destination": "bank", "amount": 100, "asset": "USD"}]}'
# Get the balances of drivers:042
curl -X GET http://localhost:3068/quickstart/accounts/bank
Expand All @@ -27,14 +33,16 @@ curl -X GET http://localhost:3068/quickstart/accounts/bank
curl -X GET http://localhost:3068/quickstart/transactions
```

# Documentation
### Documentation

You can find the complete Numary documentation at \[docs.formance.com\]\(https://docs.formance.com\)

### Community

You can find the complete Numary documentation at [docs.formance.com](https://docs.formance.com)
If you need help, want to show us what you built or just hang out and chat about ledgers you are more than welcome on our \[Slack\]\(https://bit.ly/formance-slack\) \- looking forward to see you there\!

# Community
## Index

If you need help, want to show us what you built or just hang out and chat about ledgers you are more than welcome on our [Slack](https://bit.ly/formance-slack) - looking forward to see you there!

# Contributing

See [dev](./DEV.md) page to contribute.
Generated by [gomarkdoc](<https://github.com/princjef/gomarkdoc>)
149 changes: 149 additions & 0 deletions cmd/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
<!-- Code generated by gomarkdoc. DO NOT EDIT -->

# cmd

```go
import "github.com/formancehq/ledger/cmd"
```

## Index

- [Constants](<#constants>)
- [Variables](<#variables>)
- [func Execute\(\)](<#Execute>)
- [func NewBucket\(\) \*cobra.Command](<#NewBucket>)
- [func NewBucketUpgrade\(\) \*cobra.Command](<#NewBucketUpgrade>)
- [func NewDocCommand\(\) \*cobra.Command](<#NewDocCommand>)
- [func NewDocEventsCommand\(\) \*cobra.Command](<#NewDocEventsCommand>)
- [func NewDocFlagsCommand\(\) \*cobra.Command](<#NewDocFlagsCommand>)
- [func NewRootCommand\(\) \*cobra.Command](<#NewRootCommand>)
- [func NewServeCommand\(\) \*cobra.Command](<#NewServeCommand>)
- [func NewVersion\(\) \*cobra.Command](<#NewVersion>)
- [func PrintVersion\(\_ \*cobra.Command, \_ \[\]string\)](<#PrintVersion>)


## Constants

<a name="BindFlag"></a>

```go
const (
BindFlag = "bind"
BallastSizeInBytesFlag = "ballast-size"
NumscriptCacheMaxCountFlag = "numscript-cache-max-count"
AutoUpgradeFlag = "auto-upgrade"
EnablePProfFlag = "enable-pprof"
)
```

<a name="ServiceName"></a>

```go
const (
ServiceName = "ledger"
)
```

## Variables

<a name="Version"></a>

```go
var (
Version = "develop"
BuildDate = "-"
Commit = "-"
)
```

<a name="Execute"></a>
## func Execute

```go
func Execute()
```



<a name="NewBucket"></a>
## func NewBucket

```go
func NewBucket() *cobra.Command
```



<a name="NewBucketUpgrade"></a>
## func NewBucketUpgrade

```go
func NewBucketUpgrade() *cobra.Command
```



<a name="NewDocCommand"></a>
## func NewDocCommand

```go
func NewDocCommand() *cobra.Command
```



<a name="NewDocEventsCommand"></a>
## func NewDocEventsCommand

```go
func NewDocEventsCommand() *cobra.Command
```



<a name="NewDocFlagsCommand"></a>
## func NewDocFlagsCommand

```go
func NewDocFlagsCommand() *cobra.Command
```



<a name="NewRootCommand"></a>
## func NewRootCommand

```go
func NewRootCommand() *cobra.Command
```



<a name="NewServeCommand"></a>
## func NewServeCommand

```go
func NewServeCommand() *cobra.Command
```



<a name="NewVersion"></a>
## func NewVersion

```go
func NewVersion() *cobra.Command
```



<a name="PrintVersion"></a>
## func PrintVersion

```go
func PrintVersion(_ *cobra.Command, _ []string)
```



Generated by [gomarkdoc](<https://github.com/princjef/gomarkdoc>)
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ require (
github.com/puzpuzpuz/xsync/v3 v3.4.0 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/riandyrn/otelchi v0.10.0 // indirect
github.com/robertkrimen/godocdown v0.0.0-20130622164427-0bfa04905481 // indirect
github.com/rs/cors v1.11.1 // indirect
github.com/shirou/gopsutil/v4 v4.24.8 // indirect
github.com/shoenig/go-m1cpu v0.1.6 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5X
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/riandyrn/otelchi v0.10.0 h1:QMbR/FMDWBOkej6dfyWteYefUKqIFxnyrpaoWRJ9RPQ=
github.com/riandyrn/otelchi v0.10.0/go.mod h1:zBaX2FavWMlsvq4GqHit+QXxF1c5wIMZZFaYyW4+7FA=
github.com/robertkrimen/godocdown v0.0.0-20130622164427-0bfa04905481 h1:jMxcLa+VjJKhpCwbLUXAD15wJ+hhvXMLujCl3MkXpfM=
github.com/robertkrimen/godocdown v0.0.0-20130622164427-0bfa04905481/go.mod h1:C9WhFzY47SzYBIvzFqSvHIR6ROgDo4TtdTuRaOMjF/s=
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA=
Expand Down
32 changes: 32 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
// # Formance Ledger
//
// Formance Ledger (fka numary) is a programmable financial ledger that provides a foundation for money-moving applications. The ledger provides atomic multi-postings transactions and is programmable in [Numscript](doc:machine-instructions), a built-in language dedicated to money movements. It can be used either as a standalone micro-service or as part of the greater Formance Stack, and will shine for apps that require a lot of custom, money-moving code, e.g:
// * E-commerce with complex payments flows, payments splitting, such as marketplaces
// * Company-issued currencies systems, e.g. Twitch Bits
// * In-game currencies, inventories and trading systems, e.g. Fortnite V-Bucks
// * Payment gateways using non-standard assets, e.g. learning credits
// * Local currencies and complementary finance
//
// # Getting started
//
// Formance Ledger works as a standalone binary, the latest of which can be downloaded from the [releases page](https://github.com/formancehq/ledger/releases). You can move the binary to any executable path, such as to `/usr/local/bin`. Installations using brew, apt, yum or docker are also [available](https://docs.formance.com/docs/installation-1).
//
// docker compose up -d
//
// # Submit a first transaction
// curl -X POST http://localhost:3068/quickstart/transactions -d '{"postings": [{"source": "world", "destination": "bank", "amount": 100, "asset": "USD"}]}'
//
// # Get the balances of drivers:042
// curl -X GET http://localhost:3068/quickstart/accounts/bank
//
// # List transactions
// curl -X GET http://localhost:3068/quickstart/transactions
//
// # Documentation
//
// You can find the complete Numary documentation at [docs.formance.com](https://docs.formance.com)
//
// # Community
//
// If you need help, want to show us what you built or just hang out and chat about ledgers you are more than welcome on our [Slack](https://bit.ly/formance-slack) - looking forward to see you there!
//go:generate gomarkdoc --output README.md .
package main

import (
Expand Down

0 comments on commit 06e5151

Please sign in to comment.