Skip to content

Commit

Permalink
chore: pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
gfyrag committed Sep 20, 2024
1 parent 941532e commit 3ecd1df
Show file tree
Hide file tree
Showing 18 changed files with 67 additions and 19 deletions.
3 changes: 2 additions & 1 deletion components/ledger/cmd/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package cmd

import (
"context"
"net/http"

otelpyroscope "github.com/grafana/otel-profiling-go"
"go.opentelemetry.io/otel/trace"
"net/http"

"github.com/formancehq/ledger/internal/api"
ledgercontroller "github.com/formancehq/ledger/internal/controller/ledger"
Expand Down
5 changes: 2 additions & 3 deletions components/ledger/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ require (
github.com/antlr/antlr4/runtime/Go/antlr v1.4.10
github.com/bluele/gcache v0.0.2
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
github.com/formancehq/formance-sdk-go/v2 v2.0.0-00010101000000-000000000000
github.com/formancehq/stack/ledger/client v0.0.0-00010101000000-000000000000
github.com/formancehq/stack/libs/core v0.0.0-00010101000000-000000000000
github.com/formancehq/stack/libs/go-libs v0.0.0-00010101000000-000000000000
Expand All @@ -31,7 +30,6 @@ require (
github.com/jackc/pgx/v5 v5.6.0
github.com/logrusorgru/aurora v2.0.3+incompatible
github.com/onsi/ginkgo/v2 v2.20.2
github.com/onsi/gomega v1.34.2
github.com/pborman/uuid v1.2.1
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.8.1
Expand All @@ -44,7 +42,6 @@ require (
go.opentelemetry.io/otel/trace v1.29.0
go.uber.org/fx v1.22.2
go.uber.org/mock v0.4.0
golang.org/x/oauth2 v0.20.0
)

require (
Expand Down Expand Up @@ -127,6 +124,7 @@ require (
github.com/nats-io/nkeys v0.4.7 // indirect
github.com/nats-io/nuid v1.0.1 // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/onsi/gomega v1.34.2 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0 // indirect
github.com/opencontainers/runc v1.1.14 // indirect
Expand Down Expand Up @@ -181,6 +179,7 @@ require (
go.uber.org/zap v1.27.0 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/oauth2 v0.20.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/text v0.17.0 // indirect
Expand Down
3 changes: 2 additions & 1 deletion components/ledger/internal/api/v2/query.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package v2

import (
"github.com/formancehq/ledger/internal/controller/ledger"
"net/http"

"github.com/formancehq/ledger/internal/controller/ledger"

"github.com/formancehq/stack/libs/go-libs/api"
"github.com/formancehq/stack/libs/go-libs/bun/bunpaginate"

Expand Down
1 change: 1 addition & 0 deletions components/ledger/internal/controller/ledger/compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package ledger
import (
"crypto/sha256"
"encoding/base64"

"github.com/bluele/gcache"
"github.com/formancehq/ledger/internal/machine/script/compiler"
"github.com/formancehq/ledger/internal/machine/vm/program"
Expand Down
5 changes: 3 additions & 2 deletions components/ledger/internal/storage/ledger/moves.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ package ledger

import (
"context"
"math/big"
"slices"

"github.com/formancehq/ledger/internal/opentelemetry/tracer"
"github.com/formancehq/stack/libs/go-libs/bun/bunpaginate"
"github.com/formancehq/stack/libs/go-libs/collectionutils"
"github.com/formancehq/stack/libs/go-libs/platform/postgres"
"github.com/formancehq/stack/libs/go-libs/time"
"github.com/uptrace/bun"
"math/big"
"slices"
)

type Move struct {
Expand Down
6 changes: 6 additions & 0 deletions components/ledger/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1794,6 +1794,12 @@ paths:
description: Use an idempotency key
schema:
type: string
- name: force
in: query
description: Disable balances checks
schema:
type: boolean
example: true
requestBody:
required: true
description: |
Expand Down
3 changes: 3 additions & 0 deletions components/ledger/test/e2e/stress_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build it

package test_suite

import (
Expand Down Expand Up @@ -62,6 +64,7 @@ var _ = Context("Ledger stress tests", func() {
_, err := CreateTransaction(ctx, testServer.GetValue(), operations.V2CreateTransactionRequest{
Ledger: fmt.Sprintf("ledger%d", rand.Intn(countLedgers)),
V2PostTransaction: components.V2PostTransaction{
// todo: add another postings
Postings: []components.V2Posting{{
Source: fmt.Sprintf("accounts:%d", rand.Intn(countAccounts)),
Destination: fmt.Sprintf("accounts:%d", rand.Intn(countAccounts)),
Expand Down
1 change: 1 addition & 0 deletions libs/go-libs/otlp/otlptraces/traces.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package otlptraces

import (
"context"

"github.com/formancehq/stack/libs/go-libs/otlp"
"go.opentelemetry.io/contrib/propagators/b3"
"go.opentelemetry.io/otel"
Expand Down
6 changes: 3 additions & 3 deletions releases/sdks/go/.speakeasy/gen.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
lockVersion: 2.0.0
id: 7eac0a45-60a2-40bb-9e85-26bd77ec2a6d
management:
docChecksum: 9d130f525c61b52a02e540ab298a3262
docChecksum: 7bcc7406d8c12836deeceb41f1c97c51
docVersion: v0.0.0
speakeasyVersion: 1.346.0
generationVersion: 2.379.3
releaseVersion: v0.0.0
configChecksum: 86fb0b4c762641bbbe6b4f59e9dd3989
releaseVersion: 0.0.1
configChecksum: 6bfd58cd58bbce137d68ce4f0a59a45e
features:
go:
additionalDependencies: 0.1.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
| `IdempotencyKey` | **string* | :heavy_minus_sign: | Use an idempotency key | |
| `V2PostTransaction` | [shared.V2PostTransaction](../../../pkg/models/shared/v2posttransaction.md) | :heavy_check_mark: | The request body must contain at least one of the following objects:<br/> - `postings`: suitable for simple transactions<br/> - `script`: enabling more complex transactions with Numscript<br/> | |
| `DryRun` | **bool* | :heavy_minus_sign: | Set the dryRun mode. dry run mode doesn't add the logs to the database or publish a message to the message broker. | true |
| `Force` | **bool* | :heavy_minus_sign: | Disable balances checks | true |
| `Ledger` | *string* | :heavy_check_mark: | Name of the ledger. | ledger001 |
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@

## Fields

| Field | Type | Required | Description | Example |
| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- |
| `AtEffectiveDate` | **bool* | :heavy_minus_sign: | Revert transaction at effective date of the original tx | |
| `Force` | **bool* | :heavy_minus_sign: | Force revert | |
| `ID` | [*big.Int](https://pkg.go.dev/math/big#Int) | :heavy_check_mark: | Transaction ID. | 1234 |
| `Ledger` | *string* | :heavy_check_mark: | Name of the ledger. | ledger001 |
| Field | Type | Required | Description | Example |
| ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
| `AtEffectiveDate` | **bool* | :heavy_minus_sign: | Revert transaction at effective date of the original tx | |
| `DryRun` | **bool* | :heavy_minus_sign: | Set the dry run mode. Dry run mode doesn't add the logs to the database or publish a message to the message broker. | true |
| `Force` | **bool* | :heavy_minus_sign: | Force revert | |
| `ID` | [*big.Int](https://pkg.go.dev/math/big#Int) | :heavy_check_mark: | Transaction ID. | 1234 |
| `Ledger` | *string* | :heavy_check_mark: | Name of the ledger. | ledger001 |
2 changes: 2 additions & 0 deletions releases/sdks/go/docs/sdks/v2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ func main() {
},
},
DryRun: v2.Bool(true),
Force: v2.Bool(true),
Ledger: "ledger001",
}
ctx := context.Background()
Expand Down Expand Up @@ -1441,6 +1442,7 @@ func main() {
}),
)
request := operations.V2RevertTransactionRequest{
DryRun: v2.Bool(true),
ID: big.NewInt(1234),
Ledger: "ledger001",
}
Expand Down
4 changes: 2 additions & 2 deletions releases/sdks/go/formance.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@ func New(opts ...SDKOption) *Formance {
sdkConfiguration: sdkConfiguration{
Language: "go",
OpenAPIDocVersion: "v0.0.0",
SDKVersion: "v0.0.0",
SDKVersion: "0.0.1",
GenVersion: "2.379.3",
UserAgent: "speakeasy-sdk/go v0.0.0 2.379.3 v0.0.0 github.com/formancehq/formance-sdk-go/v2",
UserAgent: "speakeasy-sdk/go 0.0.1 2.379.3 v0.0.0 github.com/formancehq/formance-sdk-go/v2",
Hooks: hooks.New(),
},
}
Expand Down
2 changes: 1 addition & 1 deletion releases/sdks/go/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ generation:
oAuth2ClientCredentialsEnabled: false
telemetryEnabled: false
go:
version: v0.0.0
version: 0.0.1
additionalDependencies: {}
allowUnknownFieldsInWeakUnions: false
author: Formance
Expand Down
9 changes: 9 additions & 0 deletions releases/sdks/go/pkg/models/operations/v2createtransaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ type V2CreateTransactionRequest struct {
V2PostTransaction shared.V2PostTransaction `request:"mediaType=application/json"`
// Set the dryRun mode. dry run mode doesn't add the logs to the database or publish a message to the message broker.
DryRun *bool `queryParam:"style=form,explode=true,name=dryRun"`
// Disable balances checks
Force *bool `queryParam:"style=form,explode=true,name=force"`
// Name of the ledger.
Ledger string `pathParam:"style=simple,explode=false,name=ledger"`
}
Expand All @@ -42,6 +44,13 @@ func (o *V2CreateTransactionRequest) GetDryRun() *bool {
return o.DryRun
}

func (o *V2CreateTransactionRequest) GetForce() *bool {
if o == nil {
return nil
}
return o.Force
}

func (o *V2CreateTransactionRequest) GetLedger() string {
if o == nil {
return ""
Expand Down
9 changes: 9 additions & 0 deletions releases/sdks/go/pkg/models/operations/v2reverttransaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (
type V2RevertTransactionRequest struct {
// Revert transaction at effective date of the original tx
AtEffectiveDate *bool `queryParam:"style=form,explode=true,name=atEffectiveDate"`
// Set the dry run mode. Dry run mode doesn't add the logs to the database or publish a message to the message broker.
DryRun *bool `queryParam:"style=form,explode=true,name=dryRun"`
// Force revert
Force *bool `queryParam:"style=form,explode=true,name=force"`
// Transaction ID.
Expand All @@ -38,6 +40,13 @@ func (o *V2RevertTransactionRequest) GetAtEffectiveDate() *bool {
return o.AtEffectiveDate
}

func (o *V2RevertTransactionRequest) GetDryRun() *bool {
if o == nil {
return nil
}
return o.DryRun
}

func (o *V2RevertTransactionRequest) GetForce() *bool {
if o == nil {
return nil
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ require (
github.com/gorilla/mux v1.8.0 // indirect
github.com/gorilla/schema v1.4.1 // indirect
github.com/gorilla/securecookie v1.1.1 // indirect
github.com/grafana/otel-profiling-go v0.5.1 // indirect
github.com/grafana/pyroscope-go/godeltaprof v0.1.8 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
Expand Down
Loading

0 comments on commit 3ecd1df

Please sign in to comment.