From 783d5f682cdcab1fd91b233f3f826fb9c99a6c12 Mon Sep 17 00:00:00 2001 From: Ragot Geoffrey Date: Fri, 13 Oct 2023 16:47:15 +0200 Subject: [PATCH] feat: add a sql connection pool by ledger (#637) Co-authored-by: Geoffrey --- cmd/container.go | 3 - cmd/storage.go | 21 +-- go.mod | 2 - go.sum | 10 -- internal/analytics/analytics_test.go | 6 +- internal/analytics/backend.go | 8 +- internal/analytics/backend_test.go | 26 ++-- internal/api/backend/backend.go | 4 +- internal/api/backend/backend_generated.go | 8 +- internal/api/v1/controllers_accounts_test.go | 2 +- internal/api/v1/controllers_balances_test.go | 2 +- internal/api/v1/controllers_config_test.go | 2 +- internal/api/v1/controllers_info_test.go | 2 +- .../api/v1/controllers_transactions_test.go | 4 +- internal/api/v2/controllers_accounts_test.go | 2 +- internal/api/v2/controllers_balances_test.go | 2 +- internal/api/v2/controllers_config_test.go | 2 +- internal/api/v2/controllers_info_test.go | 2 +- .../api/v2/controllers_transactions_test.go | 4 +- internal/engine/ledger.go | 17 ++- internal/engine/stats.go | 4 +- .../machine/script/parser/NumScript.interp | 2 +- .../script/parser/NumScriptLexer.interp | 2 +- internal/storage/driver/cli.go | 30 ++--- internal/storage/driver/driver.go | 125 +++++++++--------- internal/storage/ledgerstore/accounts.go | 2 +- internal/storage/ledgerstore/logs.go | 1 + internal/storage/ledgerstore/main_test.go | 15 +-- internal/storage/ledgerstore/transactions.go | 2 +- .../storage/ledgerstore/transactions_test.go | 2 +- internal/storage/ledgerstore/utils.go | 62 +++------ internal/storage/storagetesting/storage.go | 9 +- libs/go.mod | 4 +- libs/go.sum | 8 +- libs/query/expression.go | 4 + 35 files changed, 176 insertions(+), 225 deletions(-) diff --git a/cmd/container.go b/cmd/container.go index e95cdc49e..50308b755 100644 --- a/cmd/container.go +++ b/cmd/container.go @@ -22,9 +22,6 @@ func resolveOptions(output io.Writer, userOptions ...fx.Option) []fx.Option { v := viper.GetViper() debug := v.GetBool(service.DebugFlag) - if debug { - driver.InstrumentalizeSQLDriver() - } options = append(options, publish.CLIPublisherModule(v, ServiceName), diff --git a/cmd/storage.go b/cmd/storage.go index 54cc5e249..eacb83e5a 100644 --- a/cmd/storage.go +++ b/cmd/storage.go @@ -118,16 +118,13 @@ func NewStorageUpgrade() *cobra.Command { SilenceUsage: true, RunE: func(cmd *cobra.Command, args []string) error { - sqlDB, err := storage.OpenSQLDB(storage.ConnectionOptionsFromFlags(viper.GetViper(), cmd.OutOrStdout(), viper.GetBool(service.DebugFlag))) - if err != nil { - return err - } - defer sqlDB.Close() - - driver := driver.New(sqlDB) + driver := driver.New(storage.ConnectionOptionsFromFlags(viper.GetViper(), cmd.OutOrStdout(), viper.GetBool(service.DebugFlag))) if err := driver.Initialize(cmd.Context()); err != nil { return err } + defer func() { + _ = driver.Close() + }() name := args[0] store, err := driver.GetLedgerStore(cmd.Context(), name) @@ -152,17 +149,11 @@ func NewStorageUpgradeAll() *cobra.Command { logger := service.GetDefaultLogger(cmd.OutOrStdout(), viper.GetBool(service.DebugFlag), false) ctx := logging.ContextWithLogger(cmd.Context(), logger) - sqlDB, err := storage.OpenSQLDB(storage.ConnectionOptionsFromFlags(viper.GetViper(), cmd.OutOrStdout(), viper.GetBool(service.DebugFlag))) - if err != nil { - return err - } + driver := driver.New(storage.ConnectionOptionsFromFlags(viper.GetViper(), cmd.OutOrStdout(), viper.GetBool(service.DebugFlag))) defer func() { - if err := sqlDB.Close(); err != nil { - logger.Errorf("Error closing database: %s", err) - } + _ = driver.Close() }() - driver := driver.New(sqlDB) if err := driver.Initialize(ctx); err != nil { return err } diff --git a/go.mod b/go.mod index 52838b7cc..57d466ebf 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,6 @@ require ( github.com/formancehq/stack/libs/go-libs v0.0.0-20230517212829-71aaaacfd130 github.com/go-chi/chi/v5 v5.0.8 github.com/go-chi/cors v1.2.1 - github.com/golang/mock v1.4.4 github.com/google/go-cmp v0.5.9 github.com/google/uuid v1.3.0 github.com/jackc/pgx/v5 v5.3.0 @@ -28,7 +27,6 @@ require ( github.com/uptrace/bun v1.1.14 github.com/uptrace/bun/dialect/pgdialect v1.1.14 github.com/uptrace/bun/extra/bunotel v1.1.14 - go.nhat.io/otelsql v0.11.0 go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/metric v1.16.0 go.opentelemetry.io/otel/trace v1.16.0 diff --git a/go.sum b/go.sum index f7cecec7a..60e435678 100644 --- a/go.sum +++ b/go.sum @@ -40,7 +40,6 @@ github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOEl github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60= github.com/Masterminds/semver/v3 v3.2.0 h1:3MEsd0SM6jqZojhjLWWeBY+Kcjy9i6MQAeY7YgDP83g= github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg= @@ -75,7 +74,6 @@ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+Ce github.com/bluele/gcache v0.0.2 h1:WcbfdXICg7G/DGBh1PFfcirkWOQV+v077yF1pSy3DGw= github.com/bluele/gcache v0.0.2/go.mod h1:m15KV+ECjptwSPxKhOhQoAFQVtUFjTVkc3H8o0t/fp0= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY= -github.com/bool64/shared v0.1.5 h1:fp3eUhBsrSjNCQPcSdQqZxxh9bBwrYiZ+zOKFkM0/2E= github.com/cenkalti/backoff/v3 v3.0.0/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs= github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= @@ -185,7 +183,6 @@ github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFU github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4 h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -266,7 +263,6 @@ github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/iancoleman/orderedmap v0.2.0 h1:sq1N/TFpYH++aViPcaKjys3bDClUEU7s5B+z6jq8pNA= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= @@ -393,7 +389,6 @@ github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD github.com/seccomp/libseccomp-golang v0.9.2-0.20220502022130-f33da4d89646/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg= github.com/segmentio/backo-go v1.0.1 h1:68RQccglxZeyURy93ASB/2kc9QudzgIDexJ927N++y4= github.com/segmentio/backo-go v1.0.1/go.mod h1:9/Rh6yILuLysoQnZ2oNooD2g7aBnvM7r/fNVxRNWfBc= -github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= github.com/shirou/gopsutil/v3 v3.23.4 h1:hZwmDxZs7Ewt75DV81r4pFMqbq+di2cbt9FsQBqLD2o= github.com/shirou/gopsutil/v3 v3.23.4/go.mod h1:ZcGxyfzAMRevhUR2+cfhXDH6gQdFYE/t8j1nsU4mPI8= github.com/shoenig/go-m1cpu v0.1.5 h1:LF57Z/Fpb/WdGLjt2HZilNnmZOxg/q2bSKTQhgbrLrQ= @@ -437,7 +432,6 @@ github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gt github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= -github.com/swaggest/assertjson v1.8.1 h1:Be2EHY9S2qwKWV+xWZB747Cd7Y79YK6JLdeyrgFvyMo= github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/tklauser/go-sysconf v0.3.11 h1:89WgdJhk5SNwJfu+GKyYveZ4IaJ7xAkecBo+KdJV0CM= github.com/tklauser/go-sysconf v0.3.11/go.mod h1:GqXfhXY3kiPa0nAXPDIQIWzJbMCB7AmcWpGR8lSZfqI= @@ -480,8 +474,6 @@ github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17 github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= github.com/xtgo/uuid v0.0.0-20140804021211-a0b114877d4c h1:3lbZUMbMiGUW/LMkfsEABsc5zNT9+b1CvsJx47JzJ8g= github.com/xtgo/uuid v0.0.0-20140804021211-a0b114877d4c/go.mod h1:UrdRz5enIKZ63MEE3IF9l2/ebyx59GyGgPi+tICQdmM= -github.com/yudai/gojsondiff v1.0.0 h1:27cbfqXLVEJ1o8I6v3y9lg8Ydm53EKqHXAOMxEGlCOA= -github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 h1:BHyfKlQyqbsFN5p3IfnEUduWvb9is428/nNb5L3U01M= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -489,8 +481,6 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg= github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= -go.nhat.io/otelsql v0.11.0 h1:wUrIKv6+YioYbArKLrfs3txmOjNGUNws2/eE0FzlVCo= -go.nhat.io/otelsql v0.11.0/go.mod h1:sh4rZG+McDPlmGy1hTGchPHIkMqmLpuy37Bnu3cmqhU= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= diff --git a/internal/analytics/analytics_test.go b/internal/analytics/analytics_test.go index 4fbbae14e..a0c4fc07e 100644 --- a/internal/analytics/analytics_test.go +++ b/internal/analytics/analytics_test.go @@ -11,8 +11,8 @@ import ( "testing" "time" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "gopkg.in/segmentio/analytics-go.v3" ) @@ -150,12 +150,12 @@ func TestAnalytics(t *testing.T) { EXPECT(). CountTransactions(gomock.Any()). AnyTimes(). - Return(uint64(10), nil) + Return(10, nil) mockLedger. EXPECT(). CountAccounts(gomock.Any()). AnyTimes(). - Return(uint64(20), nil) + Return(20, nil) h := newHeartbeat(backend, analyticsClient, version, interval) go func() { diff --git a/internal/analytics/backend.go b/internal/analytics/backend.go index 951803d1a..0109aa869 100644 --- a/internal/analytics/backend.go +++ b/internal/analytics/backend.go @@ -13,19 +13,19 @@ import ( //go:generate mockgen -source backend.go -destination backend_test.go -package analytics . Ledger type Ledger interface { - CountTransactions(ctx context.Context) (uint64, error) - CountAccounts(ctx context.Context) (uint64, error) + CountTransactions(ctx context.Context) (int, error) + CountAccounts(ctx context.Context) (int, error) } type defaultLedger struct { store *ledgerstore.Store } -func (d defaultLedger) CountTransactions(ctx context.Context) (uint64, error) { +func (d defaultLedger) CountTransactions(ctx context.Context) (int, error) { return d.store.CountTransactions(ctx, ledgerstore.NewGetTransactionsQuery(ledgerstore.NewPaginatedQueryOptions(ledgerstore.PITFilterWithVolumes{}))) } -func (d defaultLedger) CountAccounts(ctx context.Context) (uint64, error) { +func (d defaultLedger) CountAccounts(ctx context.Context) (int, error) { return d.store.CountAccounts(ctx, ledgerstore.NewGetAccountsQuery(ledgerstore.NewPaginatedQueryOptions(ledgerstore.PITFilterWithVolumes{}))) } diff --git a/internal/analytics/backend_test.go b/internal/analytics/backend_test.go index f91aa5326..5040d0fce 100644 --- a/internal/analytics/backend_test.go +++ b/internal/analytics/backend_test.go @@ -1,6 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: backend.go - +// +// Generated by this command: +// +// mockgen -source backend.go -destination backend_test.go -package analytics . Ledger +// // Package analytics is a generated GoMock package. package analytics @@ -8,7 +12,7 @@ import ( context "context" reflect "reflect" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockLedger is a mock of Ledger interface. @@ -35,31 +39,31 @@ func (m *MockLedger) EXPECT() *MockLedgerMockRecorder { } // CountAccounts mocks base method. -func (m *MockLedger) CountAccounts(ctx context.Context) (uint64, error) { +func (m *MockLedger) CountAccounts(ctx context.Context) (int, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CountAccounts", ctx) - ret0, _ := ret[0].(uint64) + ret0, _ := ret[0].(int) ret1, _ := ret[1].(error) return ret0, ret1 } // CountAccounts indicates an expected call of CountAccounts. -func (mr *MockLedgerMockRecorder) CountAccounts(ctx interface{}) *gomock.Call { +func (mr *MockLedgerMockRecorder) CountAccounts(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CountAccounts", reflect.TypeOf((*MockLedger)(nil).CountAccounts), ctx) } // CountTransactions mocks base method. -func (m *MockLedger) CountTransactions(ctx context.Context) (uint64, error) { +func (m *MockLedger) CountTransactions(ctx context.Context) (int, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CountTransactions", ctx) - ret0, _ := ret[0].(uint64) + ret0, _ := ret[0].(int) ret1, _ := ret[1].(error) return ret0, ret1 } // CountTransactions indicates an expected call of CountTransactions. -func (mr *MockLedgerMockRecorder) CountTransactions(ctx interface{}) *gomock.Call { +func (mr *MockLedgerMockRecorder) CountTransactions(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CountTransactions", reflect.TypeOf((*MockLedger)(nil).CountTransactions), ctx) } @@ -97,7 +101,7 @@ func (m *MockBackend) AppID(ctx context.Context) (string, error) { } // AppID indicates an expected call of AppID. -func (mr *MockBackendMockRecorder) AppID(ctx interface{}) *gomock.Call { +func (mr *MockBackendMockRecorder) AppID(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppID", reflect.TypeOf((*MockBackend)(nil).AppID), ctx) } @@ -112,7 +116,7 @@ func (m *MockBackend) GetLedgerStore(ctx context.Context, l string) (Ledger, err } // GetLedgerStore indicates an expected call of GetLedgerStore. -func (mr *MockBackendMockRecorder) GetLedgerStore(ctx, l interface{}) *gomock.Call { +func (mr *MockBackendMockRecorder) GetLedgerStore(ctx, l any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLedgerStore", reflect.TypeOf((*MockBackend)(nil).GetLedgerStore), ctx, l) } @@ -127,7 +131,7 @@ func (m *MockBackend) ListLedgers(ctx context.Context) ([]string, error) { } // ListLedgers indicates an expected call of ListLedgers. -func (mr *MockBackendMockRecorder) ListLedgers(ctx interface{}) *gomock.Call { +func (mr *MockBackendMockRecorder) ListLedgers(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListLedgers", reflect.TypeOf((*MockBackend)(nil).ListLedgers), ctx) } diff --git a/internal/api/backend/backend.go b/internal/api/backend/backend.go index 16bbb0782..177f1146c 100644 --- a/internal/api/backend/backend.go +++ b/internal/api/backend/backend.go @@ -19,12 +19,12 @@ import ( type Ledger interface { GetAccountWithVolumes(ctx context.Context, query ledgerstore.GetAccountQuery) (*ledger.ExpandedAccount, error) GetAccountsWithVolumes(ctx context.Context, query *ledgerstore.GetAccountsQuery) (*api.Cursor[ledger.ExpandedAccount], error) - CountAccounts(ctx context.Context, query *ledgerstore.GetAccountsQuery) (uint64, error) + CountAccounts(ctx context.Context, query *ledgerstore.GetAccountsQuery) (int, error) GetAggregatedBalances(ctx context.Context, q *ledgerstore.GetAggregatedBalanceQuery) (ledger.BalancesByAssets, error) GetMigrationsInfo(ctx context.Context) ([]migrations.Info, error) Stats(ctx context.Context) (engine.Stats, error) GetLogs(ctx context.Context, query *ledgerstore.GetLogsQuery) (*api.Cursor[ledger.ChainedLog], error) - CountTransactions(ctx context.Context, query *ledgerstore.GetTransactionsQuery) (uint64, error) + CountTransactions(ctx context.Context, query *ledgerstore.GetTransactionsQuery) (int, error) GetTransactions(ctx context.Context, query *ledgerstore.GetTransactionsQuery) (*api.Cursor[ledger.ExpandedTransaction], error) GetTransactionWithVolumes(ctx context.Context, query ledgerstore.GetTransactionQuery) (*ledger.ExpandedTransaction, error) diff --git a/internal/api/backend/backend_generated.go b/internal/api/backend/backend_generated.go index 7744d4ca9..86dae6aaa 100644 --- a/internal/api/backend/backend_generated.go +++ b/internal/api/backend/backend_generated.go @@ -47,10 +47,10 @@ func (m *MockLedger) EXPECT() *MockLedgerMockRecorder { } // CountAccounts mocks base method. -func (m *MockLedger) CountAccounts(ctx context.Context, query *ledgerstore.GetAccountsQuery) (uint64, error) { +func (m *MockLedger) CountAccounts(ctx context.Context, query *ledgerstore.GetAccountsQuery) (int, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CountAccounts", ctx, query) - ret0, _ := ret[0].(uint64) + ret0, _ := ret[0].(int) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -62,10 +62,10 @@ func (mr *MockLedgerMockRecorder) CountAccounts(ctx, query any) *gomock.Call { } // CountTransactions mocks base method. -func (m *MockLedger) CountTransactions(ctx context.Context, query *ledgerstore.GetTransactionsQuery) (uint64, error) { +func (m *MockLedger) CountTransactions(ctx context.Context, query *ledgerstore.GetTransactionsQuery) (int, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CountTransactions", ctx, query) - ret0, _ := ret[0].(uint64) + ret0, _ := ret[0].(int) ret1, _ := ret[1].(error) return ret0, ret1 } diff --git a/internal/api/v1/controllers_accounts_test.go b/internal/api/v1/controllers_accounts_test.go index 833947b61..8cd416432 100644 --- a/internal/api/v1/controllers_accounts_test.go +++ b/internal/api/v1/controllers_accounts_test.go @@ -15,8 +15,8 @@ import ( sharedapi "github.com/formancehq/stack/libs/go-libs/api" "github.com/formancehq/stack/libs/go-libs/metadata" "github.com/formancehq/stack/libs/go-libs/query" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" ) func TestGetAccounts(t *testing.T) { diff --git a/internal/api/v1/controllers_balances_test.go b/internal/api/v1/controllers_balances_test.go index 797878e8f..fbbccd473 100644 --- a/internal/api/v1/controllers_balances_test.go +++ b/internal/api/v1/controllers_balances_test.go @@ -13,8 +13,8 @@ import ( "github.com/formancehq/ledger/internal/storage/ledgerstore" sharedapi "github.com/formancehq/stack/libs/go-libs/api" "github.com/formancehq/stack/libs/go-libs/query" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" ) func TestGetBalancesAggregated(t *testing.T) { diff --git a/internal/api/v1/controllers_config_test.go b/internal/api/v1/controllers_config_test.go index 698bc1167..c5123def6 100644 --- a/internal/api/v1/controllers_config_test.go +++ b/internal/api/v1/controllers_config_test.go @@ -8,8 +8,8 @@ import ( v2 "github.com/formancehq/ledger/internal/api/v2" "github.com/formancehq/ledger/internal/opentelemetry/metrics" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" ) func TestGetInfo(t *testing.T) { diff --git a/internal/api/v1/controllers_info_test.go b/internal/api/v1/controllers_info_test.go index 2c988216a..d0b849dea 100644 --- a/internal/api/v1/controllers_info_test.go +++ b/internal/api/v1/controllers_info_test.go @@ -18,8 +18,8 @@ import ( "github.com/formancehq/stack/libs/go-libs/metadata" "github.com/formancehq/stack/libs/go-libs/migrations" "github.com/formancehq/stack/libs/go-libs/query" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" ) func TestGetLedgerInfo(t *testing.T) { diff --git a/internal/api/v1/controllers_transactions_test.go b/internal/api/v1/controllers_transactions_test.go index 1ca08056e..94968fa57 100644 --- a/internal/api/v1/controllers_transactions_test.go +++ b/internal/api/v1/controllers_transactions_test.go @@ -16,8 +16,8 @@ import ( sharedapi "github.com/formancehq/stack/libs/go-libs/api" "github.com/formancehq/stack/libs/go-libs/metadata" "github.com/formancehq/stack/libs/go-libs/query" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" ) func TestPostTransactions(t *testing.T) { @@ -576,7 +576,7 @@ func TestCountTransactions(t *testing.T) { if testCase.expectStatusCode < 300 && testCase.expectStatusCode >= 200 { mockLedger.EXPECT(). CountTransactions(gomock.Any(), ledgerstore.NewGetTransactionsQuery(testCase.expectQuery)). - Return(uint64(10), nil) + Return(10, nil) } router := v1.NewRouter(backend, nil, metrics.NewNoOpRegistry()) diff --git a/internal/api/v2/controllers_accounts_test.go b/internal/api/v2/controllers_accounts_test.go index 983bf84d5..07b7f5c1a 100644 --- a/internal/api/v2/controllers_accounts_test.go +++ b/internal/api/v2/controllers_accounts_test.go @@ -18,8 +18,8 @@ import ( sharedapi "github.com/formancehq/stack/libs/go-libs/api" "github.com/formancehq/stack/libs/go-libs/metadata" "github.com/formancehq/stack/libs/go-libs/query" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" ) func TestGetAccounts(t *testing.T) { diff --git a/internal/api/v2/controllers_balances_test.go b/internal/api/v2/controllers_balances_test.go index 36c1e9b76..f47c1591b 100644 --- a/internal/api/v2/controllers_balances_test.go +++ b/internal/api/v2/controllers_balances_test.go @@ -14,8 +14,8 @@ import ( "github.com/formancehq/ledger/internal/storage/ledgerstore" sharedapi "github.com/formancehq/stack/libs/go-libs/api" "github.com/formancehq/stack/libs/go-libs/query" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" ) func TestGetBalancesAggregated(t *testing.T) { diff --git a/internal/api/v2/controllers_config_test.go b/internal/api/v2/controllers_config_test.go index c2fe56c3b..88d74b1cd 100644 --- a/internal/api/v2/controllers_config_test.go +++ b/internal/api/v2/controllers_config_test.go @@ -8,8 +8,8 @@ import ( v2 "github.com/formancehq/ledger/internal/api/v2" "github.com/formancehq/ledger/internal/opentelemetry/metrics" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" ) func TestGetInfo(t *testing.T) { diff --git a/internal/api/v2/controllers_info_test.go b/internal/api/v2/controllers_info_test.go index 7e15d82cf..0775b9c0d 100644 --- a/internal/api/v2/controllers_info_test.go +++ b/internal/api/v2/controllers_info_test.go @@ -22,8 +22,8 @@ import ( "github.com/formancehq/stack/libs/go-libs/metadata" "github.com/formancehq/stack/libs/go-libs/migrations" "github.com/formancehq/stack/libs/go-libs/query" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" ) func TestGetLedgerInfo(t *testing.T) { diff --git a/internal/api/v2/controllers_transactions_test.go b/internal/api/v2/controllers_transactions_test.go index 11a18efd8..8a07c8a6b 100644 --- a/internal/api/v2/controllers_transactions_test.go +++ b/internal/api/v2/controllers_transactions_test.go @@ -20,8 +20,8 @@ import ( sharedapi "github.com/formancehq/stack/libs/go-libs/api" "github.com/formancehq/stack/libs/go-libs/metadata" "github.com/formancehq/stack/libs/go-libs/query" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" ) func TestPostTransactions(t *testing.T) { @@ -556,7 +556,7 @@ func TestCountTransactions(t *testing.T) { if testCase.expectStatusCode < 300 && testCase.expectStatusCode >= 200 { mockLedger.EXPECT(). CountTransactions(gomock.Any(), ledgerstore.NewGetTransactionsQuery(testCase.expectQuery)). - Return(uint64(10), nil) + Return(10, nil) } router := v2.NewRouter(backend, nil, metrics.NewNoOpRegistry()) diff --git a/internal/engine/ledger.go b/internal/engine/ledger.go index 75abda917..974357b40 100644 --- a/internal/engine/ledger.go +++ b/internal/engine/ledger.go @@ -16,8 +16,9 @@ import ( ) type Ledger struct { - commander *command.Commander - store *ledgerstore.Store + commander *command.Commander + store *ledgerstore.Store + isSchemaUpToDate bool } func New( @@ -58,7 +59,7 @@ func (l *Ledger) GetTransactions(ctx context.Context, q *ledgerstore.GetTransact return txs, errors.Wrap(err, "getting transactions") } -func (l *Ledger) CountTransactions(ctx context.Context, q *ledgerstore.GetTransactionsQuery) (uint64, error) { +func (l *Ledger) CountTransactions(ctx context.Context, q *ledgerstore.GetTransactionsQuery) (int, error) { count, err := l.store.CountTransactions(ctx, q) return count, errors.Wrap(err, "counting transactions") } @@ -68,7 +69,7 @@ func (l *Ledger) GetTransactionWithVolumes(ctx context.Context, query ledgerstor return tx, errors.Wrap(err, "getting transaction") } -func (l *Ledger) CountAccounts(ctx context.Context, a *ledgerstore.GetAccountsQuery) (uint64, error) { +func (l *Ledger) CountAccounts(ctx context.Context, a *ledgerstore.GetAccountsQuery) (int, error) { count, err := l.store.CountAccounts(ctx, a) return count, errors.Wrap(err, "counting accounts") } @@ -110,5 +111,11 @@ func (l *Ledger) DeleteMetadata(ctx context.Context, parameters command.Paramete } func (l *Ledger) IsDatabaseUpToDate(ctx context.Context) (bool, error) { - return l.store.IsSchemaUpToDate(ctx) + if l.isSchemaUpToDate { + return true, nil + } + var err error + l.isSchemaUpToDate, err = l.store.IsSchemaUpToDate(ctx) + + return l.isSchemaUpToDate, err } diff --git a/internal/engine/stats.go b/internal/engine/stats.go index 7df6d12b2..34a0cdb38 100644 --- a/internal/engine/stats.go +++ b/internal/engine/stats.go @@ -8,8 +8,8 @@ import ( ) type Stats struct { - Transactions uint64 `json:"transactions"` - Accounts uint64 `json:"accounts"` + Transactions int `json:"transactions"` + Accounts int `json:"accounts"` } func (l *Ledger) Stats(ctx context.Context) (Stats, error) { diff --git a/internal/machine/script/parser/NumScript.interp b/internal/machine/script/parser/NumScript.interp index 12a17ac08..49de52239 100644 --- a/internal/machine/script/parser/NumScript.interp +++ b/internal/machine/script/parser/NumScript.interp @@ -125,4 +125,4 @@ script atn: -[4, 1, 47, 292, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 63, 8, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 3, 4, 70, 8, 4, 1, 4, 1, 4, 1, 4, 5, 4, 75, 8, 4, 10, 4, 12, 4, 78, 9, 4, 1, 5, 1, 5, 1, 5, 3, 5, 83, 8, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 4, 6, 92, 8, 6, 11, 6, 12, 6, 93, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 4, 7, 107, 8, 7, 11, 7, 12, 7, 108, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 3, 8, 116, 8, 8, 1, 9, 1, 9, 1, 9, 3, 9, 121, 8, 9, 1, 10, 1, 10, 1, 10, 3, 10, 126, 8, 10, 1, 11, 1, 11, 3, 11, 130, 8, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 4, 12, 137, 8, 12, 11, 12, 12, 12, 138, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 3, 14, 151, 8, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 4, 15, 160, 8, 15, 11, 15, 12, 15, 161, 1, 15, 1, 15, 1, 16, 1, 16, 3, 16, 168, 8, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, 175, 8, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, 200, 8, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, 220, 8, 17, 1, 17, 1, 17, 1, 17, 3, 17, 225, 8, 17, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 3, 19, 243, 8, 19, 1, 20, 1, 20, 1, 20, 1, 20, 3, 20, 249, 8, 20, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 4, 21, 256, 8, 21, 11, 21, 12, 21, 257, 4, 21, 260, 8, 21, 11, 21, 12, 21, 261, 1, 21, 1, 21, 1, 21, 1, 22, 5, 22, 268, 8, 22, 10, 22, 12, 22, 271, 9, 22, 1, 22, 3, 22, 274, 8, 22, 1, 22, 1, 22, 1, 22, 5, 22, 279, 8, 22, 10, 22, 12, 22, 282, 9, 22, 1, 22, 5, 22, 285, 8, 22, 10, 22, 12, 22, 288, 9, 22, 1, 22, 1, 22, 1, 22, 0, 1, 8, 23, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 0, 2, 1, 0, 22, 23, 1, 0, 31, 36, 305, 0, 46, 1, 0, 0, 0, 2, 51, 1, 0, 0, 0, 4, 62, 1, 0, 0, 0, 6, 64, 1, 0, 0, 0, 8, 69, 1, 0, 0, 0, 10, 82, 1, 0, 0, 0, 12, 84, 1, 0, 0, 0, 14, 100, 1, 0, 0, 0, 16, 115, 1, 0, 0, 0, 18, 120, 1, 0, 0, 0, 20, 125, 1, 0, 0, 0, 22, 127, 1, 0, 0, 0, 24, 131, 1, 0, 0, 0, 26, 142, 1, 0, 0, 0, 28, 150, 1, 0, 0, 0, 30, 152, 1, 0, 0, 0, 32, 167, 1, 0, 0, 0, 34, 224, 1, 0, 0, 0, 36, 226, 1, 0, 0, 0, 38, 242, 1, 0, 0, 0, 40, 244, 1, 0, 0, 0, 42, 250, 1, 0, 0, 0, 44, 269, 1, 0, 0, 0, 46, 47, 5, 26, 0, 0, 47, 48, 3, 8, 4, 0, 48, 49, 5, 43, 0, 0, 49, 50, 5, 27, 0, 0, 50, 1, 1, 0, 0, 0, 51, 52, 5, 26, 0, 0, 52, 53, 3, 8, 4, 0, 53, 54, 5, 1, 0, 0, 54, 55, 5, 27, 0, 0, 55, 3, 1, 0, 0, 0, 56, 63, 5, 46, 0, 0, 57, 63, 5, 47, 0, 0, 58, 63, 5, 43, 0, 0, 59, 63, 5, 37, 0, 0, 60, 63, 5, 38, 0, 0, 61, 63, 3, 0, 0, 0, 62, 56, 1, 0, 0, 0, 62, 57, 1, 0, 0, 0, 62, 58, 1, 0, 0, 0, 62, 59, 1, 0, 0, 0, 62, 60, 1, 0, 0, 0, 62, 61, 1, 0, 0, 0, 63, 5, 1, 0, 0, 0, 64, 65, 5, 45, 0, 0, 65, 7, 1, 0, 0, 0, 66, 67, 6, 4, -1, 0, 67, 70, 3, 4, 2, 0, 68, 70, 3, 6, 3, 0, 69, 66, 1, 0, 0, 0, 69, 68, 1, 0, 0, 0, 70, 76, 1, 0, 0, 0, 71, 72, 10, 3, 0, 0, 72, 73, 7, 0, 0, 0, 73, 75, 3, 8, 4, 4, 74, 71, 1, 0, 0, 0, 75, 78, 1, 0, 0, 0, 76, 74, 1, 0, 0, 0, 76, 77, 1, 0, 0, 0, 77, 9, 1, 0, 0, 0, 78, 76, 1, 0, 0, 0, 79, 83, 5, 38, 0, 0, 80, 83, 3, 6, 3, 0, 81, 83, 5, 39, 0, 0, 82, 79, 1, 0, 0, 0, 82, 80, 1, 0, 0, 0, 82, 81, 1, 0, 0, 0, 83, 11, 1, 0, 0, 0, 84, 85, 5, 28, 0, 0, 85, 91, 5, 5, 0, 0, 86, 87, 5, 18, 0, 0, 87, 88, 3, 8, 4, 0, 88, 89, 3, 16, 8, 0, 89, 90, 5, 5, 0, 0, 90, 92, 1, 0, 0, 0, 91, 86, 1, 0, 0, 0, 92, 93, 1, 0, 0, 0, 93, 91, 1, 0, 0, 0, 93, 94, 1, 0, 0, 0, 94, 95, 1, 0, 0, 0, 95, 96, 5, 39, 0, 0, 96, 97, 3, 16, 8, 0, 97, 98, 5, 5, 0, 0, 98, 99, 5, 29, 0, 0, 99, 13, 1, 0, 0, 0, 100, 101, 5, 28, 0, 0, 101, 106, 5, 5, 0, 0, 102, 103, 3, 10, 5, 0, 103, 104, 3, 16, 8, 0, 104, 105, 5, 5, 0, 0, 105, 107, 1, 0, 0, 0, 106, 102, 1, 0, 0, 0, 107, 108, 1, 0, 0, 0, 108, 106, 1, 0, 0, 0, 108, 109, 1, 0, 0, 0, 109, 110, 1, 0, 0, 0, 110, 111, 5, 29, 0, 0, 111, 15, 1, 0, 0, 0, 112, 113, 5, 20, 0, 0, 113, 116, 3, 18, 9, 0, 114, 116, 5, 40, 0, 0, 115, 112, 1, 0, 0, 0, 115, 114, 1, 0, 0, 0, 116, 17, 1, 0, 0, 0, 117, 121, 3, 8, 4, 0, 118, 121, 3, 12, 6, 0, 119, 121, 3, 14, 7, 0, 120, 117, 1, 0, 0, 0, 120, 118, 1, 0, 0, 0, 120, 119, 1, 0, 0, 0, 121, 19, 1, 0, 0, 0, 122, 123, 5, 2, 0, 0, 123, 126, 3, 8, 4, 0, 124, 126, 5, 3, 0, 0, 125, 122, 1, 0, 0, 0, 125, 124, 1, 0, 0, 0, 126, 21, 1, 0, 0, 0, 127, 129, 3, 8, 4, 0, 128, 130, 3, 20, 10, 0, 129, 128, 1, 0, 0, 0, 129, 130, 1, 0, 0, 0, 130, 23, 1, 0, 0, 0, 131, 132, 5, 28, 0, 0, 132, 136, 5, 5, 0, 0, 133, 134, 3, 28, 14, 0, 134, 135, 5, 5, 0, 0, 135, 137, 1, 0, 0, 0, 136, 133, 1, 0, 0, 0, 137, 138, 1, 0, 0, 0, 138, 136, 1, 0, 0, 0, 138, 139, 1, 0, 0, 0, 139, 140, 1, 0, 0, 0, 140, 141, 5, 29, 0, 0, 141, 25, 1, 0, 0, 0, 142, 143, 5, 18, 0, 0, 143, 144, 3, 8, 4, 0, 144, 145, 5, 17, 0, 0, 145, 146, 3, 28, 14, 0, 146, 27, 1, 0, 0, 0, 147, 151, 3, 22, 11, 0, 148, 151, 3, 26, 13, 0, 149, 151, 3, 24, 12, 0, 150, 147, 1, 0, 0, 0, 150, 148, 1, 0, 0, 0, 150, 149, 1, 0, 0, 0, 151, 29, 1, 0, 0, 0, 152, 153, 5, 28, 0, 0, 153, 159, 5, 5, 0, 0, 154, 155, 3, 10, 5, 0, 155, 156, 5, 17, 0, 0, 156, 157, 3, 28, 14, 0, 157, 158, 5, 5, 0, 0, 158, 160, 1, 0, 0, 0, 159, 154, 1, 0, 0, 0, 160, 161, 1, 0, 0, 0, 161, 159, 1, 0, 0, 0, 161, 162, 1, 0, 0, 0, 162, 163, 1, 0, 0, 0, 163, 164, 5, 29, 0, 0, 164, 31, 1, 0, 0, 0, 165, 168, 3, 28, 14, 0, 166, 168, 3, 30, 15, 0, 167, 165, 1, 0, 0, 0, 167, 166, 1, 0, 0, 0, 168, 33, 1, 0, 0, 0, 169, 170, 5, 13, 0, 0, 170, 225, 3, 8, 4, 0, 171, 174, 5, 42, 0, 0, 172, 175, 3, 8, 4, 0, 173, 175, 3, 2, 1, 0, 174, 172, 1, 0, 0, 0, 174, 173, 1, 0, 0, 0, 175, 176, 1, 0, 0, 0, 176, 177, 5, 17, 0, 0, 177, 178, 3, 8, 4, 0, 178, 225, 1, 0, 0, 0, 179, 180, 5, 11, 0, 0, 180, 181, 5, 24, 0, 0, 181, 182, 5, 37, 0, 0, 182, 183, 5, 4, 0, 0, 183, 184, 3, 8, 4, 0, 184, 185, 5, 25, 0, 0, 185, 225, 1, 0, 0, 0, 186, 187, 5, 12, 0, 0, 187, 188, 5, 24, 0, 0, 188, 189, 3, 8, 4, 0, 189, 190, 5, 4, 0, 0, 190, 191, 5, 37, 0, 0, 191, 192, 5, 4, 0, 0, 192, 193, 3, 8, 4, 0, 193, 194, 5, 25, 0, 0, 194, 225, 1, 0, 0, 0, 195, 225, 5, 14, 0, 0, 196, 199, 5, 15, 0, 0, 197, 200, 3, 8, 4, 0, 198, 200, 3, 2, 1, 0, 199, 197, 1, 0, 0, 0, 199, 198, 1, 0, 0, 0, 200, 201, 1, 0, 0, 0, 201, 202, 5, 24, 0, 0, 202, 219, 5, 5, 0, 0, 203, 204, 5, 16, 0, 0, 204, 205, 5, 30, 0, 0, 205, 206, 3, 32, 16, 0, 206, 207, 5, 5, 0, 0, 207, 208, 5, 19, 0, 0, 208, 209, 5, 30, 0, 0, 209, 210, 3, 18, 9, 0, 210, 220, 1, 0, 0, 0, 211, 212, 5, 19, 0, 0, 212, 213, 5, 30, 0, 0, 213, 214, 3, 18, 9, 0, 214, 215, 5, 5, 0, 0, 215, 216, 5, 16, 0, 0, 216, 217, 5, 30, 0, 0, 217, 218, 3, 32, 16, 0, 218, 220, 1, 0, 0, 0, 219, 203, 1, 0, 0, 0, 219, 211, 1, 0, 0, 0, 220, 221, 1, 0, 0, 0, 221, 222, 5, 5, 0, 0, 222, 223, 5, 25, 0, 0, 223, 225, 1, 0, 0, 0, 224, 169, 1, 0, 0, 0, 224, 171, 1, 0, 0, 0, 224, 179, 1, 0, 0, 0, 224, 186, 1, 0, 0, 0, 224, 195, 1, 0, 0, 0, 224, 196, 1, 0, 0, 0, 225, 35, 1, 0, 0, 0, 226, 227, 7, 1, 0, 0, 227, 37, 1, 0, 0, 0, 228, 229, 5, 10, 0, 0, 229, 230, 5, 24, 0, 0, 230, 231, 3, 8, 4, 0, 231, 232, 5, 4, 0, 0, 232, 233, 5, 37, 0, 0, 233, 234, 5, 25, 0, 0, 234, 243, 1, 0, 0, 0, 235, 236, 5, 41, 0, 0, 236, 237, 5, 24, 0, 0, 237, 238, 3, 8, 4, 0, 238, 239, 5, 4, 0, 0, 239, 240, 3, 8, 4, 0, 240, 241, 5, 25, 0, 0, 241, 243, 1, 0, 0, 0, 242, 228, 1, 0, 0, 0, 242, 235, 1, 0, 0, 0, 243, 39, 1, 0, 0, 0, 244, 245, 3, 36, 18, 0, 245, 248, 3, 6, 3, 0, 246, 247, 5, 30, 0, 0, 247, 249, 3, 38, 19, 0, 248, 246, 1, 0, 0, 0, 248, 249, 1, 0, 0, 0, 249, 41, 1, 0, 0, 0, 250, 251, 5, 9, 0, 0, 251, 252, 5, 28, 0, 0, 252, 259, 5, 5, 0, 0, 253, 255, 3, 40, 20, 0, 254, 256, 5, 5, 0, 0, 255, 254, 1, 0, 0, 0, 256, 257, 1, 0, 0, 0, 257, 255, 1, 0, 0, 0, 257, 258, 1, 0, 0, 0, 258, 260, 1, 0, 0, 0, 259, 253, 1, 0, 0, 0, 260, 261, 1, 0, 0, 0, 261, 259, 1, 0, 0, 0, 261, 262, 1, 0, 0, 0, 262, 263, 1, 0, 0, 0, 263, 264, 5, 29, 0, 0, 264, 265, 5, 5, 0, 0, 265, 43, 1, 0, 0, 0, 266, 268, 5, 5, 0, 0, 267, 266, 1, 0, 0, 0, 268, 271, 1, 0, 0, 0, 269, 267, 1, 0, 0, 0, 269, 270, 1, 0, 0, 0, 270, 273, 1, 0, 0, 0, 271, 269, 1, 0, 0, 0, 272, 274, 3, 42, 21, 0, 273, 272, 1, 0, 0, 0, 273, 274, 1, 0, 0, 0, 274, 275, 1, 0, 0, 0, 275, 280, 3, 34, 17, 0, 276, 277, 5, 5, 0, 0, 277, 279, 3, 34, 17, 0, 278, 276, 1, 0, 0, 0, 279, 282, 1, 0, 0, 0, 280, 278, 1, 0, 0, 0, 280, 281, 1, 0, 0, 0, 281, 286, 1, 0, 0, 0, 282, 280, 1, 0, 0, 0, 283, 285, 5, 5, 0, 0, 284, 283, 1, 0, 0, 0, 285, 288, 1, 0, 0, 0, 286, 284, 1, 0, 0, 0, 286, 287, 1, 0, 0, 0, 287, 289, 1, 0, 0, 0, 288, 286, 1, 0, 0, 0, 289, 290, 5, 0, 0, 1, 290, 45, 1, 0, 0, 0, 26, 62, 69, 76, 82, 93, 108, 115, 120, 125, 129, 138, 150, 161, 167, 174, 199, 219, 224, 242, 248, 257, 261, 269, 273, 280, 286] +[4, 1, 47, 292, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 63, 8, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 3, 4, 70, 8, 4, 1, 4, 1, 4, 1, 4, 5, 4, 75, 8, 4, 10, 4, 12, 4, 78, 9, 4, 1, 5, 1, 5, 1, 5, 3, 5, 83, 8, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 4, 6, 92, 8, 6, 11, 6, 12, 6, 93, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 4, 7, 107, 8, 7, 11, 7, 12, 7, 108, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 3, 8, 116, 8, 8, 1, 9, 1, 9, 1, 9, 3, 9, 121, 8, 9, 1, 10, 1, 10, 1, 10, 3, 10, 126, 8, 10, 1, 11, 1, 11, 3, 11, 130, 8, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 4, 12, 137, 8, 12, 11, 12, 12, 12, 138, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 3, 14, 151, 8, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 4, 15, 160, 8, 15, 11, 15, 12, 15, 161, 1, 15, 1, 15, 1, 16, 1, 16, 3, 16, 168, 8, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, 175, 8, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, 200, 8, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, 220, 8, 17, 1, 17, 1, 17, 1, 17, 3, 17, 225, 8, 17, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 3, 19, 243, 8, 19, 1, 20, 1, 20, 1, 20, 1, 20, 3, 20, 249, 8, 20, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 4, 21, 256, 8, 21, 11, 21, 12, 21, 257, 4, 21, 260, 8, 21, 11, 21, 12, 21, 261, 1, 21, 1, 21, 1, 21, 1, 22, 5, 22, 268, 8, 22, 10, 22, 12, 22, 271, 9, 22, 1, 22, 3, 22, 274, 8, 22, 1, 22, 1, 22, 1, 22, 5, 22, 279, 8, 22, 10, 22, 12, 22, 282, 9, 22, 1, 22, 5, 22, 285, 8, 22, 10, 22, 12, 22, 288, 9, 22, 1, 22, 1, 22, 1, 22, 0, 1, 8, 23, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 0, 2, 1, 0, 22, 23, 1, 0, 31, 36, 305, 0, 46, 1, 0, 0, 0, 2, 51, 1, 0, 0, 0, 4, 62, 1, 0, 0, 0, 6, 64, 1, 0, 0, 0, 8, 69, 1, 0, 0, 0, 10, 82, 1, 0, 0, 0, 12, 84, 1, 0, 0, 0, 14, 100, 1, 0, 0, 0, 16, 115, 1, 0, 0, 0, 18, 120, 1, 0, 0, 0, 20, 125, 1, 0, 0, 0, 22, 127, 1, 0, 0, 0, 24, 131, 1, 0, 0, 0, 26, 142, 1, 0, 0, 0, 28, 150, 1, 0, 0, 0, 30, 152, 1, 0, 0, 0, 32, 167, 1, 0, 0, 0, 34, 224, 1, 0, 0, 0, 36, 226, 1, 0, 0, 0, 38, 242, 1, 0, 0, 0, 40, 244, 1, 0, 0, 0, 42, 250, 1, 0, 0, 0, 44, 269, 1, 0, 0, 0, 46, 47, 5, 26, 0, 0, 47, 48, 3, 8, 4, 0, 48, 49, 5, 43, 0, 0, 49, 50, 5, 27, 0, 0, 50, 1, 1, 0, 0, 0, 51, 52, 5, 26, 0, 0, 52, 53, 3, 8, 4, 0, 53, 54, 5, 1, 0, 0, 54, 55, 5, 27, 0, 0, 55, 3, 1, 0, 0, 0, 56, 63, 5, 46, 0, 0, 57, 63, 5, 47, 0, 0, 58, 63, 5, 43, 0, 0, 59, 63, 5, 37, 0, 0, 60, 63, 5, 38, 0, 0, 61, 63, 3, 0, 0, 0, 62, 56, 1, 0, 0, 0, 62, 57, 1, 0, 0, 0, 62, 58, 1, 0, 0, 0, 62, 59, 1, 0, 0, 0, 62, 60, 1, 0, 0, 0, 62, 61, 1, 0, 0, 0, 63, 5, 1, 0, 0, 0, 64, 65, 5, 45, 0, 0, 65, 7, 1, 0, 0, 0, 66, 67, 6, 4, -1, 0, 67, 70, 3, 4, 2, 0, 68, 70, 3, 6, 3, 0, 69, 66, 1, 0, 0, 0, 69, 68, 1, 0, 0, 0, 70, 76, 1, 0, 0, 0, 71, 72, 10, 3, 0, 0, 72, 73, 7, 0, 0, 0, 73, 75, 3, 8, 4, 4, 74, 71, 1, 0, 0, 0, 75, 78, 1, 0, 0, 0, 76, 74, 1, 0, 0, 0, 76, 77, 1, 0, 0, 0, 77, 9, 1, 0, 0, 0, 78, 76, 1, 0, 0, 0, 79, 83, 5, 38, 0, 0, 80, 83, 3, 6, 3, 0, 81, 83, 5, 39, 0, 0, 82, 79, 1, 0, 0, 0, 82, 80, 1, 0, 0, 0, 82, 81, 1, 0, 0, 0, 83, 11, 1, 0, 0, 0, 84, 85, 5, 28, 0, 0, 85, 91, 5, 5, 0, 0, 86, 87, 5, 18, 0, 0, 87, 88, 3, 8, 4, 0, 88, 89, 3, 16, 8, 0, 89, 90, 5, 5, 0, 0, 90, 92, 1, 0, 0, 0, 91, 86, 1, 0, 0, 0, 92, 93, 1, 0, 0, 0, 93, 91, 1, 0, 0, 0, 93, 94, 1, 0, 0, 0, 94, 95, 1, 0, 0, 0, 95, 96, 5, 39, 0, 0, 96, 97, 3, 16, 8, 0, 97, 98, 5, 5, 0, 0, 98, 99, 5, 29, 0, 0, 99, 13, 1, 0, 0, 0, 100, 101, 5, 28, 0, 0, 101, 106, 5, 5, 0, 0, 102, 103, 3, 10, 5, 0, 103, 104, 3, 16, 8, 0, 104, 105, 5, 5, 0, 0, 105, 107, 1, 0, 0, 0, 106, 102, 1, 0, 0, 0, 107, 108, 1, 0, 0, 0, 108, 106, 1, 0, 0, 0, 108, 109, 1, 0, 0, 0, 109, 110, 1, 0, 0, 0, 110, 111, 5, 29, 0, 0, 111, 15, 1, 0, 0, 0, 112, 113, 5, 20, 0, 0, 113, 116, 3, 18, 9, 0, 114, 116, 5, 40, 0, 0, 115, 112, 1, 0, 0, 0, 115, 114, 1, 0, 0, 0, 116, 17, 1, 0, 0, 0, 117, 121, 3, 8, 4, 0, 118, 121, 3, 12, 6, 0, 119, 121, 3, 14, 7, 0, 120, 117, 1, 0, 0, 0, 120, 118, 1, 0, 0, 0, 120, 119, 1, 0, 0, 0, 121, 19, 1, 0, 0, 0, 122, 123, 5, 2, 0, 0, 123, 126, 3, 8, 4, 0, 124, 126, 5, 3, 0, 0, 125, 122, 1, 0, 0, 0, 125, 124, 1, 0, 0, 0, 126, 21, 1, 0, 0, 0, 127, 129, 3, 8, 4, 0, 128, 130, 3, 20, 10, 0, 129, 128, 1, 0, 0, 0, 129, 130, 1, 0, 0, 0, 130, 23, 1, 0, 0, 0, 131, 132, 5, 28, 0, 0, 132, 136, 5, 5, 0, 0, 133, 134, 3, 28, 14, 0, 134, 135, 5, 5, 0, 0, 135, 137, 1, 0, 0, 0, 136, 133, 1, 0, 0, 0, 137, 138, 1, 0, 0, 0, 138, 136, 1, 0, 0, 0, 138, 139, 1, 0, 0, 0, 139, 140, 1, 0, 0, 0, 140, 141, 5, 29, 0, 0, 141, 25, 1, 0, 0, 0, 142, 143, 5, 18, 0, 0, 143, 144, 3, 8, 4, 0, 144, 145, 5, 17, 0, 0, 145, 146, 3, 28, 14, 0, 146, 27, 1, 0, 0, 0, 147, 151, 3, 22, 11, 0, 148, 151, 3, 26, 13, 0, 149, 151, 3, 24, 12, 0, 150, 147, 1, 0, 0, 0, 150, 148, 1, 0, 0, 0, 150, 149, 1, 0, 0, 0, 151, 29, 1, 0, 0, 0, 152, 153, 5, 28, 0, 0, 153, 159, 5, 5, 0, 0, 154, 155, 3, 10, 5, 0, 155, 156, 5, 17, 0, 0, 156, 157, 3, 28, 14, 0, 157, 158, 5, 5, 0, 0, 158, 160, 1, 0, 0, 0, 159, 154, 1, 0, 0, 0, 160, 161, 1, 0, 0, 0, 161, 159, 1, 0, 0, 0, 161, 162, 1, 0, 0, 0, 162, 163, 1, 0, 0, 0, 163, 164, 5, 29, 0, 0, 164, 31, 1, 0, 0, 0, 165, 168, 3, 28, 14, 0, 166, 168, 3, 30, 15, 0, 167, 165, 1, 0, 0, 0, 167, 166, 1, 0, 0, 0, 168, 33, 1, 0, 0, 0, 169, 170, 5, 13, 0, 0, 170, 225, 3, 8, 4, 0, 171, 174, 5, 42, 0, 0, 172, 175, 3, 8, 4, 0, 173, 175, 3, 2, 1, 0, 174, 172, 1, 0, 0, 0, 174, 173, 1, 0, 0, 0, 175, 176, 1, 0, 0, 0, 176, 177, 5, 17, 0, 0, 177, 178, 3, 8, 4, 0, 178, 225, 1, 0, 0, 0, 179, 180, 5, 11, 0, 0, 180, 181, 5, 24, 0, 0, 181, 182, 5, 37, 0, 0, 182, 183, 5, 4, 0, 0, 183, 184, 3, 8, 4, 0, 184, 185, 5, 25, 0, 0, 185, 225, 1, 0, 0, 0, 186, 187, 5, 12, 0, 0, 187, 188, 5, 24, 0, 0, 188, 189, 3, 8, 4, 0, 189, 190, 5, 4, 0, 0, 190, 191, 5, 37, 0, 0, 191, 192, 5, 4, 0, 0, 192, 193, 3, 8, 4, 0, 193, 194, 5, 25, 0, 0, 194, 225, 1, 0, 0, 0, 195, 225, 5, 14, 0, 0, 196, 199, 5, 15, 0, 0, 197, 200, 3, 8, 4, 0, 198, 200, 3, 2, 1, 0, 199, 197, 1, 0, 0, 0, 199, 198, 1, 0, 0, 0, 200, 201, 1, 0, 0, 0, 201, 202, 5, 24, 0, 0, 202, 219, 5, 5, 0, 0, 203, 204, 5, 16, 0, 0, 204, 205, 5, 30, 0, 0, 205, 206, 3, 32, 16, 0, 206, 207, 5, 5, 0, 0, 207, 208, 5, 19, 0, 0, 208, 209, 5, 30, 0, 0, 209, 210, 3, 18, 9, 0, 210, 220, 1, 0, 0, 0, 211, 212, 5, 19, 0, 0, 212, 213, 5, 30, 0, 0, 213, 214, 3, 18, 9, 0, 214, 215, 5, 5, 0, 0, 215, 216, 5, 16, 0, 0, 216, 217, 5, 30, 0, 0, 217, 218, 3, 32, 16, 0, 218, 220, 1, 0, 0, 0, 219, 203, 1, 0, 0, 0, 219, 211, 1, 0, 0, 0, 220, 221, 1, 0, 0, 0, 221, 222, 5, 5, 0, 0, 222, 223, 5, 25, 0, 0, 223, 225, 1, 0, 0, 0, 224, 169, 1, 0, 0, 0, 224, 171, 1, 0, 0, 0, 224, 179, 1, 0, 0, 0, 224, 186, 1, 0, 0, 0, 224, 195, 1, 0, 0, 0, 224, 196, 1, 0, 0, 0, 225, 35, 1, 0, 0, 0, 226, 227, 7, 1, 0, 0, 227, 37, 1, 0, 0, 0, 228, 229, 5, 10, 0, 0, 229, 230, 5, 24, 0, 0, 230, 231, 3, 8, 4, 0, 231, 232, 5, 4, 0, 0, 232, 233, 5, 37, 0, 0, 233, 234, 5, 25, 0, 0, 234, 243, 1, 0, 0, 0, 235, 236, 5, 41, 0, 0, 236, 237, 5, 24, 0, 0, 237, 238, 3, 8, 4, 0, 238, 239, 5, 4, 0, 0, 239, 240, 3, 8, 4, 0, 240, 241, 5, 25, 0, 0, 241, 243, 1, 0, 0, 0, 242, 228, 1, 0, 0, 0, 242, 235, 1, 0, 0, 0, 243, 39, 1, 0, 0, 0, 244, 245, 3, 36, 18, 0, 245, 248, 3, 6, 3, 0, 246, 247, 5, 30, 0, 0, 247, 249, 3, 38, 19, 0, 248, 246, 1, 0, 0, 0, 248, 249, 1, 0, 0, 0, 249, 41, 1, 0, 0, 0, 250, 251, 5, 9, 0, 0, 251, 252, 5, 28, 0, 0, 252, 259, 5, 5, 0, 0, 253, 255, 3, 40, 20, 0, 254, 256, 5, 5, 0, 0, 255, 254, 1, 0, 0, 0, 256, 257, 1, 0, 0, 0, 257, 255, 1, 0, 0, 0, 257, 258, 1, 0, 0, 0, 258, 260, 1, 0, 0, 0, 259, 253, 1, 0, 0, 0, 260, 261, 1, 0, 0, 0, 261, 259, 1, 0, 0, 0, 261, 262, 1, 0, 0, 0, 262, 263, 1, 0, 0, 0, 263, 264, 5, 29, 0, 0, 264, 265, 5, 5, 0, 0, 265, 43, 1, 0, 0, 0, 266, 268, 5, 5, 0, 0, 267, 266, 1, 0, 0, 0, 268, 271, 1, 0, 0, 0, 269, 267, 1, 0, 0, 0, 269, 270, 1, 0, 0, 0, 270, 273, 1, 0, 0, 0, 271, 269, 1, 0, 0, 0, 272, 274, 3, 42, 21, 0, 273, 272, 1, 0, 0, 0, 273, 274, 1, 0, 0, 0, 274, 275, 1, 0, 0, 0, 275, 280, 3, 34, 17, 0, 276, 277, 5, 5, 0, 0, 277, 279, 3, 34, 17, 0, 278, 276, 1, 0, 0, 0, 279, 282, 1, 0, 0, 0, 280, 278, 1, 0, 0, 0, 280, 281, 1, 0, 0, 0, 281, 286, 1, 0, 0, 0, 282, 280, 1, 0, 0, 0, 283, 285, 5, 5, 0, 0, 284, 283, 1, 0, 0, 0, 285, 288, 1, 0, 0, 0, 286, 284, 1, 0, 0, 0, 286, 287, 1, 0, 0, 0, 287, 289, 1, 0, 0, 0, 288, 286, 1, 0, 0, 0, 289, 290, 5, 0, 0, 1, 290, 45, 1, 0, 0, 0, 26, 62, 69, 76, 82, 93, 108, 115, 120, 125, 129, 138, 150, 161, 167, 174, 199, 219, 224, 242, 248, 257, 261, 269, 273, 280, 286] \ No newline at end of file diff --git a/internal/machine/script/parser/NumScriptLexer.interp b/internal/machine/script/parser/NumScriptLexer.interp index 531a9b456..3276c1448 100644 --- a/internal/machine/script/parser/NumScriptLexer.interp +++ b/internal/machine/script/parser/NumScriptLexer.interp @@ -155,4 +155,4 @@ mode names: DEFAULT_MODE atn: -[4, 0, 47, 457, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 4, 4, 155, 8, 4, 11, 4, 12, 4, 156, 1, 5, 4, 5, 160, 8, 5, 11, 5, 12, 5, 161, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 5, 6, 171, 8, 6, 10, 6, 12, 6, 174, 9, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 5, 7, 185, 8, 7, 10, 7, 12, 7, 188, 9, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 22, 1, 22, 1, 23, 1, 23, 1, 24, 1, 24, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 1, 27, 1, 28, 1, 28, 1, 29, 1, 29, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 36, 1, 36, 5, 36, 354, 8, 36, 10, 36, 12, 36, 357, 9, 36, 1, 36, 1, 36, 1, 37, 4, 37, 362, 8, 37, 11, 37, 12, 37, 363, 1, 37, 3, 37, 367, 8, 37, 1, 37, 1, 37, 3, 37, 371, 8, 37, 1, 37, 4, 37, 374, 8, 37, 11, 37, 12, 37, 375, 1, 37, 4, 37, 379, 8, 37, 11, 37, 12, 37, 380, 1, 37, 1, 37, 4, 37, 385, 8, 37, 11, 37, 12, 37, 386, 3, 37, 389, 8, 37, 1, 37, 3, 37, 392, 8, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 42, 4, 42, 423, 8, 42, 11, 42, 12, 42, 424, 1, 43, 1, 43, 1, 44, 1, 44, 4, 44, 431, 8, 44, 11, 44, 12, 44, 432, 1, 44, 5, 44, 436, 8, 44, 10, 44, 12, 44, 439, 9, 44, 1, 45, 1, 45, 4, 45, 443, 8, 45, 11, 45, 12, 45, 444, 1, 45, 5, 45, 448, 8, 45, 10, 45, 12, 45, 451, 9, 45, 1, 46, 4, 46, 454, 8, 46, 11, 46, 12, 46, 455, 2, 172, 186, 0, 47, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 19, 39, 20, 41, 21, 43, 22, 45, 23, 47, 24, 49, 25, 51, 26, 53, 27, 55, 28, 57, 29, 59, 30, 61, 31, 63, 32, 65, 33, 67, 34, 69, 35, 71, 36, 73, 37, 75, 38, 77, 39, 79, 40, 81, 41, 83, 42, 85, 43, 87, 44, 89, 45, 91, 46, 93, 47, 1, 0, 10, 2, 0, 10, 10, 13, 13, 2, 0, 9, 9, 32, 32, 6, 0, 32, 32, 45, 45, 48, 57, 65, 90, 95, 95, 97, 122, 1, 0, 48, 57, 1, 0, 32, 32, 2, 0, 95, 95, 97, 122, 3, 0, 48, 57, 95, 95, 97, 122, 3, 0, 65, 90, 95, 95, 97, 122, 4, 0, 48, 58, 65, 90, 95, 95, 97, 122, 2, 0, 47, 57, 65, 90, 476, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, 0, 0, 47, 1, 0, 0, 0, 0, 49, 1, 0, 0, 0, 0, 51, 1, 0, 0, 0, 0, 53, 1, 0, 0, 0, 0, 55, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 0, 61, 1, 0, 0, 0, 0, 63, 1, 0, 0, 0, 0, 65, 1, 0, 0, 0, 0, 67, 1, 0, 0, 0, 0, 69, 1, 0, 0, 0, 0, 71, 1, 0, 0, 0, 0, 73, 1, 0, 0, 0, 0, 75, 1, 0, 0, 0, 0, 77, 1, 0, 0, 0, 0, 79, 1, 0, 0, 0, 0, 81, 1, 0, 0, 0, 0, 83, 1, 0, 0, 0, 0, 85, 1, 0, 0, 0, 0, 87, 1, 0, 0, 0, 0, 89, 1, 0, 0, 0, 0, 91, 1, 0, 0, 0, 0, 93, 1, 0, 0, 0, 1, 95, 1, 0, 0, 0, 3, 97, 1, 0, 0, 0, 5, 122, 1, 0, 0, 0, 7, 151, 1, 0, 0, 0, 9, 154, 1, 0, 0, 0, 11, 159, 1, 0, 0, 0, 13, 165, 1, 0, 0, 0, 15, 180, 1, 0, 0, 0, 17, 193, 1, 0, 0, 0, 19, 198, 1, 0, 0, 0, 21, 203, 1, 0, 0, 0, 23, 215, 1, 0, 0, 0, 25, 232, 1, 0, 0, 0, 27, 238, 1, 0, 0, 0, 29, 243, 1, 0, 0, 0, 31, 248, 1, 0, 0, 0, 33, 255, 1, 0, 0, 0, 35, 260, 1, 0, 0, 0, 37, 264, 1, 0, 0, 0, 39, 276, 1, 0, 0, 0, 41, 279, 1, 0, 0, 0, 43, 288, 1, 0, 0, 0, 45, 290, 1, 0, 0, 0, 47, 292, 1, 0, 0, 0, 49, 294, 1, 0, 0, 0, 51, 296, 1, 0, 0, 0, 53, 298, 1, 0, 0, 0, 55, 300, 1, 0, 0, 0, 57, 302, 1, 0, 0, 0, 59, 304, 1, 0, 0, 0, 61, 306, 1, 0, 0, 0, 63, 314, 1, 0, 0, 0, 65, 320, 1, 0, 0, 0, 67, 327, 1, 0, 0, 0, 69, 336, 1, 0, 0, 0, 71, 344, 1, 0, 0, 0, 73, 351, 1, 0, 0, 0, 75, 391, 1, 0, 0, 0, 77, 393, 1, 0, 0, 0, 79, 403, 1, 0, 0, 0, 81, 408, 1, 0, 0, 0, 83, 416, 1, 0, 0, 0, 85, 422, 1, 0, 0, 0, 87, 426, 1, 0, 0, 0, 89, 428, 1, 0, 0, 0, 91, 440, 1, 0, 0, 0, 93, 453, 1, 0, 0, 0, 95, 96, 5, 42, 0, 0, 96, 2, 1, 0, 0, 0, 97, 98, 5, 97, 0, 0, 98, 99, 5, 108, 0, 0, 99, 100, 5, 108, 0, 0, 100, 101, 5, 111, 0, 0, 101, 102, 5, 119, 0, 0, 102, 103, 5, 105, 0, 0, 103, 104, 5, 110, 0, 0, 104, 105, 5, 103, 0, 0, 105, 106, 5, 32, 0, 0, 106, 107, 5, 111, 0, 0, 107, 108, 5, 118, 0, 0, 108, 109, 5, 101, 0, 0, 109, 110, 5, 114, 0, 0, 110, 111, 5, 100, 0, 0, 111, 112, 5, 114, 0, 0, 112, 113, 5, 97, 0, 0, 113, 114, 5, 102, 0, 0, 114, 115, 5, 116, 0, 0, 115, 116, 5, 32, 0, 0, 116, 117, 5, 117, 0, 0, 117, 118, 5, 112, 0, 0, 118, 119, 5, 32, 0, 0, 119, 120, 5, 116, 0, 0, 120, 121, 5, 111, 0, 0, 121, 4, 1, 0, 0, 0, 122, 123, 5, 97, 0, 0, 123, 124, 5, 108, 0, 0, 124, 125, 5, 108, 0, 0, 125, 126, 5, 111, 0, 0, 126, 127, 5, 119, 0, 0, 127, 128, 5, 105, 0, 0, 128, 129, 5, 110, 0, 0, 129, 130, 5, 103, 0, 0, 130, 131, 5, 32, 0, 0, 131, 132, 5, 117, 0, 0, 132, 133, 5, 110, 0, 0, 133, 134, 5, 98, 0, 0, 134, 135, 5, 111, 0, 0, 135, 136, 5, 117, 0, 0, 136, 137, 5, 110, 0, 0, 137, 138, 5, 100, 0, 0, 138, 139, 5, 101, 0, 0, 139, 140, 5, 100, 0, 0, 140, 141, 5, 32, 0, 0, 141, 142, 5, 111, 0, 0, 142, 143, 5, 118, 0, 0, 143, 144, 5, 101, 0, 0, 144, 145, 5, 114, 0, 0, 145, 146, 5, 100, 0, 0, 146, 147, 5, 114, 0, 0, 147, 148, 5, 97, 0, 0, 148, 149, 5, 102, 0, 0, 149, 150, 5, 116, 0, 0, 150, 6, 1, 0, 0, 0, 151, 152, 5, 44, 0, 0, 152, 8, 1, 0, 0, 0, 153, 155, 7, 0, 0, 0, 154, 153, 1, 0, 0, 0, 155, 156, 1, 0, 0, 0, 156, 154, 1, 0, 0, 0, 156, 157, 1, 0, 0, 0, 157, 10, 1, 0, 0, 0, 158, 160, 7, 1, 0, 0, 159, 158, 1, 0, 0, 0, 160, 161, 1, 0, 0, 0, 161, 159, 1, 0, 0, 0, 161, 162, 1, 0, 0, 0, 162, 163, 1, 0, 0, 0, 163, 164, 6, 5, 0, 0, 164, 12, 1, 0, 0, 0, 165, 166, 5, 47, 0, 0, 166, 167, 5, 42, 0, 0, 167, 172, 1, 0, 0, 0, 168, 171, 3, 13, 6, 0, 169, 171, 9, 0, 0, 0, 170, 168, 1, 0, 0, 0, 170, 169, 1, 0, 0, 0, 171, 174, 1, 0, 0, 0, 172, 173, 1, 0, 0, 0, 172, 170, 1, 0, 0, 0, 173, 175, 1, 0, 0, 0, 174, 172, 1, 0, 0, 0, 175, 176, 5, 42, 0, 0, 176, 177, 5, 47, 0, 0, 177, 178, 1, 0, 0, 0, 178, 179, 6, 6, 0, 0, 179, 14, 1, 0, 0, 0, 180, 181, 5, 47, 0, 0, 181, 182, 5, 47, 0, 0, 182, 186, 1, 0, 0, 0, 183, 185, 9, 0, 0, 0, 184, 183, 1, 0, 0, 0, 185, 188, 1, 0, 0, 0, 186, 187, 1, 0, 0, 0, 186, 184, 1, 0, 0, 0, 187, 189, 1, 0, 0, 0, 188, 186, 1, 0, 0, 0, 189, 190, 3, 9, 4, 0, 190, 191, 1, 0, 0, 0, 191, 192, 6, 7, 0, 0, 192, 16, 1, 0, 0, 0, 193, 194, 5, 118, 0, 0, 194, 195, 5, 97, 0, 0, 195, 196, 5, 114, 0, 0, 196, 197, 5, 115, 0, 0, 197, 18, 1, 0, 0, 0, 198, 199, 5, 109, 0, 0, 199, 200, 5, 101, 0, 0, 200, 201, 5, 116, 0, 0, 201, 202, 5, 97, 0, 0, 202, 20, 1, 0, 0, 0, 203, 204, 5, 115, 0, 0, 204, 205, 5, 101, 0, 0, 205, 206, 5, 116, 0, 0, 206, 207, 5, 95, 0, 0, 207, 208, 5, 116, 0, 0, 208, 209, 5, 120, 0, 0, 209, 210, 5, 95, 0, 0, 210, 211, 5, 109, 0, 0, 211, 212, 5, 101, 0, 0, 212, 213, 5, 116, 0, 0, 213, 214, 5, 97, 0, 0, 214, 22, 1, 0, 0, 0, 215, 216, 5, 115, 0, 0, 216, 217, 5, 101, 0, 0, 217, 218, 5, 116, 0, 0, 218, 219, 5, 95, 0, 0, 219, 220, 5, 97, 0, 0, 220, 221, 5, 99, 0, 0, 221, 222, 5, 99, 0, 0, 222, 223, 5, 111, 0, 0, 223, 224, 5, 117, 0, 0, 224, 225, 5, 110, 0, 0, 225, 226, 5, 116, 0, 0, 226, 227, 5, 95, 0, 0, 227, 228, 5, 109, 0, 0, 228, 229, 5, 101, 0, 0, 229, 230, 5, 116, 0, 0, 230, 231, 5, 97, 0, 0, 231, 24, 1, 0, 0, 0, 232, 233, 5, 112, 0, 0, 233, 234, 5, 114, 0, 0, 234, 235, 5, 105, 0, 0, 235, 236, 5, 110, 0, 0, 236, 237, 5, 116, 0, 0, 237, 26, 1, 0, 0, 0, 238, 239, 5, 102, 0, 0, 239, 240, 5, 97, 0, 0, 240, 241, 5, 105, 0, 0, 241, 242, 5, 108, 0, 0, 242, 28, 1, 0, 0, 0, 243, 244, 5, 115, 0, 0, 244, 245, 5, 101, 0, 0, 245, 246, 5, 110, 0, 0, 246, 247, 5, 100, 0, 0, 247, 30, 1, 0, 0, 0, 248, 249, 5, 115, 0, 0, 249, 250, 5, 111, 0, 0, 250, 251, 5, 117, 0, 0, 251, 252, 5, 114, 0, 0, 252, 253, 5, 99, 0, 0, 253, 254, 5, 101, 0, 0, 254, 32, 1, 0, 0, 0, 255, 256, 5, 102, 0, 0, 256, 257, 5, 114, 0, 0, 257, 258, 5, 111, 0, 0, 258, 259, 5, 109, 0, 0, 259, 34, 1, 0, 0, 0, 260, 261, 5, 109, 0, 0, 261, 262, 5, 97, 0, 0, 262, 263, 5, 120, 0, 0, 263, 36, 1, 0, 0, 0, 264, 265, 5, 100, 0, 0, 265, 266, 5, 101, 0, 0, 266, 267, 5, 115, 0, 0, 267, 268, 5, 116, 0, 0, 268, 269, 5, 105, 0, 0, 269, 270, 5, 110, 0, 0, 270, 271, 5, 97, 0, 0, 271, 272, 5, 116, 0, 0, 272, 273, 5, 105, 0, 0, 273, 274, 5, 111, 0, 0, 274, 275, 5, 110, 0, 0, 275, 38, 1, 0, 0, 0, 276, 277, 5, 116, 0, 0, 277, 278, 5, 111, 0, 0, 278, 40, 1, 0, 0, 0, 279, 280, 5, 97, 0, 0, 280, 281, 5, 108, 0, 0, 281, 282, 5, 108, 0, 0, 282, 283, 5, 111, 0, 0, 283, 284, 5, 99, 0, 0, 284, 285, 5, 97, 0, 0, 285, 286, 5, 116, 0, 0, 286, 287, 5, 101, 0, 0, 287, 42, 1, 0, 0, 0, 288, 289, 5, 43, 0, 0, 289, 44, 1, 0, 0, 0, 290, 291, 5, 45, 0, 0, 291, 46, 1, 0, 0, 0, 292, 293, 5, 40, 0, 0, 293, 48, 1, 0, 0, 0, 294, 295, 5, 41, 0, 0, 295, 50, 1, 0, 0, 0, 296, 297, 5, 91, 0, 0, 297, 52, 1, 0, 0, 0, 298, 299, 5, 93, 0, 0, 299, 54, 1, 0, 0, 0, 300, 301, 5, 123, 0, 0, 301, 56, 1, 0, 0, 0, 302, 303, 5, 125, 0, 0, 303, 58, 1, 0, 0, 0, 304, 305, 5, 61, 0, 0, 305, 60, 1, 0, 0, 0, 306, 307, 5, 97, 0, 0, 307, 308, 5, 99, 0, 0, 308, 309, 5, 99, 0, 0, 309, 310, 5, 111, 0, 0, 310, 311, 5, 117, 0, 0, 311, 312, 5, 110, 0, 0, 312, 313, 5, 116, 0, 0, 313, 62, 1, 0, 0, 0, 314, 315, 5, 97, 0, 0, 315, 316, 5, 115, 0, 0, 316, 317, 5, 115, 0, 0, 317, 318, 5, 101, 0, 0, 318, 319, 5, 116, 0, 0, 319, 64, 1, 0, 0, 0, 320, 321, 5, 110, 0, 0, 321, 322, 5, 117, 0, 0, 322, 323, 5, 109, 0, 0, 323, 324, 5, 98, 0, 0, 324, 325, 5, 101, 0, 0, 325, 326, 5, 114, 0, 0, 326, 66, 1, 0, 0, 0, 327, 328, 5, 109, 0, 0, 328, 329, 5, 111, 0, 0, 329, 330, 5, 110, 0, 0, 330, 331, 5, 101, 0, 0, 331, 332, 5, 116, 0, 0, 332, 333, 5, 97, 0, 0, 333, 334, 5, 114, 0, 0, 334, 335, 5, 121, 0, 0, 335, 68, 1, 0, 0, 0, 336, 337, 5, 112, 0, 0, 337, 338, 5, 111, 0, 0, 338, 339, 5, 114, 0, 0, 339, 340, 5, 116, 0, 0, 340, 341, 5, 105, 0, 0, 341, 342, 5, 111, 0, 0, 342, 343, 5, 110, 0, 0, 343, 70, 1, 0, 0, 0, 344, 345, 5, 115, 0, 0, 345, 346, 5, 116, 0, 0, 346, 347, 5, 114, 0, 0, 347, 348, 5, 105, 0, 0, 348, 349, 5, 110, 0, 0, 349, 350, 5, 103, 0, 0, 350, 72, 1, 0, 0, 0, 351, 355, 5, 34, 0, 0, 352, 354, 7, 2, 0, 0, 353, 352, 1, 0, 0, 0, 354, 357, 1, 0, 0, 0, 355, 353, 1, 0, 0, 0, 355, 356, 1, 0, 0, 0, 356, 358, 1, 0, 0, 0, 357, 355, 1, 0, 0, 0, 358, 359, 5, 34, 0, 0, 359, 74, 1, 0, 0, 0, 360, 362, 7, 3, 0, 0, 361, 360, 1, 0, 0, 0, 362, 363, 1, 0, 0, 0, 363, 361, 1, 0, 0, 0, 363, 364, 1, 0, 0, 0, 364, 366, 1, 0, 0, 0, 365, 367, 7, 4, 0, 0, 366, 365, 1, 0, 0, 0, 366, 367, 1, 0, 0, 0, 367, 368, 1, 0, 0, 0, 368, 370, 5, 47, 0, 0, 369, 371, 7, 4, 0, 0, 370, 369, 1, 0, 0, 0, 370, 371, 1, 0, 0, 0, 371, 373, 1, 0, 0, 0, 372, 374, 7, 3, 0, 0, 373, 372, 1, 0, 0, 0, 374, 375, 1, 0, 0, 0, 375, 373, 1, 0, 0, 0, 375, 376, 1, 0, 0, 0, 376, 392, 1, 0, 0, 0, 377, 379, 7, 3, 0, 0, 378, 377, 1, 0, 0, 0, 379, 380, 1, 0, 0, 0, 380, 378, 1, 0, 0, 0, 380, 381, 1, 0, 0, 0, 381, 388, 1, 0, 0, 0, 382, 384, 5, 46, 0, 0, 383, 385, 7, 3, 0, 0, 384, 383, 1, 0, 0, 0, 385, 386, 1, 0, 0, 0, 386, 384, 1, 0, 0, 0, 386, 387, 1, 0, 0, 0, 387, 389, 1, 0, 0, 0, 388, 382, 1, 0, 0, 0, 388, 389, 1, 0, 0, 0, 389, 390, 1, 0, 0, 0, 390, 392, 5, 37, 0, 0, 391, 361, 1, 0, 0, 0, 391, 378, 1, 0, 0, 0, 392, 76, 1, 0, 0, 0, 393, 394, 5, 114, 0, 0, 394, 395, 5, 101, 0, 0, 395, 396, 5, 109, 0, 0, 396, 397, 5, 97, 0, 0, 397, 398, 5, 105, 0, 0, 398, 399, 5, 110, 0, 0, 399, 400, 5, 105, 0, 0, 400, 401, 5, 110, 0, 0, 401, 402, 5, 103, 0, 0, 402, 78, 1, 0, 0, 0, 403, 404, 5, 107, 0, 0, 404, 405, 5, 101, 0, 0, 405, 406, 5, 112, 0, 0, 406, 407, 5, 116, 0, 0, 407, 80, 1, 0, 0, 0, 408, 409, 5, 98, 0, 0, 409, 410, 5, 97, 0, 0, 410, 411, 5, 108, 0, 0, 411, 412, 5, 97, 0, 0, 412, 413, 5, 110, 0, 0, 413, 414, 5, 99, 0, 0, 414, 415, 5, 101, 0, 0, 415, 82, 1, 0, 0, 0, 416, 417, 5, 115, 0, 0, 417, 418, 5, 97, 0, 0, 418, 419, 5, 118, 0, 0, 419, 420, 5, 101, 0, 0, 420, 84, 1, 0, 0, 0, 421, 423, 7, 3, 0, 0, 422, 421, 1, 0, 0, 0, 423, 424, 1, 0, 0, 0, 424, 422, 1, 0, 0, 0, 424, 425, 1, 0, 0, 0, 425, 86, 1, 0, 0, 0, 426, 427, 5, 37, 0, 0, 427, 88, 1, 0, 0, 0, 428, 430, 5, 36, 0, 0, 429, 431, 7, 5, 0, 0, 430, 429, 1, 0, 0, 0, 431, 432, 1, 0, 0, 0, 432, 430, 1, 0, 0, 0, 432, 433, 1, 0, 0, 0, 433, 437, 1, 0, 0, 0, 434, 436, 7, 6, 0, 0, 435, 434, 1, 0, 0, 0, 436, 439, 1, 0, 0, 0, 437, 435, 1, 0, 0, 0, 437, 438, 1, 0, 0, 0, 438, 90, 1, 0, 0, 0, 439, 437, 1, 0, 0, 0, 440, 442, 5, 64, 0, 0, 441, 443, 7, 7, 0, 0, 442, 441, 1, 0, 0, 0, 443, 444, 1, 0, 0, 0, 444, 442, 1, 0, 0, 0, 444, 445, 1, 0, 0, 0, 445, 449, 1, 0, 0, 0, 446, 448, 7, 8, 0, 0, 447, 446, 1, 0, 0, 0, 448, 451, 1, 0, 0, 0, 449, 447, 1, 0, 0, 0, 449, 450, 1, 0, 0, 0, 450, 92, 1, 0, 0, 0, 451, 449, 1, 0, 0, 0, 452, 454, 7, 9, 0, 0, 453, 452, 1, 0, 0, 0, 454, 455, 1, 0, 0, 0, 455, 453, 1, 0, 0, 0, 455, 456, 1, 0, 0, 0, 456, 94, 1, 0, 0, 0, 21, 0, 156, 161, 170, 172, 186, 355, 363, 366, 370, 375, 380, 386, 388, 391, 424, 432, 437, 444, 449, 455, 1, 6, 0, 0] +[4, 0, 47, 457, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 4, 4, 155, 8, 4, 11, 4, 12, 4, 156, 1, 5, 4, 5, 160, 8, 5, 11, 5, 12, 5, 161, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 5, 6, 171, 8, 6, 10, 6, 12, 6, 174, 9, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 5, 7, 185, 8, 7, 10, 7, 12, 7, 188, 9, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 22, 1, 22, 1, 23, 1, 23, 1, 24, 1, 24, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 1, 27, 1, 28, 1, 28, 1, 29, 1, 29, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 36, 1, 36, 5, 36, 354, 8, 36, 10, 36, 12, 36, 357, 9, 36, 1, 36, 1, 36, 1, 37, 4, 37, 362, 8, 37, 11, 37, 12, 37, 363, 1, 37, 3, 37, 367, 8, 37, 1, 37, 1, 37, 3, 37, 371, 8, 37, 1, 37, 4, 37, 374, 8, 37, 11, 37, 12, 37, 375, 1, 37, 4, 37, 379, 8, 37, 11, 37, 12, 37, 380, 1, 37, 1, 37, 4, 37, 385, 8, 37, 11, 37, 12, 37, 386, 3, 37, 389, 8, 37, 1, 37, 3, 37, 392, 8, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 42, 4, 42, 423, 8, 42, 11, 42, 12, 42, 424, 1, 43, 1, 43, 1, 44, 1, 44, 4, 44, 431, 8, 44, 11, 44, 12, 44, 432, 1, 44, 5, 44, 436, 8, 44, 10, 44, 12, 44, 439, 9, 44, 1, 45, 1, 45, 4, 45, 443, 8, 45, 11, 45, 12, 45, 444, 1, 45, 5, 45, 448, 8, 45, 10, 45, 12, 45, 451, 9, 45, 1, 46, 4, 46, 454, 8, 46, 11, 46, 12, 46, 455, 2, 172, 186, 0, 47, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 19, 39, 20, 41, 21, 43, 22, 45, 23, 47, 24, 49, 25, 51, 26, 53, 27, 55, 28, 57, 29, 59, 30, 61, 31, 63, 32, 65, 33, 67, 34, 69, 35, 71, 36, 73, 37, 75, 38, 77, 39, 79, 40, 81, 41, 83, 42, 85, 43, 87, 44, 89, 45, 91, 46, 93, 47, 1, 0, 10, 2, 0, 10, 10, 13, 13, 2, 0, 9, 9, 32, 32, 6, 0, 32, 32, 45, 45, 48, 57, 65, 90, 95, 95, 97, 122, 1, 0, 48, 57, 1, 0, 32, 32, 2, 0, 95, 95, 97, 122, 3, 0, 48, 57, 95, 95, 97, 122, 3, 0, 65, 90, 95, 95, 97, 122, 4, 0, 48, 58, 65, 90, 95, 95, 97, 122, 2, 0, 47, 57, 65, 90, 476, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, 0, 0, 47, 1, 0, 0, 0, 0, 49, 1, 0, 0, 0, 0, 51, 1, 0, 0, 0, 0, 53, 1, 0, 0, 0, 0, 55, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 0, 61, 1, 0, 0, 0, 0, 63, 1, 0, 0, 0, 0, 65, 1, 0, 0, 0, 0, 67, 1, 0, 0, 0, 0, 69, 1, 0, 0, 0, 0, 71, 1, 0, 0, 0, 0, 73, 1, 0, 0, 0, 0, 75, 1, 0, 0, 0, 0, 77, 1, 0, 0, 0, 0, 79, 1, 0, 0, 0, 0, 81, 1, 0, 0, 0, 0, 83, 1, 0, 0, 0, 0, 85, 1, 0, 0, 0, 0, 87, 1, 0, 0, 0, 0, 89, 1, 0, 0, 0, 0, 91, 1, 0, 0, 0, 0, 93, 1, 0, 0, 0, 1, 95, 1, 0, 0, 0, 3, 97, 1, 0, 0, 0, 5, 122, 1, 0, 0, 0, 7, 151, 1, 0, 0, 0, 9, 154, 1, 0, 0, 0, 11, 159, 1, 0, 0, 0, 13, 165, 1, 0, 0, 0, 15, 180, 1, 0, 0, 0, 17, 193, 1, 0, 0, 0, 19, 198, 1, 0, 0, 0, 21, 203, 1, 0, 0, 0, 23, 215, 1, 0, 0, 0, 25, 232, 1, 0, 0, 0, 27, 238, 1, 0, 0, 0, 29, 243, 1, 0, 0, 0, 31, 248, 1, 0, 0, 0, 33, 255, 1, 0, 0, 0, 35, 260, 1, 0, 0, 0, 37, 264, 1, 0, 0, 0, 39, 276, 1, 0, 0, 0, 41, 279, 1, 0, 0, 0, 43, 288, 1, 0, 0, 0, 45, 290, 1, 0, 0, 0, 47, 292, 1, 0, 0, 0, 49, 294, 1, 0, 0, 0, 51, 296, 1, 0, 0, 0, 53, 298, 1, 0, 0, 0, 55, 300, 1, 0, 0, 0, 57, 302, 1, 0, 0, 0, 59, 304, 1, 0, 0, 0, 61, 306, 1, 0, 0, 0, 63, 314, 1, 0, 0, 0, 65, 320, 1, 0, 0, 0, 67, 327, 1, 0, 0, 0, 69, 336, 1, 0, 0, 0, 71, 344, 1, 0, 0, 0, 73, 351, 1, 0, 0, 0, 75, 391, 1, 0, 0, 0, 77, 393, 1, 0, 0, 0, 79, 403, 1, 0, 0, 0, 81, 408, 1, 0, 0, 0, 83, 416, 1, 0, 0, 0, 85, 422, 1, 0, 0, 0, 87, 426, 1, 0, 0, 0, 89, 428, 1, 0, 0, 0, 91, 440, 1, 0, 0, 0, 93, 453, 1, 0, 0, 0, 95, 96, 5, 42, 0, 0, 96, 2, 1, 0, 0, 0, 97, 98, 5, 97, 0, 0, 98, 99, 5, 108, 0, 0, 99, 100, 5, 108, 0, 0, 100, 101, 5, 111, 0, 0, 101, 102, 5, 119, 0, 0, 102, 103, 5, 105, 0, 0, 103, 104, 5, 110, 0, 0, 104, 105, 5, 103, 0, 0, 105, 106, 5, 32, 0, 0, 106, 107, 5, 111, 0, 0, 107, 108, 5, 118, 0, 0, 108, 109, 5, 101, 0, 0, 109, 110, 5, 114, 0, 0, 110, 111, 5, 100, 0, 0, 111, 112, 5, 114, 0, 0, 112, 113, 5, 97, 0, 0, 113, 114, 5, 102, 0, 0, 114, 115, 5, 116, 0, 0, 115, 116, 5, 32, 0, 0, 116, 117, 5, 117, 0, 0, 117, 118, 5, 112, 0, 0, 118, 119, 5, 32, 0, 0, 119, 120, 5, 116, 0, 0, 120, 121, 5, 111, 0, 0, 121, 4, 1, 0, 0, 0, 122, 123, 5, 97, 0, 0, 123, 124, 5, 108, 0, 0, 124, 125, 5, 108, 0, 0, 125, 126, 5, 111, 0, 0, 126, 127, 5, 119, 0, 0, 127, 128, 5, 105, 0, 0, 128, 129, 5, 110, 0, 0, 129, 130, 5, 103, 0, 0, 130, 131, 5, 32, 0, 0, 131, 132, 5, 117, 0, 0, 132, 133, 5, 110, 0, 0, 133, 134, 5, 98, 0, 0, 134, 135, 5, 111, 0, 0, 135, 136, 5, 117, 0, 0, 136, 137, 5, 110, 0, 0, 137, 138, 5, 100, 0, 0, 138, 139, 5, 101, 0, 0, 139, 140, 5, 100, 0, 0, 140, 141, 5, 32, 0, 0, 141, 142, 5, 111, 0, 0, 142, 143, 5, 118, 0, 0, 143, 144, 5, 101, 0, 0, 144, 145, 5, 114, 0, 0, 145, 146, 5, 100, 0, 0, 146, 147, 5, 114, 0, 0, 147, 148, 5, 97, 0, 0, 148, 149, 5, 102, 0, 0, 149, 150, 5, 116, 0, 0, 150, 6, 1, 0, 0, 0, 151, 152, 5, 44, 0, 0, 152, 8, 1, 0, 0, 0, 153, 155, 7, 0, 0, 0, 154, 153, 1, 0, 0, 0, 155, 156, 1, 0, 0, 0, 156, 154, 1, 0, 0, 0, 156, 157, 1, 0, 0, 0, 157, 10, 1, 0, 0, 0, 158, 160, 7, 1, 0, 0, 159, 158, 1, 0, 0, 0, 160, 161, 1, 0, 0, 0, 161, 159, 1, 0, 0, 0, 161, 162, 1, 0, 0, 0, 162, 163, 1, 0, 0, 0, 163, 164, 6, 5, 0, 0, 164, 12, 1, 0, 0, 0, 165, 166, 5, 47, 0, 0, 166, 167, 5, 42, 0, 0, 167, 172, 1, 0, 0, 0, 168, 171, 3, 13, 6, 0, 169, 171, 9, 0, 0, 0, 170, 168, 1, 0, 0, 0, 170, 169, 1, 0, 0, 0, 171, 174, 1, 0, 0, 0, 172, 173, 1, 0, 0, 0, 172, 170, 1, 0, 0, 0, 173, 175, 1, 0, 0, 0, 174, 172, 1, 0, 0, 0, 175, 176, 5, 42, 0, 0, 176, 177, 5, 47, 0, 0, 177, 178, 1, 0, 0, 0, 178, 179, 6, 6, 0, 0, 179, 14, 1, 0, 0, 0, 180, 181, 5, 47, 0, 0, 181, 182, 5, 47, 0, 0, 182, 186, 1, 0, 0, 0, 183, 185, 9, 0, 0, 0, 184, 183, 1, 0, 0, 0, 185, 188, 1, 0, 0, 0, 186, 187, 1, 0, 0, 0, 186, 184, 1, 0, 0, 0, 187, 189, 1, 0, 0, 0, 188, 186, 1, 0, 0, 0, 189, 190, 3, 9, 4, 0, 190, 191, 1, 0, 0, 0, 191, 192, 6, 7, 0, 0, 192, 16, 1, 0, 0, 0, 193, 194, 5, 118, 0, 0, 194, 195, 5, 97, 0, 0, 195, 196, 5, 114, 0, 0, 196, 197, 5, 115, 0, 0, 197, 18, 1, 0, 0, 0, 198, 199, 5, 109, 0, 0, 199, 200, 5, 101, 0, 0, 200, 201, 5, 116, 0, 0, 201, 202, 5, 97, 0, 0, 202, 20, 1, 0, 0, 0, 203, 204, 5, 115, 0, 0, 204, 205, 5, 101, 0, 0, 205, 206, 5, 116, 0, 0, 206, 207, 5, 95, 0, 0, 207, 208, 5, 116, 0, 0, 208, 209, 5, 120, 0, 0, 209, 210, 5, 95, 0, 0, 210, 211, 5, 109, 0, 0, 211, 212, 5, 101, 0, 0, 212, 213, 5, 116, 0, 0, 213, 214, 5, 97, 0, 0, 214, 22, 1, 0, 0, 0, 215, 216, 5, 115, 0, 0, 216, 217, 5, 101, 0, 0, 217, 218, 5, 116, 0, 0, 218, 219, 5, 95, 0, 0, 219, 220, 5, 97, 0, 0, 220, 221, 5, 99, 0, 0, 221, 222, 5, 99, 0, 0, 222, 223, 5, 111, 0, 0, 223, 224, 5, 117, 0, 0, 224, 225, 5, 110, 0, 0, 225, 226, 5, 116, 0, 0, 226, 227, 5, 95, 0, 0, 227, 228, 5, 109, 0, 0, 228, 229, 5, 101, 0, 0, 229, 230, 5, 116, 0, 0, 230, 231, 5, 97, 0, 0, 231, 24, 1, 0, 0, 0, 232, 233, 5, 112, 0, 0, 233, 234, 5, 114, 0, 0, 234, 235, 5, 105, 0, 0, 235, 236, 5, 110, 0, 0, 236, 237, 5, 116, 0, 0, 237, 26, 1, 0, 0, 0, 238, 239, 5, 102, 0, 0, 239, 240, 5, 97, 0, 0, 240, 241, 5, 105, 0, 0, 241, 242, 5, 108, 0, 0, 242, 28, 1, 0, 0, 0, 243, 244, 5, 115, 0, 0, 244, 245, 5, 101, 0, 0, 245, 246, 5, 110, 0, 0, 246, 247, 5, 100, 0, 0, 247, 30, 1, 0, 0, 0, 248, 249, 5, 115, 0, 0, 249, 250, 5, 111, 0, 0, 250, 251, 5, 117, 0, 0, 251, 252, 5, 114, 0, 0, 252, 253, 5, 99, 0, 0, 253, 254, 5, 101, 0, 0, 254, 32, 1, 0, 0, 0, 255, 256, 5, 102, 0, 0, 256, 257, 5, 114, 0, 0, 257, 258, 5, 111, 0, 0, 258, 259, 5, 109, 0, 0, 259, 34, 1, 0, 0, 0, 260, 261, 5, 109, 0, 0, 261, 262, 5, 97, 0, 0, 262, 263, 5, 120, 0, 0, 263, 36, 1, 0, 0, 0, 264, 265, 5, 100, 0, 0, 265, 266, 5, 101, 0, 0, 266, 267, 5, 115, 0, 0, 267, 268, 5, 116, 0, 0, 268, 269, 5, 105, 0, 0, 269, 270, 5, 110, 0, 0, 270, 271, 5, 97, 0, 0, 271, 272, 5, 116, 0, 0, 272, 273, 5, 105, 0, 0, 273, 274, 5, 111, 0, 0, 274, 275, 5, 110, 0, 0, 275, 38, 1, 0, 0, 0, 276, 277, 5, 116, 0, 0, 277, 278, 5, 111, 0, 0, 278, 40, 1, 0, 0, 0, 279, 280, 5, 97, 0, 0, 280, 281, 5, 108, 0, 0, 281, 282, 5, 108, 0, 0, 282, 283, 5, 111, 0, 0, 283, 284, 5, 99, 0, 0, 284, 285, 5, 97, 0, 0, 285, 286, 5, 116, 0, 0, 286, 287, 5, 101, 0, 0, 287, 42, 1, 0, 0, 0, 288, 289, 5, 43, 0, 0, 289, 44, 1, 0, 0, 0, 290, 291, 5, 45, 0, 0, 291, 46, 1, 0, 0, 0, 292, 293, 5, 40, 0, 0, 293, 48, 1, 0, 0, 0, 294, 295, 5, 41, 0, 0, 295, 50, 1, 0, 0, 0, 296, 297, 5, 91, 0, 0, 297, 52, 1, 0, 0, 0, 298, 299, 5, 93, 0, 0, 299, 54, 1, 0, 0, 0, 300, 301, 5, 123, 0, 0, 301, 56, 1, 0, 0, 0, 302, 303, 5, 125, 0, 0, 303, 58, 1, 0, 0, 0, 304, 305, 5, 61, 0, 0, 305, 60, 1, 0, 0, 0, 306, 307, 5, 97, 0, 0, 307, 308, 5, 99, 0, 0, 308, 309, 5, 99, 0, 0, 309, 310, 5, 111, 0, 0, 310, 311, 5, 117, 0, 0, 311, 312, 5, 110, 0, 0, 312, 313, 5, 116, 0, 0, 313, 62, 1, 0, 0, 0, 314, 315, 5, 97, 0, 0, 315, 316, 5, 115, 0, 0, 316, 317, 5, 115, 0, 0, 317, 318, 5, 101, 0, 0, 318, 319, 5, 116, 0, 0, 319, 64, 1, 0, 0, 0, 320, 321, 5, 110, 0, 0, 321, 322, 5, 117, 0, 0, 322, 323, 5, 109, 0, 0, 323, 324, 5, 98, 0, 0, 324, 325, 5, 101, 0, 0, 325, 326, 5, 114, 0, 0, 326, 66, 1, 0, 0, 0, 327, 328, 5, 109, 0, 0, 328, 329, 5, 111, 0, 0, 329, 330, 5, 110, 0, 0, 330, 331, 5, 101, 0, 0, 331, 332, 5, 116, 0, 0, 332, 333, 5, 97, 0, 0, 333, 334, 5, 114, 0, 0, 334, 335, 5, 121, 0, 0, 335, 68, 1, 0, 0, 0, 336, 337, 5, 112, 0, 0, 337, 338, 5, 111, 0, 0, 338, 339, 5, 114, 0, 0, 339, 340, 5, 116, 0, 0, 340, 341, 5, 105, 0, 0, 341, 342, 5, 111, 0, 0, 342, 343, 5, 110, 0, 0, 343, 70, 1, 0, 0, 0, 344, 345, 5, 115, 0, 0, 345, 346, 5, 116, 0, 0, 346, 347, 5, 114, 0, 0, 347, 348, 5, 105, 0, 0, 348, 349, 5, 110, 0, 0, 349, 350, 5, 103, 0, 0, 350, 72, 1, 0, 0, 0, 351, 355, 5, 34, 0, 0, 352, 354, 7, 2, 0, 0, 353, 352, 1, 0, 0, 0, 354, 357, 1, 0, 0, 0, 355, 353, 1, 0, 0, 0, 355, 356, 1, 0, 0, 0, 356, 358, 1, 0, 0, 0, 357, 355, 1, 0, 0, 0, 358, 359, 5, 34, 0, 0, 359, 74, 1, 0, 0, 0, 360, 362, 7, 3, 0, 0, 361, 360, 1, 0, 0, 0, 362, 363, 1, 0, 0, 0, 363, 361, 1, 0, 0, 0, 363, 364, 1, 0, 0, 0, 364, 366, 1, 0, 0, 0, 365, 367, 7, 4, 0, 0, 366, 365, 1, 0, 0, 0, 366, 367, 1, 0, 0, 0, 367, 368, 1, 0, 0, 0, 368, 370, 5, 47, 0, 0, 369, 371, 7, 4, 0, 0, 370, 369, 1, 0, 0, 0, 370, 371, 1, 0, 0, 0, 371, 373, 1, 0, 0, 0, 372, 374, 7, 3, 0, 0, 373, 372, 1, 0, 0, 0, 374, 375, 1, 0, 0, 0, 375, 373, 1, 0, 0, 0, 375, 376, 1, 0, 0, 0, 376, 392, 1, 0, 0, 0, 377, 379, 7, 3, 0, 0, 378, 377, 1, 0, 0, 0, 379, 380, 1, 0, 0, 0, 380, 378, 1, 0, 0, 0, 380, 381, 1, 0, 0, 0, 381, 388, 1, 0, 0, 0, 382, 384, 5, 46, 0, 0, 383, 385, 7, 3, 0, 0, 384, 383, 1, 0, 0, 0, 385, 386, 1, 0, 0, 0, 386, 384, 1, 0, 0, 0, 386, 387, 1, 0, 0, 0, 387, 389, 1, 0, 0, 0, 388, 382, 1, 0, 0, 0, 388, 389, 1, 0, 0, 0, 389, 390, 1, 0, 0, 0, 390, 392, 5, 37, 0, 0, 391, 361, 1, 0, 0, 0, 391, 378, 1, 0, 0, 0, 392, 76, 1, 0, 0, 0, 393, 394, 5, 114, 0, 0, 394, 395, 5, 101, 0, 0, 395, 396, 5, 109, 0, 0, 396, 397, 5, 97, 0, 0, 397, 398, 5, 105, 0, 0, 398, 399, 5, 110, 0, 0, 399, 400, 5, 105, 0, 0, 400, 401, 5, 110, 0, 0, 401, 402, 5, 103, 0, 0, 402, 78, 1, 0, 0, 0, 403, 404, 5, 107, 0, 0, 404, 405, 5, 101, 0, 0, 405, 406, 5, 112, 0, 0, 406, 407, 5, 116, 0, 0, 407, 80, 1, 0, 0, 0, 408, 409, 5, 98, 0, 0, 409, 410, 5, 97, 0, 0, 410, 411, 5, 108, 0, 0, 411, 412, 5, 97, 0, 0, 412, 413, 5, 110, 0, 0, 413, 414, 5, 99, 0, 0, 414, 415, 5, 101, 0, 0, 415, 82, 1, 0, 0, 0, 416, 417, 5, 115, 0, 0, 417, 418, 5, 97, 0, 0, 418, 419, 5, 118, 0, 0, 419, 420, 5, 101, 0, 0, 420, 84, 1, 0, 0, 0, 421, 423, 7, 3, 0, 0, 422, 421, 1, 0, 0, 0, 423, 424, 1, 0, 0, 0, 424, 422, 1, 0, 0, 0, 424, 425, 1, 0, 0, 0, 425, 86, 1, 0, 0, 0, 426, 427, 5, 37, 0, 0, 427, 88, 1, 0, 0, 0, 428, 430, 5, 36, 0, 0, 429, 431, 7, 5, 0, 0, 430, 429, 1, 0, 0, 0, 431, 432, 1, 0, 0, 0, 432, 430, 1, 0, 0, 0, 432, 433, 1, 0, 0, 0, 433, 437, 1, 0, 0, 0, 434, 436, 7, 6, 0, 0, 435, 434, 1, 0, 0, 0, 436, 439, 1, 0, 0, 0, 437, 435, 1, 0, 0, 0, 437, 438, 1, 0, 0, 0, 438, 90, 1, 0, 0, 0, 439, 437, 1, 0, 0, 0, 440, 442, 5, 64, 0, 0, 441, 443, 7, 7, 0, 0, 442, 441, 1, 0, 0, 0, 443, 444, 1, 0, 0, 0, 444, 442, 1, 0, 0, 0, 444, 445, 1, 0, 0, 0, 445, 449, 1, 0, 0, 0, 446, 448, 7, 8, 0, 0, 447, 446, 1, 0, 0, 0, 448, 451, 1, 0, 0, 0, 449, 447, 1, 0, 0, 0, 449, 450, 1, 0, 0, 0, 450, 92, 1, 0, 0, 0, 451, 449, 1, 0, 0, 0, 452, 454, 7, 9, 0, 0, 453, 452, 1, 0, 0, 0, 454, 455, 1, 0, 0, 0, 455, 453, 1, 0, 0, 0, 455, 456, 1, 0, 0, 0, 456, 94, 1, 0, 0, 0, 21, 0, 156, 161, 170, 172, 186, 355, 363, 366, 370, 375, 380, 386, 388, 391, 424, 432, 437, 444, 449, 455, 1, 6, 0, 0] \ No newline at end of file diff --git a/internal/storage/driver/cli.go b/internal/storage/driver/cli.go index 5290220d8..3d3f27946 100644 --- a/internal/storage/driver/cli.go +++ b/internal/storage/driver/cli.go @@ -6,11 +6,9 @@ import ( "time" storage "github.com/formancehq/ledger/internal/storage" - "github.com/formancehq/stack/libs/go-libs/health" "github.com/formancehq/stack/libs/go-libs/logging" "github.com/spf13/cobra" "github.com/spf13/viper" - "github.com/uptrace/bun" "go.uber.org/fx" ) @@ -21,7 +19,7 @@ func InitCLIFlags(cmd *cobra.Command) { cmd.PersistentFlags().Int(storage.StoreWorkerMaxPendingSize, 0, "Max pending size for store worker") cmd.PersistentFlags().Int(storage.StoreWorkerMaxWriteChanSize, 1024, "Max write channel size for store worker") cmd.PersistentFlags().String(storage.StoragePostgresConnectionStringFlag, "postgresql://localhost/postgres", "Postgres connection string") - cmd.PersistentFlags().Int(storage.StoragePostgresMaxIdleConnsFlag, 20, "Max idle connections to database") + cmd.PersistentFlags().Int(storage.StoragePostgresMaxIdleConnsFlag, 0, "Max idle connections to database") cmd.PersistentFlags().Duration(storage.StoragePostgresConnMaxIdleTimeFlag, time.Minute, "Max idle time of idle connections") cmd.PersistentFlags().Int(storage.StoragePostgresMaxOpenConns, 20, "Max open connections") } @@ -30,35 +28,27 @@ type PostgresConfig struct { ConnString string } -type ModuleConfig struct { - PostgresConnectionOptions storage.ConnectionOptions - Debug bool -} - func CLIModule(v *viper.Viper, output io.Writer, debug bool) fx.Option { options := make([]fx.Option, 0) - options = append(options, fx.Provide(func(logger logging.Logger) (*bun.DB, error) { - configuration := storage.ConnectionOptionsFromFlags(v, output, debug) - logger.WithField("config", configuration).Infof("Opening connection to database...") - return storage.OpenSQLDB(configuration) - })) - options = append(options, fx.Provide(func(db *bun.DB) (*Driver, error) { - return New(db), nil + options = append(options, fx.Provide(func(logger logging.Logger) storage.ConnectionOptions { + connectionOptions := storage.ConnectionOptionsFromFlags(v, output, debug) + logger.WithField("config", connectionOptions).Infof("Opening connection to database...") + return connectionOptions })) - options = append(options, health.ProvideHealthCheck(func(db *bun.DB) health.NamedCheck { - return health.NewNamedCheck("postgres", health.CheckFn(db.PingContext)) + options = append(options, fx.Provide(func(connectionOptions storage.ConnectionOptions) (*Driver, error) { + return New(connectionOptions), nil })) - options = append(options, fx.Invoke(func(db *bun.DB, driver *Driver, lifecycle fx.Lifecycle, logger logging.Logger) error { + options = append(options, fx.Invoke(func(driver *Driver, lifecycle fx.Lifecycle, logger logging.Logger) error { lifecycle.Append(fx.Hook{ OnStart: func(ctx context.Context) error { logger.Infof("Initializing database...") return driver.Initialize(ctx) }, OnStop: func(ctx context.Context) error { - logger.Infof("Closing database...") - return db.Close() + logger.Infof("Closing driver...") + return driver.Close() }, }) return nil diff --git a/internal/storage/driver/driver.go b/internal/storage/driver/driver.go index 6cdcf801a..52ebb91c9 100644 --- a/internal/storage/driver/driver.go +++ b/internal/storage/driver/driver.go @@ -2,9 +2,8 @@ package driver import ( "context" - "database/sql" - "database/sql/driver" "fmt" + "net/url" "sync" "github.com/formancehq/ledger/internal/storage" @@ -13,71 +12,29 @@ import ( "github.com/formancehq/stack/libs/go-libs/logging" "github.com/pkg/errors" "github.com/uptrace/bun" - "go.nhat.io/otelsql" ) const SystemSchema = "_system" -type pgxDriver struct { - driverName string -} - -var pgxSqlDriver pgxDriver - -type otelSQLDriverWithCheckNamedValueDisabled struct { - driver.Driver -} - -func (d otelSQLDriverWithCheckNamedValueDisabled) CheckNamedValue(*driver.NamedValue) error { - return nil -} - -var _ = driver.NamedValueChecker(&otelSQLDriverWithCheckNamedValueDisabled{}) - -func init() { - // Default mapping for app driver/sql driver - pgxSqlDriver.driverName = "pgx" -} - -// todo: since se use pq, this is probably useless -func InstrumentalizeSQLDriver() { - // otelsql has a function Register which wrap the underlying driver, but does not mirror driver.NamedValuedChecker interface of the underlying driver - // pgx implements this interface and just return nil - // so, we need to manually wrap the driver to implements this interface and return a nil error - db, err := sql.Open("pgx", "") - if err != nil { - panic(err) - } - - dri := db.Driver() - - if err = db.Close(); err != nil { - panic(err) - } - - wrappedDriver := otelsql.Wrap(dri, - otelsql.AllowRoot(), - otelsql.TraceAll(), - ) - - pgxSqlDriver.driverName = fmt.Sprintf("otel-%s", pgxSqlDriver.driverName) - sql.Register(pgxSqlDriver.driverName, otelSQLDriverWithCheckNamedValueDisabled{ - wrappedDriver, - }) -} - type Driver struct { - db *bun.DB - systemStore *systemstore.Store - lock sync.Mutex + systemStore *systemstore.Store + lock sync.Mutex + connectionOptions storage.ConnectionOptions + db *bun.DB + databasesBySchema map[string]*bun.DB } func (d *Driver) GetSystemStore() *systemstore.Store { return d.systemStore } -func (d *Driver) newStore(name string) (*ledgerstore.Store, error) { - return ledgerstore.New(d.db, name, func(ctx context.Context) error { +func (d *Driver) newLedgerStore(name string) (*ledgerstore.Store, error) { + db, err := d.openDBWithSchema(name) + if err != nil { + return nil, err + } + + return ledgerstore.New(db, name, func(ctx context.Context) error { return d.GetSystemStore().DeleteLedger(ctx, name) }) } @@ -100,7 +57,7 @@ func (d *Driver) createLedgerStore(ctx context.Context, name string) (*ledgersto return nil, err } - store, err := d.newStore(name) + store, err := d.newLedgerStore(name) if err != nil { return nil, err } @@ -130,7 +87,7 @@ func (d *Driver) GetLedgerStore(ctx context.Context, name string) (*ledgerstore. if !exists { store, err = d.createLedgerStore(ctx, name) } else { - store, err = d.newStore(name) + store, err = d.newLedgerStore(name) } if err != nil { return nil, err @@ -139,10 +96,34 @@ func (d *Driver) GetLedgerStore(ctx context.Context, name string) (*ledgerstore. return store, nil } +func (d *Driver) openDBWithSchema(schema string) (*bun.DB, error) { + parsedConnectionParams, err := url.Parse(d.connectionOptions.DatabaseSourceName) + if err != nil { + return nil, storage.PostgresError(err) + } + + query := parsedConnectionParams.Query() + query.Set("search_path", schema) + parsedConnectionParams.RawQuery = query.Encode() + + connectionOptions := d.connectionOptions + connectionOptions.DatabaseSourceName = parsedConnectionParams.String() + + db, err := storage.OpenSQLDB(connectionOptions) + if err != nil { + return nil, err + } + + d.databasesBySchema[schema] = db + + return db, nil +} + func (d *Driver) Initialize(ctx context.Context) error { logging.FromContext(ctx).Debugf("Initialize driver") - _, err := d.db.ExecContext(ctx, "create extension if not exists pgcrypto") + var err error + d.db, err = storage.OpenSQLDB(d.connectionOptions) if err != nil { return storage.PostgresError(err) } @@ -152,7 +133,12 @@ func (d *Driver) Initialize(ctx context.Context) error { return storage.PostgresError(err) } - d.systemStore = systemstore.NewStore(d.db) + dbWithSystemSchema, err := d.openDBWithSchema(SystemSchema) + if err != nil { + return storage.PostgresError(err) + } + + d.systemStore = systemstore.NewStore(dbWithSystemSchema) if err := d.systemStore.Initialize(ctx); err != nil { return err @@ -183,8 +169,23 @@ func (d *Driver) UpgradeAllLedgersSchemas(ctx context.Context) error { return nil } -func New(db *bun.DB) *Driver { +func (d *Driver) Close() error { + if d.db != nil { + if err := d.db.Close(); err != nil { + return err + } + } + for _, db := range d.databasesBySchema { + if err := db.Close(); err != nil { + return err + } + } + return nil +} + +func New(connectionOptions storage.ConnectionOptions) *Driver { return &Driver{ - db: db, + connectionOptions: connectionOptions, + databasesBySchema: make(map[string]*bun.DB), } } diff --git a/internal/storage/ledgerstore/accounts.go b/internal/storage/ledgerstore/accounts.go index 4a1c8556f..15a6884a7 100644 --- a/internal/storage/ledgerstore/accounts.go +++ b/internal/storage/ledgerstore/accounts.go @@ -156,7 +156,7 @@ func (store *Store) GetAccountWithVolumes(ctx context.Context, q GetAccountQuery return account, nil } -func (store *Store) CountAccounts(ctx context.Context, q *GetAccountsQuery) (uint64, error) { +func (store *Store) CountAccounts(ctx context.Context, q *GetAccountsQuery) (int, error) { return count(store, ctx, func(query *bun.SelectQuery) *bun.SelectQuery { return store.buildAccountListQuery(query, q) }) diff --git a/internal/storage/ledgerstore/logs.go b/internal/storage/ledgerstore/logs.go index d282cc2e3..d2571993f 100644 --- a/internal/storage/ledgerstore/logs.go +++ b/internal/storage/ledgerstore/logs.go @@ -33,6 +33,7 @@ type Logs struct { } func (log *Logs) ToCore() *ledger.ChainedLog { + payload, err := ledger.HydrateLog(ledger.LogTypeFromString(log.Type), log.Data) if err != nil { panic(errors.Wrap(err, "hydrating log data")) diff --git a/internal/storage/ledgerstore/main_test.go b/internal/storage/ledgerstore/main_test.go index 57be485d4..8e54a2795 100644 --- a/internal/storage/ledgerstore/main_test.go +++ b/internal/storage/ledgerstore/main_test.go @@ -32,20 +32,17 @@ func newLedgerStore(t *testing.T) *ledgerstore.Store { t.Helper() pgServer := pgtesting.NewPostgresDatabase(t) - db, err := storage.OpenSQLDB(storage.ConnectionOptions{ + + ctx := logging.TestingContext() + driver := driver.New(storage.ConnectionOptions{ DatabaseSourceName: pgServer.ConnString(), Debug: testing.Verbose(), - }, - //&explainHook{}, - ) - require.NoError(t, err) + }) + require.NoError(t, driver.Initialize(ctx)) t.Cleanup(func() { - require.NoError(t, db.Close()) + require.NoError(t, driver.Close()) }) - ctx := logging.TestingContext() - driver := driver.New(db) - require.NoError(t, driver.Initialize(ctx)) ledgerStore, err := driver.CreateLedgerStore(ctx, uuid.NewString()) require.NoError(t, err) diff --git a/internal/storage/ledgerstore/transactions.go b/internal/storage/ledgerstore/transactions.go index e7bbad694..3d66f9288 100644 --- a/internal/storage/ledgerstore/transactions.go +++ b/internal/storage/ledgerstore/transactions.go @@ -230,7 +230,7 @@ func (store *Store) GetTransactions(ctx context.Context, q *GetTransactionsQuery }), nil } -func (store *Store) CountTransactions(ctx context.Context, q *GetTransactionsQuery) (uint64, error) { +func (store *Store) CountTransactions(ctx context.Context, q *GetTransactionsQuery) (int, error) { return count(store, ctx, func(query *bun.SelectQuery) *bun.SelectQuery { return store.buildTransactionListQuery(query, q.Options) }) diff --git a/internal/storage/ledgerstore/transactions_test.go b/internal/storage/ledgerstore/transactions_test.go index c93d86f4b..27c4c7df5 100644 --- a/internal/storage/ledgerstore/transactions_test.go +++ b/internal/storage/ledgerstore/transactions_test.go @@ -575,7 +575,7 @@ func TestCountTransactions(t *testing.T) { count, err := store.CountTransactions(context.Background(), ledgerstore.NewGetTransactionsQuery(ledgerstore.NewPaginatedQueryOptions(ledgerstore.PITFilterWithVolumes{}))) require.NoError(t, err, "counting transactions should not fail") - require.Equal(t, uint64(3), count, "count should be equal") + require.Equal(t, 3, count, "count should be equal") } func TestUpdateTransactionsMetadata(t *testing.T) { diff --git a/internal/storage/ledgerstore/utils.go b/internal/storage/ledgerstore/utils.go index e47f2c36b..c769797d7 100644 --- a/internal/storage/ledgerstore/utils.go +++ b/internal/storage/ledgerstore/utils.go @@ -15,20 +15,20 @@ import ( ) func fetch[T any](s *Store, ctx context.Context, builders ...func(query *bun.SelectQuery) *bun.SelectQuery) (T, error) { + var ret T ret = reflect.New(reflect.TypeOf(ret).Elem()).Interface().(T) - err := s.withTransaction(ctx, func(tx bun.Tx) error { - query := s.db.NewSelect().Conn(tx) - for _, builder := range builders { - query = query.Apply(builder) - } - if query.GetTableName() == "" && query.GetModel() == nil { - //query = query.Model(ret) - } - return storage.PostgresError(query.Scan(ctx, ret)) - }) - return ret, err + query := s.db.NewSelect() + for _, builder := range builders { + query = query.Apply(builder) + } + + if err := query.Scan(ctx, ret); err != nil { + return ret, storage.PostgresError(err) + } + + return ret, nil } func fetchAndMap[T any, TO any](s *Store, ctx context.Context, @@ -44,14 +44,9 @@ func fetchAndMap[T any, TO any](s *Store, ctx context.Context, func paginateWithOffset[FILTERS any, RETURN any](s *Store, ctx context.Context, q *paginate.OffsetPaginatedQuery[FILTERS], builders ...func(query *bun.SelectQuery) *bun.SelectQuery) (*api.Cursor[RETURN], error) { - tx, err := s.prepareTransaction(ctx) - if err != nil { - return nil, err - } - defer tx.Rollback() var ret RETURN - query := s.db.NewSelect().Conn(tx) + query := s.db.NewSelect() for _, builder := range builders { query = query.Apply(builder) } @@ -63,13 +58,7 @@ func paginateWithOffset[FILTERS any, RETURN any](s *Store, ctx context.Context, } func paginateWithColumn[FILTERS any, RETURN any](s *Store, ctx context.Context, q *paginate.ColumnPaginatedQuery[FILTERS], builders ...func(query *bun.SelectQuery) *bun.SelectQuery) (*api.Cursor[RETURN], error) { - tx, err := s.prepareTransaction(ctx) - if err != nil { - return nil, err - } - defer tx.Rollback() - - query := s.db.NewSelect().Conn(tx) + query := s.db.NewSelect() for _, builder := range builders { query = query.Apply(builder) } @@ -77,25 +66,14 @@ func paginateWithColumn[FILTERS any, RETURN any](s *Store, ctx context.Context, return paginate.UsingColumn[FILTERS, RETURN](ctx, query, *q) } -func count(s *Store, ctx context.Context, builders ...func(query *bun.SelectQuery) *bun.SelectQuery) (uint64, error) { - var ( - count int - err error - ) - if err := s.withTransaction(ctx, func(tx bun.Tx) error { - query := s.db.NewSelect() - for _, builder := range builders { - query = query.Apply(builder) - } - count, err = s.db.NewSelect(). - TableExpr("(" + query.String() + ") data"). - Conn(tx). - Count(ctx) - return err - }); err != nil { - return 0, err +func count(s *Store, ctx context.Context, builders ...func(query *bun.SelectQuery) *bun.SelectQuery) (int, error) { + query := s.db.NewSelect() + for _, builder := range builders { + query = query.Apply(builder) } - return uint64(count), nil + return s.db.NewSelect(). + TableExpr("(" + query.String() + ") data"). + Count(ctx) } func filterAccountAddress(address, key string) string { diff --git a/internal/storage/storagetesting/storage.go b/internal/storage/storagetesting/storage.go index 8edca816c..6bb070b0b 100644 --- a/internal/storage/storagetesting/storage.go +++ b/internal/storage/storagetesting/storage.go @@ -14,20 +14,13 @@ import ( func StorageDriver(t pgtesting.TestingT) *driver.Driver { pgServer := pgtesting.NewPostgresDatabase(t) - db, err := storage.OpenSQLDB(storage.ConnectionOptions{ + d := driver.New(storage.ConnectionOptions{ DatabaseSourceName: pgServer.ConnString(), Debug: testing.Verbose(), MaxIdleConns: 40, MaxOpenConns: 40, ConnMaxIdleTime: time.Minute, }) - require.NoError(t, err) - - t.Cleanup(func() { - _ = db.Close() - }) - - d := driver.New(db) require.NoError(t, d.Initialize(context.Background())) diff --git a/libs/go.mod b/libs/go.mod index 7d088fb72..8631a570b 100644 --- a/libs/go.mod +++ b/libs/go.mod @@ -62,7 +62,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect github.com/docker/cli v20.10.17+incompatible // indirect - github.com/docker/docker v20.10.24+incompatible // indirect + github.com/docker/docker v20.10.17+incompatible // indirect github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.4.0 // indirect github.com/dustin/go-humanize v1.0.1 // indirect @@ -111,7 +111,7 @@ require ( github.com/oklog/ulid v1.3.1 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.0.2 // indirect - github.com/opencontainers/runc v1.1.5 // indirect + github.com/opencontainers/runc v1.1.3 // indirect github.com/pelletier/go-toml/v2 v2.0.6 // indirect github.com/pierrec/lz4/v4 v4.1.17 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect diff --git a/libs/go.sum b/libs/go.sum index f15f3ff53..7a1f662cd 100644 --- a/libs/go.sum +++ b/libs/go.sum @@ -110,8 +110,8 @@ github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WA github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/docker/cli v20.10.17+incompatible h1:eO2KS7ZFeov5UJeaDmIs1NFEDRf32PaqRpvoEkKBy5M= github.com/docker/cli v20.10.17+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= -github.com/docker/docker v20.10.24+incompatible h1:Ugvxm7a8+Gz6vqQYQQ2W7GYq5EUPaAiuPgIfVyI3dYE= -github.com/docker/docker v20.10.24+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v20.10.17+incompatible h1:JYCuMrWaVNophQTOrMMoSwudOVEfcegoZZrleKc1xwE= +github.com/docker/docker v20.10.17+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= @@ -348,8 +348,8 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8 github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/runc v1.1.5 h1:L44KXEpKmfWDcS02aeGm8QNTFXTo2D+8MYGDIJ/GDEs= -github.com/opencontainers/runc v1.1.5/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJHLXuG2PsnNg= +github.com/opencontainers/runc v1.1.3 h1:vIXrkId+0/J2Ymu2m7VjGvbSlAId9XNRPhn2p4b+d8w= +github.com/opencontainers/runc v1.1.3/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJHLXuG2PsnNg= github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/selinux v1.10.0/go.mod h1:2i0OySw99QjzBBQByd1Gr9gSjvuho1lHsJxIJ3gGbJI= github.com/ory/dockertest/v3 v3.9.1 h1:v4dkG+dlu76goxMiTT2j8zV7s4oPPEppKT8K8p2f1kY= diff --git a/libs/query/expression.go b/libs/query/expression.go index 47a2eb052..634deed76 100644 --- a/libs/query/expression.go +++ b/libs/query/expression.go @@ -29,6 +29,10 @@ type set struct { var _ Builder = (*set)(nil) func (set set) Build(ctx Context) (string, []any, error) { + if len(set.items) == 0 { + return "1 = 1", nil, nil + } + clauses := make([]string, 0) args := make([]any, 0) for _, builder := range set.items {