Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
gfyrag committed Sep 27, 2024
1 parent 1aa7f9a commit aca657c
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 8 deletions.
2 changes: 1 addition & 1 deletion internal/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ type Account struct {
UpdatedAt time.Time `json:"-" bun:"updated_at"`
Volumes VolumesByAssets `json:"volumes,omitempty" bun:"pcv,scanonly"`
EffectiveVolumes VolumesByAssets `json:"effectiveVolumes,omitempty" bun:"pcev,scanonly"`
}
}
4 changes: 2 additions & 2 deletions internal/api/v1/controllers_accounts_read.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ func getAccount(w http.ResponseWriter, r *http.Request) {
switch {
case postgres.IsNotFoundError(err):
acc = &ledger.Account{
Address: address,
Metadata: metadata.Metadata{},
Address: address,
Metadata: metadata.Metadata{},
Volumes: ledger.VolumesByAssets{},
EffectiveVolumes: ledger.VolumesByAssets{},
}
Expand Down
3 changes: 2 additions & 1 deletion internal/moves.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package ledger

import (
"slices"

"github.com/formancehq/go-libs/bun/bunpaginate"
"github.com/formancehq/go-libs/collectionutils"
"github.com/formancehq/go-libs/time"
"github.com/uptrace/bun"
"slices"
)

type Move struct {
Expand Down
3 changes: 2 additions & 1 deletion internal/storage/bucket/bucket_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package bucket

import (
systemstore "github.com/formancehq/ledger/internal/storage/system"
"testing"

systemstore "github.com/formancehq/ledger/internal/storage/system"

"github.com/formancehq/go-libs/bun/bunconnect"

"github.com/formancehq/go-libs/logging"
Expand Down
3 changes: 2 additions & 1 deletion internal/storage/ledger/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import (
"context"
"database/sql"
"fmt"
"regexp"

. "github.com/formancehq/go-libs/bun/bunpaginate"
"github.com/formancehq/ledger/internal/tracing"
"regexp"

"github.com/formancehq/go-libs/logging"
"github.com/formancehq/go-libs/metadata"
Expand Down
1 change: 1 addition & 0 deletions internal/storage/ledger/moves.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package ledger

import (
"context"

"github.com/formancehq/go-libs/platform/postgres"
"github.com/formancehq/go-libs/time"
ledger "github.com/formancehq/ledger/internal"
Expand Down
5 changes: 4 additions & 1 deletion internal/storage/ledger/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"database/sql"
"fmt"

"github.com/shomali11/xsql"

"github.com/formancehq/go-libs/platform/postgres"
Expand Down Expand Up @@ -87,7 +88,7 @@ func (s *Store) validateAddressFilter(operator string, value any) error {
return nil
}

// dev util
// nolint:unused
func (s *Store) dumpTables(ctx context.Context, tables ...string) {
for _, table := range tables {
s.dumpQuery(
Expand All @@ -98,6 +99,7 @@ func (s *Store) dumpTables(ctx context.Context, tables ...string) {
}
}

// nolint:unused
func (s *Store) dumpQuery(ctx context.Context, query *bun.SelectQuery) {
fmt.Println(query)
rows, err := query.Rows(ctx)
Expand All @@ -107,6 +109,7 @@ func (s *Store) dumpQuery(ctx context.Context, query *bun.SelectQuery) {
s.dumpRows(rows)
}

// nolint:unused
func (s *Store) dumpRows(rows *sql.Rows) {
data, err := xsql.Pretty(rows)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion internal/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package ledger

import (
"encoding/json"
"github.com/uptrace/bun"
"math/big"
"slices"
"sort"

"github.com/uptrace/bun"

"github.com/formancehq/go-libs/time"

"github.com/formancehq/go-libs/pointer"
Expand Down
19 changes: 19 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1902,6 +1902,12 @@ paths:
description: Use an idempotency key
schema:
type: string
- name: force
in: query
description: Disable balance checks when passing postings
schema:
type: boolean
example: true
requestBody:
required: true
description: |
Expand Down Expand Up @@ -2115,6 +2121,12 @@ paths:
required: false
schema:
type: boolean
- name: dryRun
in: query
description: Set the dryRun mode. dry run mode doesn't add the logs to the database or publish a message to the message broker.
schema:
type: boolean
example: true
responses:
"201":
description: OK
Expand Down Expand Up @@ -3234,6 +3246,9 @@ components:
minimum: 0
reverted:
type: boolean
revertedAt:
type: string
format: date-time
required:
- postings
- timestamp
Expand Down Expand Up @@ -3650,6 +3665,10 @@ components:
type: string
metadata:
$ref: '#/components/schemas/V2Metadata'
features:
type: object
additionalProperties:
type: string
V2Ledger:
type: object
properties:
Expand Down

0 comments on commit aca657c

Please sign in to comment.