From d7f20c81870aced502ab9624786e5201d55ddd9b Mon Sep 17 00:00:00 2001 From: siyul-park Date: Fri, 20 Dec 2024 13:07:13 +0900 Subject: [PATCH] fix(deps): update mongo driver version to 2 --- Makefile | 5 +++ cmd/go.mod | 29 +++++++------- cmd/go.sum | 13 ++++--- cmd/pkg/driver/mongo.go | 6 +-- driver/mongo/go.mod | 23 +++++------ driver/mongo/go.sum | 45 ++++++++++++---------- driver/mongo/pkg/chart/store.go | 10 ++--- driver/mongo/pkg/chart/store_test.go | 16 ++++---- driver/mongo/pkg/encoding/encoding.go | 10 ++--- driver/mongo/pkg/encoding/encoding_test.go | 8 ++-- driver/mongo/pkg/secret/store.go | 10 ++--- driver/mongo/pkg/secret/store_test.go | 16 ++++---- driver/mongo/pkg/server/server.go | 8 ++-- driver/mongo/pkg/spec/store.go | 10 ++--- driver/mongo/pkg/spec/store_test.go | 16 ++++---- ext/go.mod | 4 +- ext/go.sum | 10 ++--- 17 files changed, 117 insertions(+), 122 deletions(-) diff --git a/Makefile b/Makefile index 44f3622d..029b8439 100644 --- a/Makefile +++ b/Makefile @@ -48,6 +48,11 @@ update: cd $$dir && go get -u all && go mod tidy; \ done +clean-cache: + @for dir in $(MODULE_DIRS); do \ + cd $$dir && go clean -modcache; \ + done + sync: @go work sync diff --git a/cmd/go.mod b/cmd/go.mod index b73d4907..8f723d80 100644 --- a/cmd/go.mod +++ b/cmd/go.mod @@ -3,6 +3,8 @@ module github.com/siyul-park/uniflow/cmd go 1.23.4 require ( + github.com/charmbracelet/bubbles v0.20.0 + github.com/charmbracelet/bubbletea v1.2.4 github.com/go-faker/faker/v4 v4.5.0 github.com/gofrs/uuid v4.4.0+incompatible github.com/jedib0t/go-pretty/v6 v6.6.5 @@ -14,29 +16,20 @@ require ( github.com/spf13/cobra v1.8.1 github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.10.0 - go.mongodb.org/mongo-driver v1.17.1 + github.com/tryvium-travels/memongo v0.12.0 go.mongodb.org/mongo-driver/v2 v2.0.0 gopkg.in/yaml.v3 v3.0.1 ) require ( cel.dev/expr v0.19.1 // indirect - github.com/atotto/clipboard v0.1.4 // indirect - github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect - github.com/charmbracelet/lipgloss v1.0.0 // indirect - github.com/lucasb-eyer/go-colorful v1.2.0 // indirect - github.com/mattn/go-isatty v0.0.20 // indirect - github.com/muesli/termenv v0.15.2 // indirect - golang.org/x/net v0.32.0 // indirect -) - -require ( github.com/acobaugh/osrelease v0.1.0 // indirect github.com/andybalholm/brotli v1.1.1 // indirect github.com/antlr4-go/antlr/v4 v4.13.1 // indirect + github.com/atotto/clipboard v0.1.4 // indirect + github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/benbjohnson/immutable v0.4.3 // indirect - github.com/charmbracelet/bubbles v0.20.0 - github.com/charmbracelet/bubbletea v1.2.4 + github.com/charmbracelet/lipgloss v1.0.0 // indirect github.com/charmbracelet/x/ansi v0.6.0 // indirect github.com/charmbracelet/x/term v0.2.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect @@ -55,13 +48,16 @@ require ( github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jmoiron/sqlx v1.4.0 // indirect github.com/klauspost/compress v1.17.11 // indirect + github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/magiconair/properties v1.8.9 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-localereader v0.0.1 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/montanaflynn/stats v0.7.1 // indirect github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect github.com/muesli/cancelreader v0.2.2 // indirect + github.com/muesli/termenv v0.15.2 // indirect github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect @@ -73,19 +69,20 @@ require ( github.com/spf13/pflag v1.0.5 // indirect github.com/stoewer/go-strcase v1.3.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect - github.com/tryvium-travels/memongo v0.12.0 github.com/xdg-go/pbkdf2 v1.0.0 // indirect github.com/xdg-go/scram v1.1.2 // indirect github.com/xdg-go/stringprep v1.0.4 // indirect github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect + go.mongodb.org/mongo-driver v1.17.1 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.31.0 // indirect golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 // indirect + golang.org/x/net v0.33.0 // indirect golang.org/x/sync v0.10.0 // indirect golang.org/x/sys v0.28.0 // indirect golang.org/x/text v0.21.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20241216192217-9240e9c98484 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20241216192217-9240e9c98484 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20241219192143-6b3ec007d9bb // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241219192143-6b3ec007d9bb // indirect google.golang.org/protobuf v1.36.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect ) diff --git a/cmd/go.sum b/cmd/go.sum index ba67be67..3cda7ef5 100644 --- a/cmd/go.sum +++ b/cmd/go.sum @@ -170,6 +170,7 @@ github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78/go.mod h1:aL8wCCfTfS github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.mongodb.org/mongo-driver v1.17.1 h1:Wic5cJIwJgSpBhe3lx3+/RybR5PiYRMpVFgO7cOHyIM= go.mongodb.org/mongo-driver v1.17.1/go.mod h1:wwWm/+BuOddhcq3n68LKRmgk2wXzmF6s0SFOa0GINL4= +go.mongodb.org/mongo-driver/v2 v2.0.0 h1:Jfd7XpdZa9yk3eY774bO7SWVb30noLSirL9nKTpavhI= go.mongodb.org/mongo-driver/v2 v2.0.0/go.mod h1:nSjmNq4JUstE8IRZKTktLgMHM4F1fccL6HGX1yh+8RA= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= @@ -183,8 +184,8 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91 golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI= -golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs= +golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= +golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= @@ -211,10 +212,10 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/api v0.0.0-20241216192217-9240e9c98484 h1:ChAdCYNQFDk5fYvFZMywKLIijG7TC2m1C2CMEu11G3o= -google.golang.org/genproto/googleapis/api v0.0.0-20241216192217-9240e9c98484/go.mod h1:KRUmxRI4JmbpAm8gcZM4Jsffi859fo5LQjILwuqj9z8= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241216192217-9240e9c98484 h1:Z7FRVJPSMaHQxD0uXU8WdgFh8PseLM8Q8NzhnpMrBhQ= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241216192217-9240e9c98484/go.mod h1:lcTa1sDdWEIHMWlITnIczmw5w60CF9ffkb8Z+DVmmjA= +google.golang.org/genproto/googleapis/api v0.0.0-20241219192143-6b3ec007d9bb h1:B7GIB7sr443wZ/EAEl7VZjmh1V6qzkt5V+RYcUYtS1U= +google.golang.org/genproto/googleapis/api v0.0.0-20241219192143-6b3ec007d9bb/go.mod h1:E5//3O5ZIG2l71Xnt+P/CYUY8Bxs8E7WMoZ9tlcMbAY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241219192143-6b3ec007d9bb h1:3oy2tynMOP1QbTC0MsNNAV+Se8M2Bd0A5+x1QHyw+pI= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241219192143-6b3ec007d9bb/go.mod h1:lcTa1sDdWEIHMWlITnIczmw5w60CF9ffkb8Z+DVmmjA= google.golang.org/protobuf v1.36.0 h1:mjIs9gYtt56AzC4ZaffQuh88TZurBGhIJMBZGSxNerQ= google.golang.org/protobuf v1.36.0/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/cmd/pkg/driver/mongo.go b/cmd/pkg/driver/mongo.go index 5a4cf38a..30d25fdf 100644 --- a/cmd/pkg/driver/mongo.go +++ b/cmd/pkg/driver/mongo.go @@ -11,8 +11,8 @@ import ( "github.com/siyul-park/uniflow/pkg/secret" "github.com/siyul-park/uniflow/pkg/spec" "github.com/tryvium-travels/memongo" - "go.mongodb.org/mongo-driver/mongo" - "go.mongodb.org/mongo-driver/mongo/options" + "go.mongodb.org/mongo-driver/v2/mongo" + "go.mongodb.org/mongo-driver/v2/mongo/options" "strings" ) @@ -40,7 +40,7 @@ func NewMongoDriver(ctx context.Context, uri, name string) (Driver, error) { serverAPI := options.ServerAPI(options.ServerAPIVersion1) opts := options.Client().ApplyURI(uri).SetServerAPIOptions(serverAPI) - client, err := mongo.Connect(ctx, opts) + client, err := mongo.Connect(opts) if err != nil { return nil, err } diff --git a/driver/mongo/go.mod b/driver/mongo/go.mod index 3de00ac5..37c6f7c0 100644 --- a/driver/mongo/go.mod +++ b/driver/mongo/go.mod @@ -5,34 +5,31 @@ go 1.23.4 require ( github.com/go-faker/faker/v4 v4.5.0 github.com/gofrs/uuid v4.4.0+incompatible + github.com/pkg/errors v0.9.1 github.com/siyul-park/uniflow v0.11.0 github.com/stretchr/testify v1.10.0 github.com/tryvium-travels/memongo v0.12.0 - go.mongodb.org/mongo-driver v1.9.1 go.mongodb.org/mongo-driver/v2 v2.0.0 ) -require github.com/go-stack/stack v1.8.0 // indirect - require ( - github.com/acobaugh/osrelease v0.1.0 // indirect + github.com/acobaugh/osrelease v0.0.0-20181218015638-a93a0a55a249 // indirect github.com/benbjohnson/immutable v0.4.3 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/go-stack/stack v1.8.0 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/iancoleman/strcase v0.3.0 // indirect - github.com/klauspost/compress v1.17.11 // indirect - github.com/kr/text v0.2.0 // indirect - github.com/montanaflynn/stats v0.7.1 // indirect - github.com/pkg/errors v0.9.1 + github.com/klauspost/compress v1.16.7 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/spf13/afero v1.11.0 // indirect + github.com/spf13/afero v1.6.0 // indirect github.com/xdg-go/pbkdf2 v1.0.0 // indirect github.com/xdg-go/scram v1.1.2 // indirect github.com/xdg-go/stringprep v1.0.4 // indirect github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect - golang.org/x/crypto v0.31.0 // indirect - golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 // indirect - golang.org/x/sync v0.10.0 // indirect - golang.org/x/text v0.21.0 // indirect + go.mongodb.org/mongo-driver v1.9.1 // indirect + golang.org/x/crypto v0.29.0 // indirect + golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c // indirect + golang.org/x/sync v0.9.0 // indirect + golang.org/x/text v0.20.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/driver/mongo/go.sum b/driver/mongo/go.sum index b1378159..1bcff4b7 100644 --- a/driver/mongo/go.sum +++ b/driver/mongo/go.sum @@ -1,8 +1,7 @@ -github.com/acobaugh/osrelease v0.1.0 h1:Yb59HQDGGNhCj4suHaFQQfBps5wyoKLSSX/J/+UifRE= -github.com/acobaugh/osrelease v0.1.0/go.mod h1:4bFEs0MtgHNHBrmHCt67gNisnabCRAlzdVasCEGHTWY= +github.com/acobaugh/osrelease v0.0.0-20181218015638-a93a0a55a249 h1:fMi9ZZ/it4orHj3xWrM6cLkVFcCbkXQALFUiNtHtCPs= +github.com/acobaugh/osrelease v0.0.0-20181218015638-a93a0a55a249/go.mod h1:iU1PxQMQwoHZZWmMKrMkrNlY+3+p9vxIjpZOVyxWa0g= github.com/benbjohnson/immutable v0.4.3 h1:GYHcksoJ9K6HyAUpGxwZURrbTkXA0Dh4otXGqbhdrjA= github.com/benbjohnson/immutable v0.4.3/go.mod h1:qJIKKSmdqz1tVzNtst1DZzvaqOU1onk1rc03IeM3Owk= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= @@ -24,20 +23,20 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc= -github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= +github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I= +github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= -github.com/montanaflynn/stats v0.7.1 h1:etflOAAHORrCC44V+aR6Ftzort912ZU+YLiSTuV8eaE= -github.com/montanaflynn/stats v0.7.1/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -47,12 +46,14 @@ github.com/samber/lo v1.47.0 h1:z7RynLwP5nbyRscyvcD043DWYoOcYRv3mV8lBeqOCLc= github.com/samber/lo v1.47.0/go.mod h1:RmDH9Ct32Qy3gduHQuKJ3gW1fMHAnE/fAzQuf6He5cU= github.com/siyul-park/uniflow v0.11.0 h1:GTXFiFa7S7Wnvdia4kVb4+9MrU2JSMIj5GTVDIQRWaA= github.com/siyul-park/uniflow v0.11.0/go.mod h1:XN7Rld6TIcmva6SS8CS19jXnyuZa73e4E13BFXPAVSI= -github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= -github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= +github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY= +github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tryvium-travels/memongo v0.12.0 h1:B56+Do7Z3vcR93oqkyUubvdFPJEqpHn1ZBSQRYe4Nnk= github.com/tryvium-travels/memongo v0.12.0/go.mod h1:riRUHKRQ5JbeX2ryzFfmr7P2EYXIkNwgloSQJPpBikA= @@ -70,16 +71,16 @@ github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78/go.mod h1:aL8wCCfTfS github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.mongodb.org/mongo-driver v1.9.1 h1:m078y9v7sBItkt1aaoe2YlvWEXcD263e1a4E1fBrJ1c= go.mongodb.org/mongo-driver v1.9.1/go.mod h1:0sQWfOeY63QTntERDJJ/0SuKK0T1uVSgKCuAROlKEPY= -go.mongodb.org/mongo-driver v1.17.1 h1:Wic5cJIwJgSpBhe3lx3+/RybR5PiYRMpVFgO7cOHyIM= -go.mongodb.org/mongo-driver v1.17.1/go.mod h1:wwWm/+BuOddhcq3n68LKRmgk2wXzmF6s0SFOa0GINL4= +go.mongodb.org/mongo-driver/v2 v2.0.0 h1:Jfd7XpdZa9yk3eY774bO7SWVb30noLSirL9nKTpavhI= go.mongodb.org/mongo-driver/v2 v2.0.0/go.mod h1:nSjmNq4JUstE8IRZKTktLgMHM4F1fccL6HGX1yh+8RA= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20201216223049-8b5274cf687f/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= -golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= -golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 h1:1UoZQm6f0P/ZO0w1Ri+f+ifG/gXhegadRdwBIXEFWDo= -golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67/go.mod h1:qj5a5QZpwLU2NLQudwIN5koi3beDhSAlJwa67PuM98c= +golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ= +golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg= +golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c h1:7dEasQXItcW1xKJ2+gg5VOiBnqWrJc+rq0DPKyvvdbY= +golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -89,9 +90,10 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= -golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= +golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -105,8 +107,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= -golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= -golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= +golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190531172133-b3315ee88b7d/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -117,6 +119,7 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/driver/mongo/pkg/chart/store.go b/driver/mongo/pkg/chart/store.go index 148ff833..83b149ce 100644 --- a/driver/mongo/pkg/chart/store.go +++ b/driver/mongo/pkg/chart/store.go @@ -9,9 +9,9 @@ import ( "github.com/siyul-park/uniflow/pkg/chart" "github.com/siyul-park/uniflow/pkg/resource" "github.com/siyul-park/uniflow/pkg/secret" - "go.mongodb.org/mongo-driver/bson" - "go.mongodb.org/mongo-driver/mongo" - "go.mongodb.org/mongo-driver/mongo/options" + "go.mongodb.org/mongo-driver/v2/bson" + "go.mongodb.org/mongo-driver/v2/mongo" + "go.mongodb.org/mongo-driver/v2/mongo/options" ) // Store manages storage and retrieval of Spec objects in a MongoDB collection. @@ -88,9 +88,7 @@ func (s *Store) Load(ctx context.Context, charts ...*chart.Chart) ([]*chart.Char filter := s.filter(charts...) limit := int64(s.limit(charts...)) - cursor, err := s.collection.Find(ctx, filter, &options.FindOptions{ - Limit: &limit, - }) + cursor, err := s.collection.Find(ctx, filter, options.Find().SetLimit(limit)) if err != nil { return nil, err } diff --git a/driver/mongo/pkg/chart/store_test.go b/driver/mongo/pkg/chart/store_test.go index f3f58a03..9565d9d3 100644 --- a/driver/mongo/pkg/chart/store_test.go +++ b/driver/mongo/pkg/chart/store_test.go @@ -10,8 +10,8 @@ import ( "github.com/siyul-park/uniflow/pkg/chart" "github.com/siyul-park/uniflow/pkg/resource" "github.com/stretchr/testify/assert" - "go.mongodb.org/mongo-driver/mongo" - "go.mongodb.org/mongo-driver/mongo/options" + "go.mongodb.org/mongo-driver/v2/mongo" + "go.mongodb.org/mongo-driver/v2/mongo/options" ) func TestStore_Index(t *testing.T) { @@ -21,7 +21,7 @@ func TestStore_Index(t *testing.T) { s := server.New() defer server.Release(s) - c, _ := mongo.Connect(ctx, options.Client().ApplyURI(s.URI())) + c, _ := mongo.Connect(options.Client().ApplyURI(s.URI())) defer c.Disconnect(ctx) st := NewStore(c.Database(faker.UUIDHyphenated()).Collection(faker.UUIDHyphenated())) @@ -37,7 +37,7 @@ func TestStore_Watch(t *testing.T) { s := server.New() defer server.Release(s) - c, _ := mongo.Connect(ctx, options.Client().ApplyURI(s.URI())) + c, _ := mongo.Connect(options.Client().ApplyURI(s.URI())) defer c.Disconnect(ctx) st := NewStore(c.Database(faker.UUIDHyphenated()).Collection(faker.UUIDHyphenated())) @@ -75,7 +75,7 @@ func TestStore_Load(t *testing.T) { s := server.New() defer server.Release(s) - c, _ := mongo.Connect(ctx, options.Client().ApplyURI(s.URI())) + c, _ := mongo.Connect(options.Client().ApplyURI(s.URI())) defer c.Disconnect(ctx) st := NewStore(c.Database(faker.UUIDHyphenated()).Collection(faker.UUIDHyphenated())) @@ -103,7 +103,7 @@ func TestStore_Store(t *testing.T) { s := server.New() defer server.Release(s) - c, _ := mongo.Connect(ctx, options.Client().ApplyURI(s.URI())) + c, _ := mongo.Connect(options.Client().ApplyURI(s.URI())) defer c.Disconnect(ctx) st := NewStore(c.Database(faker.UUIDHyphenated()).Collection(faker.UUIDHyphenated())) @@ -131,7 +131,7 @@ func TestStore_Swap(t *testing.T) { s := server.New() defer server.Release(s) - c, _ := mongo.Connect(ctx, options.Client().ApplyURI(s.URI())) + c, _ := mongo.Connect(options.Client().ApplyURI(s.URI())) defer c.Disconnect(ctx) st := NewStore(c.Database(faker.UUIDHyphenated()).Collection(faker.UUIDHyphenated())) @@ -163,7 +163,7 @@ func TestMemStore_Delete(t *testing.T) { s := server.New() defer server.Release(s) - c, _ := mongo.Connect(ctx, options.Client().ApplyURI(s.URI())) + c, _ := mongo.Connect(options.Client().ApplyURI(s.URI())) defer c.Disconnect(ctx) st := NewStore(c.Database(faker.UUIDHyphenated()).Collection(faker.UUIDHyphenated())) diff --git a/driver/mongo/pkg/encoding/encoding.go b/driver/mongo/pkg/encoding/encoding.go index 0fd54c0c..2868e8ce 100644 --- a/driver/mongo/pkg/encoding/encoding.go +++ b/driver/mongo/pkg/encoding/encoding.go @@ -1,13 +1,13 @@ package encoding import ( + "go.mongodb.org/mongo-driver/v2/bson" "reflect" "unsafe" "github.com/pkg/errors" "github.com/siyul-park/uniflow/pkg/encoding" "github.com/siyul-park/uniflow/pkg/types" - "go.mongodb.org/mongo-driver/bson/primitive" ) func init() { @@ -16,12 +16,12 @@ func init() { } func newBSONEncoder() encoding.EncodeCompiler[any, types.Value] { - typeBinary := reflect.TypeOf((*primitive.Binary)(nil)).Elem() + typeBinary := reflect.TypeOf((*bson.Binary)(nil)).Elem() return encoding.EncodeCompilerFunc[any, types.Value](func(typ reflect.Type) (encoding.Encoder[any, types.Value], error) { if typ != nil && typ.ConvertibleTo(typeBinary) { return encoding.EncodeFunc[any, types.Value](func(source any) (types.Value, error) { - s := source.(primitive.Binary) + s := source.(bson.Binary) return types.NewBinary(s.Data), nil }), nil } @@ -30,7 +30,7 @@ func newBSONEncoder() encoding.EncodeCompiler[any, types.Value] { } func newBSONDecoder() encoding.DecodeCompiler[types.Value] { - typeBinary := reflect.TypeOf((*primitive.Binary)(nil)).Elem() + typeBinary := reflect.TypeOf((*bson.Binary)(nil)).Elem() return encoding.DecodeCompilerFunc[types.Value](func(typ reflect.Type) (encoding.Decoder[types.Value, unsafe.Pointer], error) { if typ != nil && typ.Kind() == reflect.Pointer { @@ -38,7 +38,7 @@ func newBSONDecoder() encoding.DecodeCompiler[types.Value] { return encoding.DecodeFunc[types.Value, unsafe.Pointer](func(source types.Value, target unsafe.Pointer) error { if s, ok := source.(types.Binary); ok { t := reflect.NewAt(typ.Elem(), target) - t.Elem().Set(reflect.ValueOf(primitive.Binary{ + t.Elem().Set(reflect.ValueOf(bson.Binary{ Data: s.Bytes(), })) return nil diff --git a/driver/mongo/pkg/encoding/encoding_test.go b/driver/mongo/pkg/encoding/encoding_test.go index 6bfe6ccc..509f8032 100644 --- a/driver/mongo/pkg/encoding/encoding_test.go +++ b/driver/mongo/pkg/encoding/encoding_test.go @@ -6,14 +6,14 @@ import ( "github.com/siyul-park/uniflow/pkg/encoding" "github.com/siyul-park/uniflow/pkg/types" "github.com/stretchr/testify/assert" - "go.mongodb.org/mongo-driver/bson/primitive" + "go.mongodb.org/mongo-driver/v2/bson" ) func TestBSONEncoder_Encode(t *testing.T) { enc := encoding.NewEncodeAssembler[any, types.Value]() enc.Add(newBSONEncoder()) - binary := primitive.Binary{ + binary := bson.Binary{ Data: []byte{0}, } b := types.NewBinary(binary.Data) @@ -27,12 +27,12 @@ func TestBSONDecoder_Decode(t *testing.T) { dec := encoding.NewDecodeAssembler[types.Value, any]() dec.Add(newBSONDecoder()) - binary := primitive.Binary{ + binary := bson.Binary{ Data: []byte{0}, } b := types.NewBinary(binary.Data) - decoded := primitive.Binary{} + decoded := bson.Binary{} err := dec.Decode(b, &decoded) assert.NoError(t, err) assert.Equal(t, binary, decoded) diff --git a/driver/mongo/pkg/secret/store.go b/driver/mongo/pkg/secret/store.go index 7c9f2f3a..967cecf9 100644 --- a/driver/mongo/pkg/secret/store.go +++ b/driver/mongo/pkg/secret/store.go @@ -8,9 +8,9 @@ import ( _ "github.com/siyul-park/uniflow/driver/mongo/pkg/encoding" "github.com/siyul-park/uniflow/pkg/resource" "github.com/siyul-park/uniflow/pkg/secret" - "go.mongodb.org/mongo-driver/bson" - "go.mongodb.org/mongo-driver/mongo" - "go.mongodb.org/mongo-driver/mongo/options" + "go.mongodb.org/mongo-driver/v2/bson" + "go.mongodb.org/mongo-driver/v2/mongo" + "go.mongodb.org/mongo-driver/v2/mongo/options" ) // Store manages storage and retrieval of Spec objects in a MongoDB collection. @@ -87,9 +87,7 @@ func (s *Store) Load(ctx context.Context, secrets ...*secret.Secret) ([]*secret. filter := s.filter(secrets...) limit := int64(s.limit(secrets...)) - cursor, err := s.collection.Find(ctx, filter, &options.FindOptions{ - Limit: &limit, - }) + cursor, err := s.collection.Find(ctx, filter, options.Find().SetLimit(limit)) if err != nil { return nil, err } diff --git a/driver/mongo/pkg/secret/store_test.go b/driver/mongo/pkg/secret/store_test.go index b97867a0..d5abea34 100644 --- a/driver/mongo/pkg/secret/store_test.go +++ b/driver/mongo/pkg/secret/store_test.go @@ -10,8 +10,8 @@ import ( "github.com/siyul-park/uniflow/pkg/resource" "github.com/siyul-park/uniflow/pkg/secret" "github.com/stretchr/testify/assert" - "go.mongodb.org/mongo-driver/mongo" - "go.mongodb.org/mongo-driver/mongo/options" + "go.mongodb.org/mongo-driver/v2/mongo" + "go.mongodb.org/mongo-driver/v2/mongo/options" ) func TestStore_Index(t *testing.T) { @@ -21,7 +21,7 @@ func TestStore_Index(t *testing.T) { s := server.New() defer server.Release(s) - c, _ := mongo.Connect(ctx, options.Client().ApplyURI(s.URI())) + c, _ := mongo.Connect(options.Client().ApplyURI(s.URI())) defer c.Disconnect(ctx) st := NewStore(c.Database(faker.UUIDHyphenated()).Collection(faker.UUIDHyphenated())) @@ -37,7 +37,7 @@ func TestStore_Watch(t *testing.T) { s := server.New() defer server.Release(s) - c, _ := mongo.Connect(ctx, options.Client().ApplyURI(s.URI())) + c, _ := mongo.Connect(options.Client().ApplyURI(s.URI())) defer c.Disconnect(ctx) st := NewStore(c.Database(faker.UUIDHyphenated()).Collection(faker.UUIDHyphenated())) @@ -75,7 +75,7 @@ func TestStore_Load(t *testing.T) { s := server.New() defer server.Release(s) - c, _ := mongo.Connect(ctx, options.Client().ApplyURI(s.URI())) + c, _ := mongo.Connect(options.Client().ApplyURI(s.URI())) defer c.Disconnect(ctx) st := NewStore(c.Database(faker.UUIDHyphenated()).Collection(faker.UUIDHyphenated())) @@ -103,7 +103,7 @@ func TestStore_Store(t *testing.T) { s := server.New() defer server.Release(s) - c, _ := mongo.Connect(ctx, options.Client().ApplyURI(s.URI())) + c, _ := mongo.Connect(options.Client().ApplyURI(s.URI())) defer c.Disconnect(ctx) st := NewStore(c.Database(faker.UUIDHyphenated()).Collection(faker.UUIDHyphenated())) @@ -131,7 +131,7 @@ func TestStore_Swap(t *testing.T) { s := server.New() defer server.Release(s) - c, _ := mongo.Connect(ctx, options.Client().ApplyURI(s.URI())) + c, _ := mongo.Connect(options.Client().ApplyURI(s.URI())) defer c.Disconnect(ctx) st := NewStore(c.Database(faker.UUIDHyphenated()).Collection(faker.UUIDHyphenated())) @@ -163,7 +163,7 @@ func TestMemStore_Delete(t *testing.T) { s := server.New() defer server.Release(s) - c, _ := mongo.Connect(ctx, options.Client().ApplyURI(s.URI())) + c, _ := mongo.Connect(options.Client().ApplyURI(s.URI())) defer c.Disconnect(ctx) st := NewStore(c.Database(faker.UUIDHyphenated()).Collection(faker.UUIDHyphenated())) diff --git a/driver/mongo/pkg/server/server.go b/driver/mongo/pkg/server/server.go index dfe5db5f..8985115a 100644 --- a/driver/mongo/pkg/server/server.go +++ b/driver/mongo/pkg/server/server.go @@ -7,9 +7,9 @@ import ( "github.com/tryvium-travels/memongo" "github.com/tryvium-travels/memongo/memongolog" - "go.mongodb.org/mongo-driver/bson" - "go.mongodb.org/mongo-driver/mongo" - "go.mongodb.org/mongo-driver/mongo/options" + "go.mongodb.org/mongo-driver/v2/bson" + "go.mongodb.org/mongo-driver/v2/mongo" + "go.mongodb.org/mongo-driver/v2/mongo/options" ) var ( @@ -44,7 +44,7 @@ func Release(server *memongo.Server) { ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) defer cancel() - if client, err := mongo.Connect(ctx, options.Client().ApplyURI(server.URI()+"/retryWrites=false")); err != nil { + if client, err := mongo.Connect(options.Client().ApplyURI(server.URI() + "/retryWrites=false")); err != nil { server.Stop() } else { if databases, err := client.ListDatabaseNames(ctx, bson.D{}); err == nil { diff --git a/driver/mongo/pkg/spec/store.go b/driver/mongo/pkg/spec/store.go index f4c07e58..fbdd84e3 100644 --- a/driver/mongo/pkg/spec/store.go +++ b/driver/mongo/pkg/spec/store.go @@ -9,9 +9,9 @@ import ( "github.com/siyul-park/uniflow/pkg/resource" "github.com/siyul-park/uniflow/pkg/spec" "github.com/siyul-park/uniflow/pkg/types" - "go.mongodb.org/mongo-driver/bson" - "go.mongodb.org/mongo-driver/mongo" - "go.mongodb.org/mongo-driver/mongo/options" + "go.mongodb.org/mongo-driver/v2/bson" + "go.mongodb.org/mongo-driver/v2/mongo" + "go.mongodb.org/mongo-driver/v2/mongo/options" ) // Store manages storage and retrieval of Spec objects in a MongoDB collection. @@ -91,9 +91,7 @@ func (s *Store) Load(ctx context.Context, specs ...spec.Spec) ([]spec.Spec, erro filter := s.filter(specs...) limit := int64(s.limit(specs...)) - cursor, err := s.collection.Find(ctx, filter, &options.FindOptions{ - Limit: &limit, - }) + cursor, err := s.collection.Find(ctx, filter, options.Find().SetLimit(limit)) if err != nil { return nil, err } diff --git a/driver/mongo/pkg/spec/store_test.go b/driver/mongo/pkg/spec/store_test.go index 0bc7a426..efa95ddd 100644 --- a/driver/mongo/pkg/spec/store_test.go +++ b/driver/mongo/pkg/spec/store_test.go @@ -10,8 +10,8 @@ import ( "github.com/siyul-park/uniflow/pkg/resource" "github.com/siyul-park/uniflow/pkg/spec" "github.com/stretchr/testify/assert" - "go.mongodb.org/mongo-driver/mongo" - "go.mongodb.org/mongo-driver/mongo/options" + "go.mongodb.org/mongo-driver/v2/mongo" + "go.mongodb.org/mongo-driver/v2/mongo/options" ) func TestStore_Index(t *testing.T) { @@ -21,7 +21,7 @@ func TestStore_Index(t *testing.T) { s := server.New() defer server.Release(s) - c, _ := mongo.Connect(ctx, options.Client().ApplyURI(s.URI())) + c, _ := mongo.Connect(options.Client().ApplyURI(s.URI())) defer c.Disconnect(ctx) st := NewStore(c.Database(faker.UUIDHyphenated()).Collection(faker.UUIDHyphenated())) @@ -39,7 +39,7 @@ func TestStore_Watch(t *testing.T) { s := server.New() defer server.Release(s) - c, _ := mongo.Connect(ctx, options.Client().ApplyURI(s.URI())) + c, _ := mongo.Connect(options.Client().ApplyURI(s.URI())) defer c.Disconnect(ctx) st := NewStore(c.Database(faker.UUIDHyphenated()).Collection(faker.UUIDHyphenated())) @@ -80,7 +80,7 @@ func TestStore_Load(t *testing.T) { s := server.New() defer server.Release(s) - c, _ := mongo.Connect(ctx, options.Client().ApplyURI(s.URI())) + c, _ := mongo.Connect(options.Client().ApplyURI(s.URI())) defer c.Disconnect(ctx) st := NewStore(c.Database(faker.UUIDHyphenated()).Collection(faker.UUIDHyphenated())) @@ -112,7 +112,7 @@ func TestStore_Store(t *testing.T) { s := server.New() defer server.Release(s) - c, _ := mongo.Connect(ctx, options.Client().ApplyURI(s.URI())) + c, _ := mongo.Connect(options.Client().ApplyURI(s.URI())) defer c.Disconnect(ctx) st := NewStore(c.Database(faker.UUIDHyphenated()).Collection(faker.UUIDHyphenated())) @@ -144,7 +144,7 @@ func TestStore_Swap(t *testing.T) { s := server.New() defer server.Release(s) - c, _ := mongo.Connect(ctx, options.Client().ApplyURI(s.URI())) + c, _ := mongo.Connect(options.Client().ApplyURI(s.URI())) defer c.Disconnect(ctx) st := NewStore(c.Database(faker.UUIDHyphenated()).Collection(faker.UUIDHyphenated())) @@ -180,7 +180,7 @@ func TestMemStore_Delete(t *testing.T) { s := server.New() defer server.Release(s) - c, _ := mongo.Connect(ctx, options.Client().ApplyURI(s.URI())) + c, _ := mongo.Connect(options.Client().ApplyURI(s.URI())) defer c.Disconnect(ctx) st := NewStore(c.Database(faker.UUIDHyphenated()).Collection(faker.UUIDHyphenated())) diff --git a/ext/go.mod b/ext/go.mod index 16158b56..9c1bbd9f 100644 --- a/ext/go.mod +++ b/ext/go.mod @@ -37,7 +37,7 @@ require ( golang.org/x/net v0.33.0 golang.org/x/sys v0.28.0 // indirect golang.org/x/text v0.21.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20241216192217-9240e9c98484 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20241216192217-9240e9c98484 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20241219192143-6b3ec007d9bb // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241219192143-6b3ec007d9bb // indirect google.golang.org/protobuf v1.36.0 // indirect ) diff --git a/ext/go.sum b/ext/go.sum index 8d9900bd..042e0878 100644 --- a/ext/go.sum +++ b/ext/go.sum @@ -79,8 +79,6 @@ github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZ github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E= golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 h1:1UoZQm6f0P/ZO0w1Ri+f+ifG/gXhegadRdwBIXEFWDo= golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67/go.mod h1:qj5a5QZpwLU2NLQudwIN5koi3beDhSAlJwa67PuM98c= -golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI= -golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs= golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -88,10 +86,10 @@ golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= -google.golang.org/genproto/googleapis/api v0.0.0-20241216192217-9240e9c98484 h1:ChAdCYNQFDk5fYvFZMywKLIijG7TC2m1C2CMEu11G3o= -google.golang.org/genproto/googleapis/api v0.0.0-20241216192217-9240e9c98484/go.mod h1:KRUmxRI4JmbpAm8gcZM4Jsffi859fo5LQjILwuqj9z8= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241216192217-9240e9c98484 h1:Z7FRVJPSMaHQxD0uXU8WdgFh8PseLM8Q8NzhnpMrBhQ= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241216192217-9240e9c98484/go.mod h1:lcTa1sDdWEIHMWlITnIczmw5w60CF9ffkb8Z+DVmmjA= +google.golang.org/genproto/googleapis/api v0.0.0-20241219192143-6b3ec007d9bb h1:B7GIB7sr443wZ/EAEl7VZjmh1V6qzkt5V+RYcUYtS1U= +google.golang.org/genproto/googleapis/api v0.0.0-20241219192143-6b3ec007d9bb/go.mod h1:E5//3O5ZIG2l71Xnt+P/CYUY8Bxs8E7WMoZ9tlcMbAY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241219192143-6b3ec007d9bb h1:3oy2tynMOP1QbTC0MsNNAV+Se8M2Bd0A5+x1QHyw+pI= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241219192143-6b3ec007d9bb/go.mod h1:lcTa1sDdWEIHMWlITnIczmw5w60CF9ffkb8Z+DVmmjA= google.golang.org/protobuf v1.36.0 h1:mjIs9gYtt56AzC4ZaffQuh88TZurBGhIJMBZGSxNerQ= google.golang.org/protobuf v1.36.0/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=