Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Use v2 in path #496

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ builds:
- binary: ledger
id: ledger
ldflags:
- -X github.com/formancehq/ledger/cmd.BuildDate={{ .Date }}
- -X github.com/formancehq/ledger/cmd.Version=v{{ .Version }}
- -X github.com/formancehq/ledger/cmd.Commit={{ .ShortCommit }}
- -X github.com/formancehq/ledger/v2/cmd.BuildDate={{ .Date }}
- -X github.com/formancehq/ledger/v2/cmd.Version=v{{ .Version }}
- -X github.com/formancehq/ledger/v2/cmd.Commit={{ .ShortCommit }}
- -extldflags "-static"
env:
- CGO_ENABLED=0
Expand Down
2 changes: 1 addition & 1 deletion cmd/buckets.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"github.com/formancehq/go-libs/bun/bunconnect"
"github.com/formancehq/go-libs/logging"
"github.com/formancehq/go-libs/service"
"github.com/formancehq/ledger/internal/storage/driver"
"github.com/formancehq/ledger/v2/internal/storage/driver"
"github.com/spf13/cobra"
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/formancehq/go-libs/otlp/otlptraces"
"github.com/formancehq/go-libs/publish"
"github.com/formancehq/go-libs/service"
"github.com/formancehq/ledger/internal/engine"
driver "github.com/formancehq/ledger/internal/storage/driver"
"github.com/formancehq/ledger/v2/internal/engine"
driver "github.com/formancehq/ledger/v2/internal/storage/driver"
"github.com/spf13/cobra"
"go.uber.org/fx"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/formancehq/go-libs/otlp/otlpmetrics"
"github.com/formancehq/go-libs/otlp/otlptraces"
"github.com/formancehq/go-libs/publish"
"github.com/formancehq/ledger/internal/storage/systemstore"
"github.com/formancehq/ledger/v2/internal/storage/systemstore"
"github.com/spf13/cobra"
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (

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

"github.com/formancehq/ledger/internal/storage/driver"
"github.com/formancehq/ledger/v2/internal/storage/driver"

"github.com/formancehq/ledger/internal/api"
"github.com/formancehq/ledger/v2/internal/api"

"github.com/formancehq/go-libs/ballast"
"github.com/formancehq/go-libs/httpserver"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/formancehq/ledger
module github.com/formancehq/ledger/v2

go 1.22.0

Expand Down
12 changes: 6 additions & 6 deletions internal/api/backend/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import (

"github.com/formancehq/go-libs/metadata"
"github.com/formancehq/go-libs/migrations"
ledger "github.com/formancehq/ledger/internal"
"github.com/formancehq/ledger/internal/engine"
"github.com/formancehq/ledger/internal/engine/command"
"github.com/formancehq/ledger/internal/storage/driver"
"github.com/formancehq/ledger/internal/storage/ledgerstore"
"github.com/formancehq/ledger/internal/storage/systemstore"
ledger "github.com/formancehq/ledger/v2/internal"
"github.com/formancehq/ledger/v2/internal/engine"
"github.com/formancehq/ledger/v2/internal/engine/command"
"github.com/formancehq/ledger/v2/internal/storage/driver"
"github.com/formancehq/ledger/v2/internal/storage/ledgerstore"
"github.com/formancehq/ledger/v2/internal/storage/systemstore"
)

//go:generate mockgen -source backend.go -destination backend_generated.go -package backend . Ledger
Expand Down
12 changes: 6 additions & 6 deletions internal/api/backend/backend_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions internal/api/backend/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import (

"github.com/go-chi/chi/v5"

"github.com/formancehq/ledger/internal/storage/sqlutils"
"github.com/formancehq/ledger/v2/internal/storage/sqlutils"

sharedapi "github.com/formancehq/go-libs/api"

"github.com/pkg/errors"

"github.com/formancehq/go-libs/logging"
"github.com/formancehq/ledger/internal/opentelemetry/tracer"
"github.com/formancehq/ledger/v2/internal/opentelemetry/tracer"
)

var (
Expand Down
8 changes: 4 additions & 4 deletions internal/api/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (

"github.com/formancehq/go-libs/auth"
"github.com/formancehq/go-libs/health"
"github.com/formancehq/ledger/internal/api/backend"
"github.com/formancehq/ledger/internal/engine"
"github.com/formancehq/ledger/internal/opentelemetry/metrics"
"github.com/formancehq/ledger/internal/storage/driver"
"github.com/formancehq/ledger/v2/internal/api/backend"
"github.com/formancehq/ledger/v2/internal/engine"
"github.com/formancehq/ledger/v2/internal/opentelemetry/metrics"
"github.com/formancehq/ledger/v2/internal/storage/driver"
"go.opentelemetry.io/otel/metric"
"go.opentelemetry.io/otel/metric/noop"
"go.uber.org/fx"
Expand Down
8 changes: 4 additions & 4 deletions internal/api/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (

"github.com/formancehq/go-libs/auth"
"github.com/formancehq/go-libs/health"
"github.com/formancehq/ledger/internal/api/backend"
v1 "github.com/formancehq/ledger/internal/api/v1"
v2 "github.com/formancehq/ledger/internal/api/v2"
"github.com/formancehq/ledger/internal/opentelemetry/metrics"
"github.com/formancehq/ledger/v2/internal/api/backend"
v1 "github.com/formancehq/ledger/v2/internal/api/v1"
v2 "github.com/formancehq/ledger/v2/internal/api/v2"
"github.com/formancehq/ledger/v2/internal/opentelemetry/metrics"
)

func NewRouter(
Expand Down
4 changes: 2 additions & 2 deletions internal/api/v1/api_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package v1_test
import (
"testing"

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

"github.com/formancehq/ledger/internal/api/backend"
"github.com/formancehq/ledger/v2/internal/api/backend"
"go.uber.org/mock/gomock"
)

Expand Down
10 changes: 5 additions & 5 deletions internal/api/v1/controllers_accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@ import (
"strconv"
"strings"

"github.com/formancehq/ledger/pkg/core/accounts"
"github.com/formancehq/ledger/v2/pkg/core/accounts"

"github.com/go-chi/chi/v5"

storageerrors "github.com/formancehq/ledger/internal/storage/sqlutils"
storageerrors "github.com/formancehq/ledger/v2/internal/storage/sqlutils"

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

"github.com/formancehq/go-libs/bun/bunpaginate"
"github.com/formancehq/ledger/internal/api/backend"
"github.com/formancehq/ledger/v2/internal/api/backend"
"github.com/pkg/errors"

sharedapi "github.com/formancehq/go-libs/api"
"github.com/formancehq/go-libs/metadata"
"github.com/formancehq/go-libs/query"
ledger "github.com/formancehq/ledger/internal"
"github.com/formancehq/ledger/internal/storage/ledgerstore"
ledger "github.com/formancehq/ledger/v2/internal"
"github.com/formancehq/ledger/v2/internal/storage/ledgerstore"
)

type accountWithVolumesAndBalances ledger.ExpandedAccount
Expand Down
10 changes: 5 additions & 5 deletions internal/api/v1/controllers_accounts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import (
sharedapi "github.com/formancehq/go-libs/api"
"github.com/formancehq/go-libs/metadata"
"github.com/formancehq/go-libs/query"
ledger "github.com/formancehq/ledger/internal"
v1 "github.com/formancehq/ledger/internal/api/v1"
"github.com/formancehq/ledger/internal/engine/command"
"github.com/formancehq/ledger/internal/opentelemetry/metrics"
"github.com/formancehq/ledger/internal/storage/ledgerstore"
ledger "github.com/formancehq/ledger/v2/internal"
v1 "github.com/formancehq/ledger/v2/internal/api/v1"
"github.com/formancehq/ledger/v2/internal/engine/command"
"github.com/formancehq/ledger/v2/internal/opentelemetry/metrics"
"github.com/formancehq/ledger/v2/internal/storage/ledgerstore"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
)
Expand Down
4 changes: 2 additions & 2 deletions internal/api/v1/controllers_balances.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (

sharedapi "github.com/formancehq/go-libs/api"
"github.com/formancehq/go-libs/query"
"github.com/formancehq/ledger/internal/api/backend"
"github.com/formancehq/ledger/internal/storage/ledgerstore"
"github.com/formancehq/ledger/v2/internal/api/backend"
"github.com/formancehq/ledger/v2/internal/storage/ledgerstore"
)

func buildAggregatedBalancesQuery(r *http.Request) (query.Builder, error) {
Expand Down
8 changes: 4 additions & 4 deletions internal/api/v1/controllers_balances_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import (
sharedapi "github.com/formancehq/go-libs/api"
"github.com/formancehq/go-libs/auth"
"github.com/formancehq/go-libs/query"
ledger "github.com/formancehq/ledger/internal"
v1 "github.com/formancehq/ledger/internal/api/v1"
"github.com/formancehq/ledger/internal/opentelemetry/metrics"
"github.com/formancehq/ledger/internal/storage/ledgerstore"
ledger "github.com/formancehq/ledger/v2/internal"
v1 "github.com/formancehq/ledger/v2/internal/api/v1"
"github.com/formancehq/ledger/v2/internal/opentelemetry/metrics"
"github.com/formancehq/ledger/v2/internal/storage/ledgerstore"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
)
Expand Down
4 changes: 2 additions & 2 deletions internal/api/v1/controllers_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import (
"github.com/formancehq/go-libs/bun/bunpaginate"

"github.com/formancehq/go-libs/collectionutils"
"github.com/formancehq/ledger/internal/storage/systemstore"
"github.com/formancehq/ledger/v2/internal/storage/systemstore"

sharedapi "github.com/formancehq/go-libs/api"
"github.com/formancehq/ledger/internal/api/backend"
"github.com/formancehq/ledger/v2/internal/api/backend"
)

type ConfigInfo struct {
Expand Down
6 changes: 3 additions & 3 deletions internal/api/v1/controllers_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import (

sharedapi "github.com/formancehq/go-libs/api"
"github.com/formancehq/go-libs/auth"
v1 "github.com/formancehq/ledger/internal/api/v1"
v1 "github.com/formancehq/ledger/v2/internal/api/v1"

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

"github.com/formancehq/ledger/internal/opentelemetry/metrics"
"github.com/formancehq/ledger/v2/internal/opentelemetry/metrics"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
)
Expand Down
6 changes: 3 additions & 3 deletions internal/api/v1/controllers_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import (
"github.com/go-chi/chi/v5"

"github.com/formancehq/go-libs/bun/bunpaginate"
"github.com/formancehq/ledger/internal/api/backend"
"github.com/formancehq/ledger/internal/engine"
"github.com/formancehq/ledger/v2/internal/api/backend"
"github.com/formancehq/ledger/v2/internal/engine"
"github.com/pkg/errors"

sharedapi "github.com/formancehq/go-libs/api"
"github.com/formancehq/go-libs/migrations"
"github.com/formancehq/go-libs/query"
"github.com/formancehq/ledger/internal/storage/ledgerstore"
"github.com/formancehq/ledger/v2/internal/storage/ledgerstore"
)

type Info struct {
Expand Down
10 changes: 5 additions & 5 deletions internal/api/v1/controllers_info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ import (
"github.com/formancehq/go-libs/metadata"
"github.com/formancehq/go-libs/migrations"
"github.com/formancehq/go-libs/query"
ledger "github.com/formancehq/ledger/internal"
v1 "github.com/formancehq/ledger/internal/api/v1"
"github.com/formancehq/ledger/internal/engine"
"github.com/formancehq/ledger/internal/opentelemetry/metrics"
"github.com/formancehq/ledger/internal/storage/ledgerstore"
ledger "github.com/formancehq/ledger/v2/internal"
v1 "github.com/formancehq/ledger/v2/internal/api/v1"
"github.com/formancehq/ledger/v2/internal/engine"
"github.com/formancehq/ledger/v2/internal/opentelemetry/metrics"
"github.com/formancehq/ledger/v2/internal/storage/ledgerstore"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
)
Expand Down
14 changes: 7 additions & 7 deletions internal/api/v1/controllers_transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ import (
"github.com/formancehq/go-libs/pointer"

"github.com/formancehq/go-libs/bun/bunpaginate"
"github.com/formancehq/ledger/internal/api/backend"
"github.com/formancehq/ledger/internal/engine"
"github.com/formancehq/ledger/internal/engine/command"
"github.com/formancehq/ledger/internal/machine"
storageerrors "github.com/formancehq/ledger/internal/storage/sqlutils"
"github.com/formancehq/ledger/v2/internal/api/backend"
"github.com/formancehq/ledger/v2/internal/engine"
"github.com/formancehq/ledger/v2/internal/engine/command"
"github.com/formancehq/ledger/v2/internal/machine"
storageerrors "github.com/formancehq/ledger/v2/internal/storage/sqlutils"
"github.com/pkg/errors"

sharedapi "github.com/formancehq/go-libs/api"
"github.com/formancehq/go-libs/collectionutils"
"github.com/formancehq/go-libs/metadata"
"github.com/formancehq/go-libs/query"
ledger "github.com/formancehq/ledger/internal"
"github.com/formancehq/ledger/internal/storage/ledgerstore"
ledger "github.com/formancehq/ledger/v2/internal"
"github.com/formancehq/ledger/v2/internal/storage/ledgerstore"
)

func mapTransactionToV1(tx ledger.Transaction) any {
Expand Down
10 changes: 5 additions & 5 deletions internal/api/v1/controllers_transactions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ import (
sharedapi "github.com/formancehq/go-libs/api"
"github.com/formancehq/go-libs/metadata"
"github.com/formancehq/go-libs/query"
ledger "github.com/formancehq/ledger/internal"
v1 "github.com/formancehq/ledger/internal/api/v1"
"github.com/formancehq/ledger/internal/engine/command"
"github.com/formancehq/ledger/internal/opentelemetry/metrics"
"github.com/formancehq/ledger/internal/storage/ledgerstore"
ledger "github.com/formancehq/ledger/v2/internal"
v1 "github.com/formancehq/ledger/v2/internal/api/v1"
"github.com/formancehq/ledger/v2/internal/engine/command"
"github.com/formancehq/ledger/v2/internal/opentelemetry/metrics"
"github.com/formancehq/ledger/v2/internal/storage/ledgerstore"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
)
Expand Down
6 changes: 3 additions & 3 deletions internal/api/v1/middleware_auto_create_ledger.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"github.com/go-chi/chi/v5"

sharedapi "github.com/formancehq/go-libs/api"
"github.com/formancehq/ledger/internal/api/backend"
"github.com/formancehq/ledger/internal/storage/driver"
"github.com/formancehq/ledger/internal/storage/sqlutils"
"github.com/formancehq/ledger/v2/internal/api/backend"
"github.com/formancehq/ledger/v2/internal/storage/driver"
"github.com/formancehq/ledger/v2/internal/storage/sqlutils"
)

func autoCreateMiddleware(backend backend.Backend) func(handler http.Handler) http.Handler {
Expand Down
2 changes: 1 addition & 1 deletion internal/api/v1/middlewares_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

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

"github.com/formancehq/ledger/internal/opentelemetry/metrics"
"github.com/formancehq/ledger/v2/internal/opentelemetry/metrics"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/metric"
)
Expand Down
4 changes: 2 additions & 2 deletions internal/api/v1/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (

"github.com/formancehq/go-libs/auth"
"github.com/formancehq/go-libs/health"
"github.com/formancehq/ledger/internal/api/backend"
"github.com/formancehq/ledger/internal/opentelemetry/metrics"
"github.com/formancehq/ledger/v2/internal/api/backend"
"github.com/formancehq/ledger/v2/internal/opentelemetry/metrics"
"github.com/go-chi/chi/v5/middleware"
"github.com/go-chi/cors"
)
Expand Down
4 changes: 2 additions & 2 deletions internal/api/v1/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"github.com/formancehq/go-libs/collectionutils"
"github.com/formancehq/go-libs/pointer"
"github.com/formancehq/go-libs/query"
"github.com/formancehq/ledger/internal/engine/command"
"github.com/formancehq/ledger/internal/storage/ledgerstore"
"github.com/formancehq/ledger/v2/internal/engine/command"
"github.com/formancehq/ledger/v2/internal/storage/ledgerstore"
)

func getPITFilter(r *http.Request) (*ledgerstore.PITFilter, error) {
Expand Down
2 changes: 1 addition & 1 deletion internal/api/v2/api_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"go.uber.org/mock/gomock"

"github.com/formancehq/ledger/internal/api/backend"
"github.com/formancehq/ledger/v2/internal/api/backend"
)

func newTestingBackend(t *testing.T, expectedSchemaCheck bool) (*backend.MockBackend, *backend.MockLedger) {
Expand Down
Loading