diff --git a/.github/workflows/ci-main.yml b/.github/workflows/ci-main.yml index 42f9700f4..e30b8175e 100644 --- a/.github/workflows/ci-main.yml +++ b/.github/workflows/ci-main.yml @@ -20,6 +20,13 @@ on: - feature/** - enhance/** - fix/** + workflow_dispatch: + inputs: + debug: + type: boolean + description: 'Enable tmate Debug' + required: false + default: false # This allows a subsequently queued workflow run to interrupt previous runs concurrency: @@ -207,6 +214,13 @@ jobs: - name: Checkout Repository uses: actions/checkout@v5 + - name: Setup tmate Session + uses: mxschmitt/action-tmate@v3 + if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug }} + with: + detached: true + limit-access-to-actor: false + - name: Start Apollo Containers run: docker compose -f ".github/workflows/apollo/docker-compose.yml" up -d --build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c384cb143..c74f995a2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,7 +34,7 @@ jobs: - name: Build CLI Binary For All Platform run: | cd cmd/gf - gf build main.go -n gf -a all -s all -p temp + gf build main.go -n gf -a all -s linux,windows,darwin,freebsd,netbsd,openbsd -p temp - name: Move Files Before Release run: | diff --git a/.github/workflows/scripts/ci-main.sh b/.github/workflows/scripts/ci-main.sh index 3f3d27a66..b24b2d989 100644 --- a/.github/workflows/scripts/ci-main.sh +++ b/.github/workflows/scripts/ci-main.sh @@ -2,12 +2,6 @@ coverage=$1 -# update code of submodules -git clone https://github.com/gogf/examples - -# update go.mod in examples directory to replace github.com/gogf/gf packages with local directory -bash .github/workflows/scripts/replace_examples_gomod.sh - # find all path that contains go.mod. for file in `find . -name go.mod`; do dirpath=$(dirname $file) @@ -24,22 +18,18 @@ for file in `find . -name go.mod`; do continue 1 fi - # Check if it's a contrib directory or examples directory - if [[ $dirpath =~ "/contrib/" ]] || [[ $dirpath =~ "/examples/" ]]; then + # examples directory was moved to sub ci procedure. + if [[ $dirpath =~ "/examples/" ]]; then + continue 1 + fi + + # Check if it's a contrib directory + if [[ $dirpath =~ "/contrib/" ]]; then # Check if go version meets the requirement if ! go version | grep -qE "go${LATEST_GO_VERSION}"; then echo "ignore path $dirpath as go version is not ${LATEST_GO_VERSION}: $(go version)" continue 1 fi - # If it's examples directory, only build without tests - if [[ $dirpath =~ "/examples/" ]]; then - echo "the examples directory only needs to be built, not unit tests and coverage tests." - cd $dirpath - go mod tidy - go build ./... - cd - - continue 1 - fi fi if [[ $file =~ "/testdata/" ]]; then @@ -47,6 +37,11 @@ for file in `find . -name go.mod`; do continue 1 fi + if [[ $dirpath = "." ]]; then + # No space left on device error sometimes occurs in CI pipelines, so clean the cache before tests. + go clean -cache + fi + cd $dirpath go mod tidy go build ./... diff --git a/.github/workflows/scripts/ci-sub.sh b/.github/workflows/scripts/ci-sub.sh index 70e1f13b5..9683b355e 100644 --- a/.github/workflows/scripts/ci-sub.sh +++ b/.github/workflows/scripts/ci-sub.sh @@ -2,6 +2,12 @@ coverage=$1 +# update code of submodules +git clone https://github.com/gogf/examples + +# update go.mod in examples directory to replace github.com/gogf/gf packages with local directory +bash .github/workflows/scripts/replace_examples_gomod.sh + # Function to compare version numbers version_compare() { local ver1=$1 @@ -35,7 +41,19 @@ for file in `find . -name go.mod`; do dirpath=$(dirname $file) echo "Processing: $dirpath" - # Only process kubecm directory, skip others + # Only process examples and kubecm directories + + # Process examples directory (only build, no tests) + if [[ $dirpath =~ "/examples/" ]]; then + echo " the examples directory only needs to be built, not unit tests." + cd $dirpath + go mod tidy + go build ./... + cd - + continue 1 + fi + + # Process kubecm directory if [ "kubecm" != $(basename $dirpath) ]; then echo " Skipping: not kubecm directory" continue diff --git a/.make_tidy.sh b/.make_tidy.sh index e14d2dd85..62ac53009 100755 --- a/.make_tidy.sh +++ b/.make_tidy.sh @@ -26,6 +26,8 @@ for file in `find ${workdir} -name go.mod`; do fi cd $goModPath + # Remove indirect dependencies + sed -i '/\/\/ indirect/d' go.mod go mod tidy # Remove toolchain line if exists sed -i '' '/^toolchain/d' go.mod diff --git a/.make_version.sh b/.make_version.sh index 14e314d0e..4d759fb2a 100755 --- a/.make_version.sh +++ b/.make_version.sh @@ -80,6 +80,8 @@ for file in `find ${workdir} -name go.mod`; do go mod edit -replace github.com/gogf/gf/contrib/drivers/pgsql/v2=../../contrib/drivers/pgsql go mod edit -replace github.com/gogf/gf/contrib/drivers/sqlite/v2=../../contrib/drivers/sqlite fi + # Remove indirect dependencies + sed -i '/\/\/ indirect/d' go.mod go mod tidy # Remove toolchain line if exists $SED_INPLACE '/^toolchain/d' go.mod @@ -88,6 +90,8 @@ for file in `find ${workdir} -name go.mod`; do # it may not be possible to successfully upgrade. Please confirm before submitting the code go list -f "{{if and (not .Indirect) (not .Main)}}{{.Path}}@${newVersion}{{end}}" -m all | grep "^github.com/gogf/gf" go list -f "{{if and (not .Indirect) (not .Main)}}{{.Path}}@${newVersion}{{end}}" -m all | grep "^github.com/gogf/gf" | xargs -L1 go get -v + # Remove indirect dependencies + sed -i '/\/\/ indirect/d' go.mod go mod tidy # Remove toolchain line if exists $SED_INPLACE '/^toolchain/d' go.mod diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1d26a21f2..573a11e29 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,11 +3,13 @@ Thanks for taking the time to join our community and start contributing! ## With issues + - Use the search tool before opening a new issue. - Please provide source code and commit sha if you found a bug. - Review existing issues and provide feedback or react to them. ## With pull requests + - Open your pull request against `master` - Your pull request should have no more than two commits, if not you should squash them. - It should pass all tests in the available continuous integrations systems such as GitHub CI. diff --git a/Makefile b/Makefile index d0cd1cc8e..184169a33 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,24 @@ tidy: lint: golangci-lint run -c .golangci.yml +# make branch to=v2.4.0 +.PHONY: branch +branch: + @set -e; \ + newVersion=$(to); \ + if [ -z "$$newVersion" ]; then \ + echo "Error: 'to' variable is required. Usage: make branch to=vX.Y.Z"; \ + exit 1; \ + fi; \ + branchName=fix/$$newVersion; \ + echo "Switching to master branch..."; \ + git checkout master; \ + echo "Pulling latest changes from master..."; \ + git pull origin master; \ + echo "Creating and switching to branch $$branchName from master..."; \ + git checkout -b $$branchName; \ + echo "Branch $$branchName created successfully!" + # make version to=v2.4.0 .PHONY: version version: @@ -18,6 +36,20 @@ version: ./.make_version.sh ./ $$newVersion; \ echo "make version to=$(to) done" +# make tag to=v2.4.0 +.PHONY: tag +tag: + @set -e; \ + newVersion=$(to); \ + echo "Switching to master branch..."; \ + git checkout master; \ + echo "Pulling latest changes from master..."; \ + git pull origin master; \ + echo "Creating annotated tag $$newVersion..."; \ + git tag -a $$newVersion -m "Release $$newVersion"; \ + echo "Pushing tag $$newVersion..."; \ + git push origin $$newVersion; \ + echo "Tag $$newVersion created and pushed successfully!" # update submodules .PHONY: subup diff --git a/README.MD b/README.MD index e958919c2..381f8b484 100644 --- a/README.MD +++ b/README.MD @@ -23,24 +23,23 @@ A powerful framework for faster, easier, and more efficient project development. +## Documentation -# Documentation - -- GoFrame Official Site: [https://goframe.org](https://goframe.org) -- GoFrame Official Site(en): [https://goframe.org/en](https://goframe.org/en) -- GoFrame Mirror Site(中文): [https://goframe.org.cn](https://goframe.org.cn) -- GoFrame Mirror Site(github pages): [https://pages.goframe.org](https://pages.goframe.org) +- Official Site: [https://goframe.org](https://goframe.org) +- Official Site(en): [https://goframe.org/en](https://goframe.org/en) +- 国内镜像: [https://goframe.org.cn](https://goframe.org.cn) +- Mirror Site: [Github Pages](https://pages.goframe.org) +- Mirror Site: [Offline Docs](https://github.com/gogf/goframe.org-pdf?tab=readme-ov-file#%E6%9C%80%E6%96%B0%E7%89%88%E6%9C%AC) - GoDoc API: [https://pkg.go.dev/github.com/gogf/gf/v2](https://pkg.go.dev/github.com/gogf/gf/v2) - -# Contributors +## Contributors 💖 [Thanks to all the contributors who made GoFrame possible](https://github.com/gogf/gf/graphs/contributors) 💖 -goframe contributors +goframe contributors -# License +## License `GoFrame` is licensed under the [MIT License](LICENSE), 100% free and open-source, forever. diff --git a/cmd/gf/go.mod b/cmd/gf/go.mod index 322fc52df..934cc9f1c 100644 --- a/cmd/gf/go.mod +++ b/cmd/gf/go.mod @@ -3,18 +3,18 @@ module github.com/gogf/gf/cmd/gf/v2 go 1.23.0 require ( - github.com/gogf/gf/contrib/drivers/clickhouse/v2 v2.9.3 - github.com/gogf/gf/contrib/drivers/mssql/v2 v2.9.3 - github.com/gogf/gf/contrib/drivers/mysql/v2 v2.9.3 - github.com/gogf/gf/contrib/drivers/oracle/v2 v2.9.3 - github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.9.3 - github.com/gogf/gf/contrib/drivers/sqlite/v2 v2.9.3 - github.com/gogf/gf/v2 v2.9.3 + github.com/gogf/gf/contrib/drivers/clickhouse/v2 v2.9.5 + github.com/gogf/gf/contrib/drivers/mssql/v2 v2.9.5 + github.com/gogf/gf/contrib/drivers/mysql/v2 v2.9.5 + github.com/gogf/gf/contrib/drivers/oracle/v2 v2.9.5 + github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.9.5 + github.com/gogf/gf/contrib/drivers/sqlite/v2 v2.9.5 + github.com/gogf/gf/v2 v2.9.5 github.com/gogf/selfupdate v0.0.0-20231215043001-5c48c528462f - github.com/olekukonko/tablewriter v1.0.9 + github.com/olekukonko/tablewriter v1.1.0 github.com/schollz/progressbar/v3 v3.15.0 - golang.org/x/mod v0.26.0 - golang.org/x/tools v0.35.0 + golang.org/x/mod v0.25.0 + golang.org/x/tools v0.26.0 ) require ( @@ -37,7 +37,7 @@ require ( github.com/grokify/html-strip-tags-go v0.1.0 // indirect github.com/lib/pq v1.10.9 // indirect github.com/magiconair/properties v1.8.10 // indirect - github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/microsoft/go-mssqldb v1.7.1 // indirect @@ -51,16 +51,16 @@ require ( github.com/shopspring/decimal v1.3.1 // indirect github.com/sijms/go-ora/v2 v2.7.10 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect - go.opentelemetry.io/otel v1.37.0 // indirect - go.opentelemetry.io/otel/metric v1.37.0 // indirect - go.opentelemetry.io/otel/sdk v1.37.0 // indirect - go.opentelemetry.io/otel/trace v1.37.0 // indirect - golang.org/x/crypto v0.41.0 // indirect - golang.org/x/net v0.43.0 // indirect - golang.org/x/sync v0.16.0 // indirect + go.opentelemetry.io/otel v1.38.0 // indirect + go.opentelemetry.io/otel/metric v1.38.0 // indirect + go.opentelemetry.io/otel/sdk v1.38.0 // indirect + go.opentelemetry.io/otel/trace v1.38.0 // indirect + golang.org/x/crypto v0.38.0 // indirect + golang.org/x/net v0.40.0 // indirect + golang.org/x/sync v0.14.0 // indirect golang.org/x/sys v0.35.0 // indirect - golang.org/x/term v0.34.0 // indirect - golang.org/x/text v0.28.0 // indirect + golang.org/x/term v0.32.0 // indirect + golang.org/x/text v0.25.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect modernc.org/libc v1.22.5 // indirect modernc.org/mathutil v1.5.0 // indirect diff --git a/cmd/gf/go.sum b/cmd/gf/go.sum index 85f3ac948..26bf6214c 100644 --- a/cmd/gf/go.sum +++ b/cmd/gf/go.sum @@ -46,20 +46,20 @@ github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiU github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI= github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= -github.com/gogf/gf/contrib/drivers/clickhouse/v2 v2.9.3 h1:/Nw0Tg7X4zlF8x72e2slQidiY0J+kqDpLuejNSmaLWk= -github.com/gogf/gf/contrib/drivers/clickhouse/v2 v2.9.3/go.mod h1:NkdRgePcrg6/PD7SUqedtfr3a4E4n3uwVLZ+Xdnq2VU= -github.com/gogf/gf/contrib/drivers/mssql/v2 v2.9.3 h1:kfDQVyHpbpUBS4cZ/8YbAnzqh6KaKP019nXl0FTplZE= -github.com/gogf/gf/contrib/drivers/mssql/v2 v2.9.3/go.mod h1:c/rS7hbTqfTsZdqt6jOE59jeqsPrnYTaUwW2XB+N0kI= -github.com/gogf/gf/contrib/drivers/mysql/v2 v2.9.3 h1:P4jrnp+Vmh3kDeaH/kyHPI6rfoMmQD+sPJa716aMbS0= -github.com/gogf/gf/contrib/drivers/mysql/v2 v2.9.3/go.mod h1:yEhfx78wgpxUJhH9C9bWJ7I3JLcVCzUg11A4ORYTKeg= -github.com/gogf/gf/contrib/drivers/oracle/v2 v2.9.3 h1:TKpjp/jFF2tiOMsKH2PTxZbGFctsi8+CN+dsTA70VEc= -github.com/gogf/gf/contrib/drivers/oracle/v2 v2.9.3/go.mod h1:v10xiQ7LA2dF4RNHa2pojCPgAoXCJEKK1Iw0DRvMwzQ= -github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.9.3 h1:8QgjRauacL7nOKxEHxNiHGL+041ke9lXHe93NIvPYw8= -github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.9.3/go.mod h1:umGqltjrzpY2Il2GF0GX1/TQAk8Xz6vYQM4/q3BuqIo= -github.com/gogf/gf/contrib/drivers/sqlite/v2 v2.9.3 h1:xXOneBClGz9UQmgjc1qRRufPPTtbASDJv32oSdFz+D0= -github.com/gogf/gf/contrib/drivers/sqlite/v2 v2.9.3/go.mod h1:97jRMN7LgWrNgJB3DorP0zlSchGicLO2W6gXk2tffW8= -github.com/gogf/gf/v2 v2.9.3 h1:qjN4s55FfUzxZ1AE8vUHNDX3V0eIOUGXhF2DjRTVZQ4= -github.com/gogf/gf/v2 v2.9.3/go.mod h1:w6rcfD13SmO7FKI80k9LSLiSMGqpMYp50Nfkrrc2sEE= +github.com/gogf/gf/contrib/drivers/clickhouse/v2 v2.9.5 h1:WTbuQvbtOSddi2GtiobM/FCRUr5god7yzlEQP7WGOM8= +github.com/gogf/gf/contrib/drivers/clickhouse/v2 v2.9.5/go.mod h1:/lnvHd9+8VmjDLdgIczzRTJA1tZYY5AA8bdcaexi/ao= +github.com/gogf/gf/contrib/drivers/mssql/v2 v2.9.5 h1:hgkgzbi6j8tDf+UpjG01fLqnAchD3913RZ37ruY9TqE= +github.com/gogf/gf/contrib/drivers/mssql/v2 v2.9.5/go.mod h1:Sy0DQNJ/xEL4snJyWqcflmYGr2jE8Tn9mynxqbe2Dds= +github.com/gogf/gf/contrib/drivers/mysql/v2 v2.9.5 h1:0+ZBYhi4sqwxXwL+hIBpp06a7G4m5nmjskQ3NNb8qYc= +github.com/gogf/gf/contrib/drivers/mysql/v2 v2.9.5/go.mod h1:vyB7J/uJcLCrHD5lfFBzxhEEMkePIRzfhd33EcsuLa0= +github.com/gogf/gf/contrib/drivers/oracle/v2 v2.9.5 h1:eCPD7oteF/gurCU5ZfAhFBU7E1vI85cnoHKRdckn9Vc= +github.com/gogf/gf/contrib/drivers/oracle/v2 v2.9.5/go.mod h1:e5sxdxw3OrAFB+4VdYt3Wbm0G7LP5wofNRKj3JHIots= +github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.9.5 h1:FCgvTLBuhPX7HE6YyR/dbNASoiKv72jpVS5SqoYYJTw= +github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.9.5/go.mod h1:/Lz1qzhYN3ogt5aMFoIfjp82SbeuzjpXCqQhFu4Z3MI= +github.com/gogf/gf/contrib/drivers/sqlite/v2 v2.9.5 h1:MooWqn5qLMfB105PlBvd2Z7J3KdVBsjYxULtb42u308= +github.com/gogf/gf/contrib/drivers/sqlite/v2 v2.9.5/go.mod h1:pr68Q85xhRnJ5PhyGte/LiFJ/m+998RPjW+Jn+w+xYo= +github.com/gogf/gf/v2 v2.9.5 h1:1scfOdHbMP854oQaiLejl+eL+c4xfuvtWmmZiDJxbKs= +github.com/gogf/gf/v2 v2.9.5/go.mod h1:VUb5eyJKpvW77O/dXsbbLNO/Kjrg0UycIiq0lRiBjjo= github.com/gogf/selfupdate v0.0.0-20231215043001-5c48c528462f h1:7xfXR/BhG3JDqO1s45n65Oyx9t4E/UqDOXep6jXdLCM= github.com/gogf/selfupdate v0.0.0-20231215043001-5c48c528462f/go.mod h1:HnYoio6S7VaFJdryKcD/r9HgX+4QzYfr00XiXUo/xz0= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= @@ -100,8 +100,9 @@ github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= -github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= @@ -116,8 +117,8 @@ github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5 github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y= github.com/olekukonko/ll v0.0.9 h1:Y+1YqDfVkqMWuEQMclsF9HUR5+a82+dxJuL1HHSRpxI= github.com/olekukonko/ll v0.0.9/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g= -github.com/olekukonko/tablewriter v1.0.9 h1:XGwRsYLC2bY7bNd93Dk51bcPZksWZmLYuaTHR0FqfL8= -github.com/olekukonko/tablewriter v1.0.9/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= +github.com/olekukonko/tablewriter v1.1.0 h1:N0LHrshF4T39KvI96fn6GT8HEjXRXYNDrDjKFDB7RIY= +github.com/olekukonko/tablewriter v1.1.0/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= github.com/paulmach/orb v0.7.1 h1:Zha++Z5OX/l168sqHK3k4z18LDvr+YAO/VjK0ReQ9rU= github.com/paulmach/orb v0.7.1/go.mod h1:FWRlTgl88VI1RBx/MkrwWDRhQ96ctqMCh8boXhmqB/A= github.com/paulmach/protoscan v0.2.1/go.mod h1:SpcSwydNLrxUGSDvXvO0P7g7AuhJ7lcKfDlhJCDw2gY= @@ -134,8 +135,8 @@ github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qq github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= github.com/schollz/progressbar/v3 v3.15.0 h1:cNZmcNiVyea6oofBTg80ZhVXxf3wG/JoAhqCCwopkQo= github.com/schollz/progressbar/v3 v3.15.0/go.mod h1:ncBdc++eweU0dQoeZJ3loXoAc+bjaallHRIm8pVVeQM= github.com/shirou/gopsutil v2.19.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= @@ -150,8 +151,8 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= -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/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/tklauser/go-sysconf v0.3.10/go.mod h1:C8XykCvCb+Gn0oNCWPIlcb0RuglQTYaQ2hGm7jmxEFk= github.com/tklauser/numcpus v0.4.0/go.mod h1:1+UI3pD8NW14VMwdgJNJ1ESk2UnwhAnz5hMwiKKqXCQ= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -160,38 +161,40 @@ github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQ go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= go.opentelemetry.io/otel v1.7.0/go.mod h1:5BdUoMIz5WEs0vt0CUEMtSSaTSHBBVwrhnz7+nrD5xk= -go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= -go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= -go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= -go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= -go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= -go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= +go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= +go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= +go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= +go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= +go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= go.opentelemetry.io/otel/trace v1.7.0/go.mod h1:fzLSB9nqR2eXzxPXb2JW9IKE+ScyXA48yyE4TNvoHqU= -go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= -go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4= -golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc= +golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8= +golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.26.0 h1:EGMPT//Ezu+ylkCijjPc+f4Aih7sZvaAr+O3EHBxvZg= -golang.org/x/mod v0.26.0/go.mod h1:/j6NAhSk8iQ723BGAUyoAcn7SlD7s15Dp9Nd/SfeaFQ= +golang.org/x/mod v0.25.0 h1:n7a+ZbQKQA/Ysbyb0/6IbB1H/X41mKgbhfv7AfG/44w= +golang.org/x/mod v0.25.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= -golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= +golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= +golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= 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-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw= -golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ= +golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= 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-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -201,24 +204,25 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210228012217-479acdf4ea46/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220429233432-b5fbb4746d32/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= -golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4= -golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw= +golang.org/x/term v0.32.0 h1:DR4lr0TjUs3epypdhTOkMmuF5CDFJ/8pOnbzMZPQ7bg= +golang.org/x/term v0.32.0/go.mod h1:uZG1FhGx848Sqfsq4/DlJr3xGGsYMu/L5GW4abiaEPQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= -golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0= -golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/cmd/gf/internal/cmd/cmd_build.go b/cmd/gf/internal/cmd/cmd_build.go index 2454da574..b39232efa 100644 --- a/cmd/gf/internal/cmd/cmd_build.go +++ b/cmd/gf/internal/cmd/cmd_build.go @@ -30,12 +30,10 @@ import ( "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog" ) -var ( - Build = cBuild{ - nodeNameInConfigFile: "gfcli.build", - packedGoFileName: "internal/packed/build_pack_data.go", - } -) +var Build = cBuild{ + nodeNameInConfigFile: "gfcli.build", + packedGoFileName: "internal/packed/build_pack_data.go", +} type cBuild struct { g.Meta `name:"build" brief:"{cBuildBrief}" dc:"{cBuildDc}" eg:"{cBuildEg}" ad:"{cBuildAd}"` @@ -65,45 +63,67 @@ It provides much more features for building binary: ` cBuildAd = ` PLATFORMS + aix ppc64 + android 386,amd64,arm,arm64 darwin amd64,arm64 + dragonfly amd64 freebsd 386,amd64,arm - linux 386,amd64,arm,arm64,ppc64,ppc64le,mips,mipsle,mips64,mips64le + illumos amd64 + ios arm64 + js wasm + linux 386,amd64,arm,arm64,loong64,mips,mipsle,mips64,mips64le,ppc64,ppc64le,riscv64,s390x netbsd 386,amd64,arm - openbsd 386,amd64,arm - windows 386,amd64 + openbsd 386,amd64,arm,arm64 + plan9 386,amd64,arm + solaris amd64 + wasip1 wasm + windows 386,amd64,arm,arm64 ` // https://golang.google.cn/doc/install/source cBuildPlatforms = ` +aix ppc64 +android 386 +android amd64 +android arm +android arm64 darwin amd64 darwin arm64 -ios amd64 -ios arm64 +dragonfly amd64 freebsd 386 freebsd amd64 freebsd arm +illumos amd64 +ios arm64 +js wasm linux 386 linux amd64 linux arm linux arm64 -linux ppc64 -linux ppc64le +linux loong64 linux mips linux mipsle linux mips64 linux mips64le +linux ppc64 +linux ppc64le +linux riscv64 +linux s390x netbsd 386 netbsd amd64 netbsd arm openbsd 386 openbsd amd64 openbsd arm -windows 386 -windows amd64 -android arm -dragonfly amd64 +openbsd arm64 plan9 386 plan9 amd64 +plan9 arm solaris amd64 +wasip1 wasm +windows 386 +windows amd64 +windows arm +windows arm64 ` ) diff --git a/cmd/gf/internal/cmd/cmd_run.go b/cmd/gf/internal/cmd/cmd_run.go index 64223d98a..224972d89 100644 --- a/cmd/gf/internal/cmd/cmd_run.go +++ b/cmd/gf/internal/cmd/cmd_run.go @@ -27,9 +27,7 @@ import ( "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog" ) -var ( - Run = cRun{} -) +var Run = cRun{} type cRun struct { g.Meta `name:"run" usage:"{cRunUsage}" brief:"{cRunBrief}" eg:"{cRunEg}" dc:"{cRunDc}"` @@ -63,9 +61,7 @@ which compiles and runs the go codes asynchronously when codes change. cRunWatchPathsBrief = `watch additional paths for live reload, separated by ",". i.e. "manifest/config/*.yaml"` ) -var ( - process *gproc.Process -) +var process *gproc.Process func init() { gtag.Sets(g.MapStrStr{ @@ -119,8 +115,12 @@ func (c cRun) Index(ctx context.Context, in cRunInput) (out *cRunOutput, err err } dirty := gtype.NewBool() - var outputPath = app.genOutputPath() + outputPath := app.genOutputPath() callbackFunc := func(event *gfsnotify.Event) { + if !event.IsWrite() && !event.IsCreate() && !event.IsRemove() && !event.IsRename() { + return + } + if gfile.ExtName(event.Path) != "go" { return } diff --git a/cmd/gf/internal/cmd/cmd_z_unit_gen_dao_issue_test.go b/cmd/gf/internal/cmd/cmd_z_unit_gen_dao_issue_test.go index 1ed9853e5..02d5f5936 100644 --- a/cmd/gf/internal/cmd/cmd_z_unit_gen_dao_issue_test.go +++ b/cmd/gf/internal/cmd/cmd_z_unit_gen_dao_issue_test.go @@ -66,6 +66,7 @@ func Test_Gen_Dao_Issue2572(t *testing.T) { NoJsonTag: false, NoModelComment: false, Clear: false, + GenTable: false, TypeMapping: nil, FieldMapping: nil, } @@ -155,6 +156,7 @@ func Test_Gen_Dao_Issue2616(t *testing.T) { NoJsonTag: false, NoModelComment: false, Clear: false, + GenTable: false, TypeMapping: nil, FieldMapping: nil, } @@ -266,6 +268,7 @@ func Test_Gen_Dao_Issue2746(t *testing.T) { NoJsonTag: false, NoModelComment: false, Clear: false, + GenTable: false, TypeMapping: nil, FieldMapping: nil, } @@ -338,6 +341,7 @@ func Test_Gen_Dao_Issue3459(t *testing.T) { NoJsonTag: false, NoModelComment: false, Clear: false, + GenTable: false, TypeMapping: nil, } ) diff --git a/cmd/gf/internal/cmd/cmd_z_unit_gen_dao_test.go b/cmd/gf/internal/cmd/cmd_z_unit_gen_dao_test.go index bbe18735d..863c1090e 100644 --- a/cmd/gf/internal/cmd/cmd_z_unit_gen_dao_test.go +++ b/cmd/gf/internal/cmd/cmd_z_unit_gen_dao_test.go @@ -69,6 +69,7 @@ func Test_Gen_Dao_Default(t *testing.T) { NoJsonTag: false, NoModelComment: false, Clear: false, + GenTable: false, TypeMapping: nil, FieldMapping: nil, } @@ -161,6 +162,7 @@ func Test_Gen_Dao_TypeMapping(t *testing.T) { NoJsonTag: false, NoModelComment: false, Clear: false, + GenTable: false, TypeMapping: map[gendao.DBFieldTypeName]gendao.CustomAttributeType{ "int": { Type: "int64", @@ -263,6 +265,7 @@ func Test_Gen_Dao_FieldMapping(t *testing.T) { NoJsonTag: false, NoModelComment: false, Clear: false, + GenTable: false, TypeMapping: map[gendao.DBFieldTypeName]gendao.CustomAttributeType{ "int": { Type: "int64", diff --git a/cmd/gf/internal/cmd/gendao.zip b/cmd/gf/internal/cmd/gendao.zip new file mode 100644 index 000000000..46dace4f0 Binary files /dev/null and b/cmd/gf/internal/cmd/gendao.zip differ diff --git a/cmd/gf/internal/cmd/gendao/gendao.go b/cmd/gf/internal/cmd/gendao/gendao.go index 053f65e3c..54204755e 100644 --- a/cmd/gf/internal/cmd/gendao/gendao.go +++ b/cmd/gf/internal/cmd/gendao/gendao.go @@ -47,8 +47,10 @@ type ( JsonCase string `name:"jsonCase" short:"j" brief:"{CGenDaoBriefJsonCase}" d:"CamelLower"` ImportPrefix string `name:"importPrefix" short:"i" brief:"{CGenDaoBriefImportPrefix}"` DaoPath string `name:"daoPath" short:"d" brief:"{CGenDaoBriefDaoPath}" d:"dao"` + TablePath string `name:"tablePath" short:"tp" brief:"{CGenDaoBriefTablePath}" d:"table"` DoPath string `name:"doPath" short:"o" brief:"{CGenDaoBriefDoPath}" d:"model/do"` EntityPath string `name:"entityPath" short:"e" brief:"{CGenDaoBriefEntityPath}" d:"model/entity"` + TplDaoTablePath string `name:"tplDaoTablePath" short:"t0" brief:"{CGenDaoBriefTplDaoTablePath}"` TplDaoIndexPath string `name:"tplDaoIndexPath" short:"t1" brief:"{CGenDaoBriefTplDaoIndexPath}"` TplDaoInternalPath string `name:"tplDaoInternalPath" short:"t2" brief:"{CGenDaoBriefTplDaoInternalPath}"` TplDaoDoPath string `name:"tplDaoDoPath" short:"t3" brief:"{CGenDaoBriefTplDaoDoPathPath}"` @@ -61,6 +63,7 @@ type ( NoJsonTag bool `name:"noJsonTag" short:"k" brief:"{CGenDaoBriefNoJsonTag}" orphan:"true"` NoModelComment bool `name:"noModelComment" short:"m" brief:"{CGenDaoBriefNoModelComment}" orphan:"true"` Clear bool `name:"clear" short:"a" brief:"{CGenDaoBriefClear}" orphan:"true"` + GenTable bool `name:"genTable" short:"gt" brief:"{CGenDaoBriefGenTable}" orphan:"true"` TypeMapping map[DBFieldTypeName]CustomAttributeType `name:"typeMapping" short:"y" brief:"{CGenDaoBriefTypeMapping}" orphan:"true"` FieldMapping map[DBTableFieldName]CustomAttributeType `name:"fieldMapping" short:"fm" brief:"{CGenDaoBriefFieldMapping}" orphan:"true"` @@ -190,8 +193,29 @@ func doGenDaoForArray(ctx context.Context, index int, in CGenDaoInput) { // Table excluding. if in.TablesEx != "" { array := garray.NewStrArrayFrom(tableNames) - for _, v := range gstr.SplitAndTrim(in.TablesEx, ",") { - array.RemoveValue(v) + for _, p := range gstr.SplitAndTrim(in.TablesEx, ",") { + if gstr.Contains(p, "*") || gstr.Contains(p, "?") { + p = gstr.ReplaceByMap(p, map[string]string{ + "\r": "", + "\n": "", + }) + p = gstr.ReplaceByMap(p, map[string]string{ + "*": "\r", + "?": "\n", + }) + p = gregex.Quote(p) + p = gstr.ReplaceByMap(p, map[string]string{ + "\r": ".*", + "\n": ".", + }) + for _, v := range array.Clone().Slice() { + if gregex.IsMatchString(p, v) { + array.RemoveValue(v) + } + } + } else { + array.RemoveValue(p) + } } tableNames = array.Slice() } @@ -258,6 +282,14 @@ func doGenDaoForArray(ctx context.Context, index int, in CGenDaoInput) { NewTableNames: newTableNames, ShardingTableSet: shardingNewTableSet, }) + // Table: table fields. + generateTable(ctx, CGenDaoInternalInput{ + CGenDaoInput: in, + DB: db, + TableNames: tableNames, + NewTableNames: newTableNames, + ShardingTableSet: shardingNewTableSet, + }) // Do. generateDo(ctx, CGenDaoInternalInput{ CGenDaoInput: in, diff --git a/cmd/gf/internal/cmd/gendao/gendao_table.go b/cmd/gf/internal/cmd/gendao/gendao_table.go new file mode 100644 index 000000000..4af71fc1c --- /dev/null +++ b/cmd/gf/internal/cmd/gendao/gendao_table.go @@ -0,0 +1,147 @@ +// Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://github.com/gogf/gf. + +package gendao + +import ( + "bytes" + "context" + "path/filepath" + "sort" + "strconv" + "strings" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/os/gfile" + "github.com/gogf/gf/v2/os/gview" + "github.com/gogf/gf/v2/text/gstr" + "github.com/gogf/gf/v2/util/gconv" + + "github.com/gogf/gf/cmd/gf/v2/internal/consts" + "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog" + "github.com/gogf/gf/cmd/gf/v2/internal/utility/utils" +) + +// generateTable generates dao files for given tables. +func generateTable(ctx context.Context, in CGenDaoInternalInput) { + dirPathTable := gfile.Join(in.Path, in.TablePath) + if !in.GenTable { + if gfile.Exists(dirPathTable) { + in.genItems.AppendDirPath(dirPathTable) + } + return + } + in.genItems.AppendDirPath(dirPathTable) + for i := 0; i < len(in.TableNames); i++ { + var ( + realTableName = in.TableNames[i] + newTableName = in.NewTableNames[i] + ) + generateTableSingle(ctx, generateTableSingleInput{ + CGenDaoInternalInput: in, + TableName: realTableName, + NewTableName: newTableName, + DirPathTable: dirPathTable, + }) + } +} + +// generateTableSingleInput is the input parameter for generateTableSingle. +type generateTableSingleInput struct { + CGenDaoInternalInput + // TableName specifies the table name of the table. + TableName string + // NewTableName specifies the prefix-stripped or custom edited name of the table. + NewTableName string + DirPathTable string +} + +// generateTableSingle generates dao files for a single table. +func generateTableSingle(ctx context.Context, in generateTableSingleInput) { + // Generating table data preparing. + fieldMap, err := in.DB.TableFields(ctx, in.TableName) + if err != nil { + mlog.Fatalf(`fetching tables fields failed for table "%s": %+v`, in.TableName, err) + } + + tableNameSnakeCase := gstr.CaseSnake(in.NewTableName) + fileName := gstr.Trim(tableNameSnakeCase, "-_.") + if len(fileName) > 5 && fileName[len(fileName)-5:] == "_test" { + // Add suffix to avoid the table name which contains "_test", + // which would make the go file a testing file. + fileName += "_table" + } + path := filepath.FromSlash(gfile.Join(in.DirPathTable, fileName+".go")) + in.genItems.AppendGeneratedFilePath(path) + if in.OverwriteDao || !gfile.Exists(path) { + var ( + ctx = context.Background() + tplContent = getTemplateFromPathOrDefault( + in.TplDaoTablePath, consts.TemplateGenTableContent, + ) + ) + tplView.ClearAssigns() + tplView.Assigns(gview.Params{ + tplVarGroupName: in.Group, + tplVarTableName: in.TableName, + tplVarTableNameCamelCase: formatFieldName(in.NewTableName, FieldNameCaseCamel), + tplVarPackageName: filepath.Base(in.TablePath), + tplVarTableFields: generateTableFields(fieldMap), + }) + indexContent, err := tplView.ParseContent(ctx, tplContent) + if err != nil { + mlog.Fatalf("parsing template content failed: %v", err) + } + if err = gfile.PutContents(path, strings.TrimSpace(indexContent)); err != nil { + mlog.Fatalf("writing content to '%s' failed: %v", path, err) + } else { + utils.GoFmt(path) + mlog.Print("generated:", gfile.RealPath(path)) + } + } +} + +// generateTableFields generates and returns the field definition content for specified table. +func generateTableFields(fields map[string]*gdb.TableField) string { + var buf bytes.Buffer + fieldNames := make([]string, 0, len(fields)) + for fieldName := range fields { + fieldNames = append(fieldNames, fieldName) + } + sort.Slice(fieldNames, func(i, j int) bool { + return fields[fieldNames[i]].Index < fields[fieldNames[j]].Index // asc + }) + for index, fieldName := range fieldNames { + field := fields[fieldName] + buf.WriteString(" " + strconv.Quote(field.Name) + ": {\n") + buf.WriteString(" Index: " + gconv.String(field.Index) + ",\n") + buf.WriteString(" Name: " + strconv.Quote(field.Name) + ",\n") + buf.WriteString(" Type: " + strconv.Quote(field.Type) + ",\n") + buf.WriteString(" Null: " + gconv.String(field.Null) + ",\n") + buf.WriteString(" Key: " + strconv.Quote(field.Key) + ",\n") + buf.WriteString(" Default: " + generateDefaultValue(field.Default) + ",\n") + buf.WriteString(" Extra: " + strconv.Quote(field.Extra) + ",\n") + buf.WriteString(" Comment: " + strconv.Quote(field.Comment) + ",\n") + buf.WriteString(" },") + if index != len(fieldNames)-1 { + buf.WriteString("\n") + } + } + return buf.String() +} + +// generateDefaultValue generates and returns the default value definition for specified field. +func generateDefaultValue(value interface{}) string { + if value == nil { + return "nil" + } + switch v := value.(type) { + case string: + return strconv.Quote(v) + default: + return gconv.String(v) + } +} diff --git a/cmd/gf/internal/cmd/gendao/gendao_tag.go b/cmd/gf/internal/cmd/gendao/gendao_tag.go index 6feeb8081..25bc84258 100644 --- a/cmd/gf/internal/cmd/gendao/gendao_tag.go +++ b/cmd/gf/internal/cmd/gendao/gendao_tag.go @@ -60,6 +60,7 @@ CONFIGURATION SUPPORT CGenDaoBriefGJsonSupport = `use gJsonSupport to use *gjson.Json instead of string for generated json fields of tables` CGenDaoBriefImportPrefix = `custom import prefix for generated go files` CGenDaoBriefDaoPath = `directory path for storing generated dao files under path` + CGenDaoBriefTablePath = `directory path for storing generated table files under path` CGenDaoBriefDoPath = `directory path for storing generated do files under path` CGenDaoBriefEntityPath = `directory path for storing generated entity files under path` CGenDaoBriefOverwriteDao = `overwrite all dao files both inside/outside internal folder` @@ -69,6 +70,7 @@ CONFIGURATION SUPPORT CGenDaoBriefNoJsonTag = `no json tag will be added for each field` CGenDaoBriefNoModelComment = `no model comment will be added for each field` CGenDaoBriefClear = `delete all generated go files that do not exist in database` + CGenDaoBriefGenTable = `generate table files` CGenDaoBriefTypeMapping = `custom local type mapping for generated struct attributes relevant to fields of table` CGenDaoBriefFieldMapping = `custom local type mapping for generated struct attributes relevant to specific fields of table` CGenDaoBriefShardingPattern = `sharding pattern for table name, e.g. "users_?" will be replace tables "users_001,users_002,..." to "users" dao` @@ -98,6 +100,7 @@ generated json tag case for model struct, cases are as follows: tplVarTableNameCamelLowerCase = `TplTableNameCamelLowerCase` tplVarTableSharding = `TplTableSharding` tplVarTableShardingPrefix = `TplTableShardingPrefix` + tplVarTableFields = `TplTableFields` tplVarPackageImports = `TplPackageImports` tplVarImportPrefix = `TplImportPrefix` tplVarStructDefine = `TplStructDefine` @@ -126,6 +129,7 @@ func init() { `CGenDaoBriefStdTime`: CGenDaoBriefStdTime, `CGenDaoBriefWithTime`: CGenDaoBriefWithTime, `CGenDaoBriefDaoPath`: CGenDaoBriefDaoPath, + `CGenDaoBriefTablePath`: CGenDaoBriefTablePath, `CGenDaoBriefDoPath`: CGenDaoBriefDoPath, `CGenDaoBriefEntityPath`: CGenDaoBriefEntityPath, `CGenDaoBriefGJsonSupport`: CGenDaoBriefGJsonSupport, @@ -137,6 +141,7 @@ func init() { `CGenDaoBriefNoJsonTag`: CGenDaoBriefNoJsonTag, `CGenDaoBriefNoModelComment`: CGenDaoBriefNoModelComment, `CGenDaoBriefClear`: CGenDaoBriefClear, + `CGenDaoBriefGenTable`: CGenDaoBriefGenTable, `CGenDaoBriefTypeMapping`: CGenDaoBriefTypeMapping, `CGenDaoBriefFieldMapping`: CGenDaoBriefFieldMapping, `CGenDaoBriefShardingPattern`: CGenDaoBriefShardingPattern, diff --git a/cmd/gf/internal/cmd/testdata/build/varmap/go.mod b/cmd/gf/internal/cmd/testdata/build/varmap/go.mod index a2a4d9e0a..05d198d5f 100644 --- a/cmd/gf/internal/cmd/testdata/build/varmap/go.mod +++ b/cmd/gf/internal/cmd/testdata/build/varmap/go.mod @@ -4,11 +4,11 @@ go 1.23.0 toolchain go1.24.6 -require github.com/gogf/gf/v2 v2.9.3 +require github.com/gogf/gf/v2 v2.9.5 require ( - go.opentelemetry.io/otel v1.37.0 // indirect - go.opentelemetry.io/otel/trace v1.37.0 // indirect + go.opentelemetry.io/otel v1.38.0 // indirect + go.opentelemetry.io/otel/trace v1.38.0 // indirect golang.org/x/text v0.28.0 // indirect ) diff --git a/cmd/gf/internal/cmd/testdata/build/varmap/go.sum b/cmd/gf/internal/cmd/testdata/build/varmap/go.sum index 7c5ad1392..16671703d 100644 --- a/cmd/gf/internal/cmd/testdata/build/varmap/go.sum +++ b/cmd/gf/internal/cmd/testdata/build/varmap/go.sum @@ -24,8 +24,8 @@ github.com/grokify/html-strip-tags-go v0.1.0 h1:03UrQLjAny8xci+R+qjCce/MYnpNXCtg github.com/grokify/html-strip-tags-go v0.1.0/go.mod h1:ZdzgfHEzAfz9X6Xe5eBLVblWIxXfYSQ40S/VKrAOGpc= github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= -github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= @@ -34,26 +34,26 @@ github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5 github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y= github.com/olekukonko/ll v0.0.9 h1:Y+1YqDfVkqMWuEQMclsF9HUR5+a82+dxJuL1HHSRpxI= github.com/olekukonko/ll v0.0.9/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g= -github.com/olekukonko/tablewriter v1.0.9 h1:XGwRsYLC2bY7bNd93Dk51bcPZksWZmLYuaTHR0FqfL8= -github.com/olekukonko/tablewriter v1.0.9/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= +github.com/olekukonko/tablewriter v1.1.0 h1:N0LHrshF4T39KvI96fn6GT8HEjXRXYNDrDjKFDB7RIY= +github.com/olekukonko/tablewriter v1.1.0/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= -github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -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/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= -go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= -go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= -go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= -go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= -go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= -go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= -go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= -golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= -golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= +go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= +go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= +go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= +go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= +golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= +golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= diff --git a/cmd/gf/internal/consts/consts_gen_dao_template_table.go b/cmd/gf/internal/consts/consts_gen_dao_template_table.go new file mode 100644 index 000000000..a60c92d5d --- /dev/null +++ b/cmd/gf/internal/consts/consts_gen_dao_template_table.go @@ -0,0 +1,35 @@ +// Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://github.com/gogf/gf. + +package consts + +const TemplateGenTableContent = ` +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package {{.TplPackageName}} + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" +) + +// {{.TplTableNameCamelCase}} defines the fields of table "{{.TplTableName}}" with their properties. +// This map is used internally by GoFrame ORM to understand table structure. +var {{.TplTableNameCamelCase}} = map[string]*gdb.TableField{ +{{.TplTableFields}} +} + +// Set{{.TplTableNameCamelCase}}TableFields registers the table fields definition to the database instance. +// db: database instance that implements gdb.DB interface. +// schema: optional schema/namespace name, especially for databases that support schemas. +func Set{{.TplTableNameCamelCase}}TableFields(ctx context.Context, db gdb.DB, schema ...string) error { + return db.GetCore().SetTableFields(ctx, "{{.TplTableName}}", {{.TplTableNameCamelCase}}, schema...) +} + +` diff --git a/container/garray/garray_func.go b/container/garray/garray_func.go index 155cca0d8..4bf5fbba4 100644 --- a/container/garray/garray_func.go +++ b/container/garray/garray_func.go @@ -6,7 +6,10 @@ package garray -import "strings" +import ( + "sort" + "strings" +) // defaultComparatorInt for int comparison. func defaultComparatorInt(a, b int) int { @@ -24,6 +27,14 @@ func defaultComparatorStr(a, b string) int { return strings.Compare(a, b) } +// defaultSorter is a generic sorting function that sorts a slice of comparable types +// using the provided comparator function. +func defaultSorter[T comparable](values []T, comparator func(a T, b T) int) { + sort.Slice(values, func(i, j int) bool { + return comparator(values[i], values[j]) < 0 + }) +} + // quickSortInt is the quick-sorting algorithm implements for int. func quickSortInt(values []int, comparator func(a, b int) int) { if len(values) <= 1 { @@ -67,3 +78,51 @@ func quickSortStr(values []string, comparator func(a, b string) int) { quickSortStr(values[:head], comparator) quickSortStr(values[head+1:], comparator) } + +// tToAnySlice converts []T to []any +func tToAnySlice[T any](values []T) []any { + if values == nil { + return nil + } + anyValues := make([]any, len(values), cap(values)) + for k, v := range values { + anyValues[k] = v + } + return anyValues +} + +// anyToTSlice is convert []any to []T +func anyToTSlice[T any](values []any) []T { + if values == nil { + return nil + } + tValues := make([]T, len(values), cap(values)) + for k, v := range values { + tValues[k], _ = v.(T) + } + return tValues +} + +// tToAnySlices converts [][]T to [][]any +func tToAnySlices[T any](values [][]T) [][]any { + if values == nil { + return nil + } + anyValues := make([][]any, len(values), cap(values)) + for k, v := range values { + anyValues[k] = tToAnySlice(v) + } + return anyValues +} + +// anyToTSlices converts [][]any to [][]T +func anyToTSlices[T any](values [][]any) [][]T { + if values == nil { + return nil + } + tValues := make([][]T, len(values), cap(values)) + for k, v := range values { + tValues[k] = anyToTSlice[T](v) + } + return tValues +} diff --git a/container/garray/garray_normal_any.go b/container/garray/garray_normal_any.go index cc17dcb37..2c22125e1 100644 --- a/container/garray/garray_normal_any.go +++ b/container/garray/garray_normal_any.go @@ -7,28 +7,18 @@ package garray import ( - "bytes" "fmt" - "math" - "sort" + "sync" - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/errors/gerror" - "github.com/gogf/gf/v2/internal/deepcopy" - "github.com/gogf/gf/v2/internal/empty" - "github.com/gogf/gf/v2/internal/json" - "github.com/gogf/gf/v2/internal/rwmutex" - "github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/util/gconv" - "github.com/gogf/gf/v2/util/grand" ) // Array is a golang array with rich features. // It contains a concurrent-safe/unsafe switch, which should be set // when its initialization and cannot be changed then. type Array struct { - mu rwmutex.RWMutex - array []any + *TArray[any] + once sync.Once } // New creates and returns an empty array. @@ -48,8 +38,7 @@ func NewArray(safe ...bool) *Array { // which is false in default. func NewArraySize(size int, cap int, safe ...bool) *Array { return &Array{ - mu: rwmutex.Create(safe...), - array: make([]any, size, cap), + TArray: NewTArraySize[any](size, cap, safe...), } } @@ -85,8 +74,7 @@ func NewFromCopy(array []any, safe ...bool) *Array { // which is false in default. func NewArrayFrom(array []any, safe ...bool) *Array { return &Array{ - mu: rwmutex.Create(safe...), - array: array, + TArray: NewTArrayFrom(array, safe...), } } @@ -96,265 +84,149 @@ func NewArrayFrom(array []any, safe ...bool) *Array { func NewArrayFromCopy(array []any, safe ...bool) *Array { newArray := make([]any, len(array)) copy(newArray, array) - return &Array{ - mu: rwmutex.Create(safe...), - array: newArray, - } + return NewArrayFrom(newArray, safe...) +} + +// lazyInit lazily initializes the array. +func (a *Array) lazyInit() { + a.once.Do(func() { + if a.TArray == nil { + a.TArray = NewTArray[any](false) + } + }) } // At returns the value by the specified index. // If the given `index` is out of range of the array, it returns `nil`. func (a *Array) At(index int) (value any) { - value, _ = a.Get(index) - return + a.lazyInit() + return a.TArray.At(index) } // Get returns the value by the specified index. // If the given `index` is out of range of the array, the `found` is false. func (a *Array) Get(index int) (value any, found bool) { - a.mu.RLock() - defer a.mu.RUnlock() - if index < 0 || index >= len(a.array) { - return nil, false - } - return a.array[index], true + a.lazyInit() + return a.TArray.Get(index) } // Set sets value to specified index. func (a *Array) Set(index int, value any) error { - a.mu.Lock() - defer a.mu.Unlock() - if index < 0 || index >= len(a.array) { - return gerror.NewCodef(gcode.CodeInvalidParameter, "index %d out of array range %d", index, len(a.array)) - } - a.array[index] = value - return nil + a.lazyInit() + return a.TArray.Set(index, value) } // SetArray sets the underlying slice array with the given `array`. func (a *Array) SetArray(array []any) *Array { - a.mu.Lock() - defer a.mu.Unlock() - a.array = array + a.lazyInit() + a.TArray.SetArray(array) return a } // Replace replaces the array items by given `array` from the beginning of array. func (a *Array) Replace(array []any) *Array { - a.mu.Lock() - defer a.mu.Unlock() - max := len(array) - if max > len(a.array) { - max = len(a.array) - } - for i := 0; i < max; i++ { - a.array[i] = array[i] - } + a.lazyInit() + a.TArray.Replace(array) return a } // Sum returns the sum of values in an array. func (a *Array) Sum() (sum int) { - a.mu.RLock() - defer a.mu.RUnlock() - for _, v := range a.array { - sum += gconv.Int(v) - } - return + a.lazyInit() + return a.TArray.Sum() } // SortFunc sorts the array by custom function `less`. func (a *Array) SortFunc(less func(v1, v2 any) bool) *Array { - a.mu.Lock() - defer a.mu.Unlock() - sort.Slice(a.array, func(i, j int) bool { - return less(a.array[i], a.array[j]) - }) + a.lazyInit() + a.TArray.SortFunc(less) return a } // InsertBefore inserts the `values` to the front of `index`. func (a *Array) InsertBefore(index int, values ...any) error { - a.mu.Lock() - defer a.mu.Unlock() - if index < 0 || index >= len(a.array) { - return gerror.NewCodef(gcode.CodeInvalidParameter, "index %d out of array range %d", index, len(a.array)) - } - rear := append([]any{}, a.array[index:]...) - a.array = append(a.array[0:index], values...) - a.array = append(a.array, rear...) - return nil + a.lazyInit() + return a.TArray.InsertBefore(index, values...) } // InsertAfter inserts the `values` to the back of `index`. func (a *Array) InsertAfter(index int, values ...any) error { - a.mu.Lock() - defer a.mu.Unlock() - if index < 0 || index >= len(a.array) { - return gerror.NewCodef(gcode.CodeInvalidParameter, "index %d out of array range %d", index, len(a.array)) - } - rear := append([]any{}, a.array[index+1:]...) - a.array = append(a.array[0:index+1], values...) - a.array = append(a.array, rear...) - return nil + a.lazyInit() + return a.TArray.InsertAfter(index, values...) } // Remove removes an item by index. // If the given `index` is out of range of the array, the `found` is false. func (a *Array) Remove(index int) (value any, found bool) { - a.mu.Lock() - defer a.mu.Unlock() - return a.doRemoveWithoutLock(index) -} - -// doRemoveWithoutLock removes an item by index without lock. -func (a *Array) doRemoveWithoutLock(index int) (value any, found bool) { - if index < 0 || index >= len(a.array) { - return nil, false - } - // Determine array boundaries when deleting to improve deletion efficiency. - if index == 0 { - value := a.array[0] - a.array = a.array[1:] - return value, true - } else if index == len(a.array)-1 { - value := a.array[index] - a.array = a.array[:index] - return value, true - } - // If it is a non-boundary delete, - // it will involve the creation of an array, - // then the deletion is less efficient. - value = a.array[index] - a.array = append(a.array[:index], a.array[index+1:]...) - return value, true + a.lazyInit() + return a.TArray.Remove(index) } // RemoveValue removes an item by value. // It returns true if value is found in the array, or else false if not found. func (a *Array) RemoveValue(value any) bool { - a.mu.Lock() - defer a.mu.Unlock() - if i := a.doSearchWithoutLock(value); i != -1 { - a.doRemoveWithoutLock(i) - return true - } - return false + a.lazyInit() + return a.TArray.RemoveValue(value) } // RemoveValues removes multiple items by `values`. func (a *Array) RemoveValues(values ...any) { - a.mu.Lock() - defer a.mu.Unlock() - for _, value := range values { - if i := a.doSearchWithoutLock(value); i != -1 { - a.doRemoveWithoutLock(i) - } - } + a.lazyInit() + a.TArray.RemoveValues(values...) } // PushLeft pushes one or multiple items to the beginning of array. func (a *Array) PushLeft(value ...any) *Array { - a.mu.Lock() - a.array = append(value, a.array...) - a.mu.Unlock() + a.lazyInit() + a.TArray.PushLeft(value...) return a } // PushRight pushes one or multiple items to the end of array. // It equals to Append. func (a *Array) PushRight(value ...any) *Array { - a.mu.Lock() - a.array = append(a.array, value...) - a.mu.Unlock() + a.lazyInit() + a.TArray.PushRight(value...) return a } // PopRand randomly pops and return an item out of array. // Note that if the array is empty, the `found` is false. func (a *Array) PopRand() (value any, found bool) { - a.mu.Lock() - defer a.mu.Unlock() - return a.doRemoveWithoutLock(grand.Intn(len(a.array))) + a.lazyInit() + return a.TArray.PopRand() } // PopRands randomly pops and returns `size` items out of array. func (a *Array) PopRands(size int) []any { - a.mu.Lock() - defer a.mu.Unlock() - if size <= 0 || len(a.array) == 0 { - return nil - } - if size >= len(a.array) { - size = len(a.array) - } - array := make([]any, size) - for i := 0; i < size; i++ { - array[i], _ = a.doRemoveWithoutLock(grand.Intn(len(a.array))) - } - return array + a.lazyInit() + return a.TArray.PopRands(size) } // PopLeft pops and returns an item from the beginning of array. // Note that if the array is empty, the `found` is false. func (a *Array) PopLeft() (value any, found bool) { - a.mu.Lock() - defer a.mu.Unlock() - if len(a.array) == 0 { - return nil, false - } - value = a.array[0] - a.array = a.array[1:] - return value, true + a.lazyInit() + return a.TArray.PopLeft() } // PopRight pops and returns an item from the end of array. // Note that if the array is empty, the `found` is false. func (a *Array) PopRight() (value any, found bool) { - a.mu.Lock() - defer a.mu.Unlock() - index := len(a.array) - 1 - if index < 0 { - return nil, false - } - value = a.array[index] - a.array = a.array[:index] - return value, true + a.lazyInit() + return a.TArray.PopRight() } // PopLefts pops and returns `size` items from the beginning of array. func (a *Array) PopLefts(size int) []any { - a.mu.Lock() - defer a.mu.Unlock() - if size <= 0 || len(a.array) == 0 { - return nil - } - if size >= len(a.array) { - array := a.array - a.array = a.array[:0] - return array - } - value := a.array[0:size] - a.array = a.array[size:] - return value + a.lazyInit() + return a.TArray.PopLefts(size) } // PopRights pops and returns `size` items from the end of array. func (a *Array) PopRights(size int) []any { - a.mu.Lock() - defer a.mu.Unlock() - if size <= 0 || len(a.array) == 0 { - return nil - } - index := len(a.array) - size - if index <= 0 { - array := a.array - a.array = a.array[:0] - return array - } - value := a.array[index:] - a.array = a.array[:index] - return value + a.lazyInit() + return a.TArray.PopRights(size) } // Range picks and returns items by range, like array[start:end]. @@ -365,26 +237,8 @@ func (a *Array) PopRights(size int) []any { // If `end` is omitted, then the sequence will have everything from start up // until the end of the array. func (a *Array) Range(start int, end ...int) []any { - a.mu.RLock() - defer a.mu.RUnlock() - offsetEnd := len(a.array) - if len(end) > 0 && end[0] < offsetEnd { - offsetEnd = end[0] - } - if start > offsetEnd { - return nil - } - if start < 0 { - start = 0 - } - array := ([]any)(nil) - if a.mu.IsSafe() { - array = make([]any, offsetEnd-start) - copy(array, a.array[start:offsetEnd]) - } else { - array = a.array[start:offsetEnd] - } - return array + a.lazyInit() + return a.TArray.Range(start, end...) } // SubSlice returns a slice of elements from the array as specified @@ -401,69 +255,29 @@ func (a *Array) Range(start int, end ...int) []any { // // Any possibility crossing the left border of array, it will fail. func (a *Array) SubSlice(offset int, length ...int) []any { - a.mu.RLock() - defer a.mu.RUnlock() - size := len(a.array) - if len(length) > 0 { - size = length[0] - } - if offset > len(a.array) { - return nil - } - if offset < 0 { - offset = len(a.array) + offset - if offset < 0 { - return nil - } - } - if size < 0 { - offset += size - size = -size - if offset < 0 { - return nil - } - } - end := offset + size - if end > len(a.array) { - end = len(a.array) - size = len(a.array) - offset - } - if a.mu.IsSafe() { - s := make([]any, size) - copy(s, a.array[offset:]) - return s - } else { - return a.array[offset:end] - } + a.lazyInit() + return a.TArray.SubSlice(offset, length...) } // Append is alias of PushRight, please See PushRight. func (a *Array) Append(value ...any) *Array { - a.PushRight(value...) + a.lazyInit() + a.TArray.Append(value...) return a } // Len returns the length of array. func (a *Array) Len() int { - a.mu.RLock() - length := len(a.array) - a.mu.RUnlock() - return length + a.lazyInit() + return a.TArray.Len() } // Slice returns the underlying data of array. // Note that, if it's in concurrent-safe usage, it returns a copy of underlying data, // or else a pointer to the underlying data. func (a *Array) Slice() []any { - if a.mu.IsSafe() { - a.mu.RLock() - defer a.mu.RUnlock() - array := make([]any, len(a.array)) - copy(array, a.array) - return array - } else { - return a.array - } + a.lazyInit() + return a.TArray.Slice() } // Interfaces returns current array as []any. @@ -473,89 +287,49 @@ func (a *Array) Interfaces() []any { // Clone returns a new array, which is a copy of current array. func (a *Array) Clone() (newArray *Array) { - a.mu.RLock() - array := make([]any, len(a.array)) - copy(array, a.array) - a.mu.RUnlock() - return NewArrayFrom(array, a.mu.IsSafe()) + a.lazyInit() + return &Array{TArray: a.TArray.Clone()} } // Clear deletes all items of current array. func (a *Array) Clear() *Array { - a.mu.Lock() - if len(a.array) > 0 { - a.array = make([]any, 0) - } - a.mu.Unlock() + a.lazyInit() + a.TArray.Clear() return a } // Contains checks whether a value exists in the array. func (a *Array) Contains(value any) bool { - return a.Search(value) != -1 + a.lazyInit() + return a.TArray.Contains(value) } // Search searches array by `value`, returns the index of `value`, // or returns -1 if not exists. func (a *Array) Search(value any) int { - a.mu.RLock() - defer a.mu.RUnlock() - return a.doSearchWithoutLock(value) -} - -func (a *Array) doSearchWithoutLock(value any) int { - if len(a.array) == 0 { - return -1 - } - result := -1 - for index, v := range a.array { - if v == value { - result = index - break - } - } - return result + a.lazyInit() + return a.TArray.Search(value) } // Unique uniques the array, clear repeated items. // Example: [1,1,2,3,2] -> [1,2,3] func (a *Array) Unique() *Array { - a.mu.Lock() - defer a.mu.Unlock() - if len(a.array) == 0 { - return a - } - var ( - ok bool - temp any - uniqueSet = make(map[any]struct{}) - uniqueArray = make([]any, 0, len(a.array)) - ) - for i := 0; i < len(a.array); i++ { - temp = a.array[i] - if _, ok = uniqueSet[temp]; ok { - continue - } - uniqueSet[temp] = struct{}{} - uniqueArray = append(uniqueArray, temp) - } - a.array = uniqueArray + a.lazyInit() + a.TArray.Unique() return a } // LockFunc locks writing by callback function `f`. func (a *Array) LockFunc(f func(array []any)) *Array { - a.mu.Lock() - defer a.mu.Unlock() - f(a.array) + a.lazyInit() + a.TArray.LockFunc(f) return a } // RLockFunc locks reading by callback function `f`. func (a *Array) RLockFunc(f func(array []any)) *Array { - a.mu.RLock() - defer a.mu.RUnlock() - f(a.array) + a.lazyInit() + a.TArray.RLockFunc(f) return a } @@ -564,48 +338,23 @@ func (a *Array) RLockFunc(f func(array []any)) *Array { // The difference between Merge and Append is Append supports only specified slice type, // but Merge supports more parameter types. func (a *Array) Merge(array any) *Array { + a.lazyInit() return a.Append(gconv.Interfaces(array)...) } // Fill fills an array with num entries of the value `value`, // keys starting at the `startIndex` parameter. func (a *Array) Fill(startIndex int, num int, value any) error { - a.mu.Lock() - defer a.mu.Unlock() - if startIndex < 0 || startIndex > len(a.array) { - return gerror.NewCodef(gcode.CodeInvalidParameter, "index %d out of array range %d", startIndex, len(a.array)) - } - for i := startIndex; i < startIndex+num; i++ { - if i > len(a.array)-1 { - a.array = append(a.array, value) - } else { - a.array[i] = value - } - } - return nil + a.lazyInit() + return a.TArray.Fill(startIndex, num, value) } // Chunk splits an array into multiple arrays, // the size of each array is determined by `size`. // The last chunk may contain less than size elements. func (a *Array) Chunk(size int) [][]any { - if size < 1 { - return nil - } - a.mu.RLock() - defer a.mu.RUnlock() - length := len(a.array) - chunks := int(math.Ceil(float64(length) / float64(size))) - var n [][]any - for i, end := 0, 0; chunks > 0; chunks-- { - end = (i + 1) * size - if end > length { - end = length - } - n = append(n, a.array[i*size:end]) - i++ - } - return n + a.lazyInit() + return a.TArray.Chunk(size) } // Pad pads array to the specified length with `value`. @@ -613,98 +362,47 @@ func (a *Array) Chunk(size int) [][]any { // If the absolute value of `size` is less than or equal to the length of the array // then no padding takes place. func (a *Array) Pad(size int, val any) *Array { - a.mu.Lock() - defer a.mu.Unlock() - if size == 0 || (size > 0 && size < len(a.array)) || (size < 0 && size > -len(a.array)) { - return a - } - n := size - if size < 0 { - n = -size - } - n -= len(a.array) - tmp := make([]any, n) - for i := 0; i < n; i++ { - tmp[i] = val - } - if size > 0 { - a.array = append(a.array, tmp...) - } else { - a.array = append(tmp, a.array...) - } + a.lazyInit() + a.TArray.Pad(size, val) return a } // Rand randomly returns one item from array(no deleting). func (a *Array) Rand() (value any, found bool) { - a.mu.RLock() - defer a.mu.RUnlock() - if len(a.array) == 0 { - return nil, false - } - return a.array[grand.Intn(len(a.array))], true + a.lazyInit() + return a.TArray.Rand() } // Rands randomly returns `size` items from array(no deleting). func (a *Array) Rands(size int) []any { - a.mu.RLock() - defer a.mu.RUnlock() - if size <= 0 || len(a.array) == 0 { - return nil - } - array := make([]any, size) - for i := 0; i < size; i++ { - array[i] = a.array[grand.Intn(len(a.array))] - } - return array + a.lazyInit() + return a.TArray.Rands(size) } // Shuffle randomly shuffles the array. func (a *Array) Shuffle() *Array { - a.mu.Lock() - defer a.mu.Unlock() - for i, v := range grand.Perm(len(a.array)) { - a.array[i], a.array[v] = a.array[v], a.array[i] - } + a.lazyInit() + a.TArray.Shuffle() return a } // Reverse makes array with elements in reverse order. func (a *Array) Reverse() *Array { - a.mu.Lock() - defer a.mu.Unlock() - for i, j := 0, len(a.array)-1; i < j; i, j = i+1, j-1 { - a.array[i], a.array[j] = a.array[j], a.array[i] - } + a.lazyInit() + a.TArray.Reverse() return a } // Join joins array elements with a string `glue`. func (a *Array) Join(glue string) string { - a.mu.RLock() - defer a.mu.RUnlock() - if len(a.array) == 0 { - return "" - } - buffer := bytes.NewBuffer(nil) - for k, v := range a.array { - buffer.WriteString(gconv.String(v)) - if k != len(a.array)-1 { - buffer.WriteString(glue) - } - } - return buffer.String() + a.lazyInit() + return a.TArray.Join(glue) } // CountValues counts the number of occurrences of all values in the array. func (a *Array) CountValues() map[any]int { - m := make(map[any]int) - a.mu.RLock() - defer a.mu.RUnlock() - for _, v := range a.array { - m[v]++ - } - return m + a.lazyInit() + return a.TArray.CountValues() } // Iterator is alias of IteratorAsc. @@ -715,25 +413,15 @@ func (a *Array) Iterator(f func(k int, v any) bool) { // IteratorAsc iterates the array readonly in ascending order with given callback function `f`. // If `f` returns true, then it continues iterating; or false to stop. func (a *Array) IteratorAsc(f func(k int, v any) bool) { - a.mu.RLock() - defer a.mu.RUnlock() - for k, v := range a.array { - if !f(k, v) { - break - } - } + a.lazyInit() + a.TArray.IteratorAsc(f) } // IteratorDesc iterates the array readonly in descending order with given callback function `f`. // If `f` returns true, then it continues iterating; or false to stop. func (a *Array) IteratorDesc(f func(k int, v any) bool) { - a.mu.RLock() - defer a.mu.RUnlock() - for i := len(a.array) - 1; i >= 0; i-- { - if !f(i, a.array[i]) { - break - } - } + a.lazyInit() + a.TArray.IteratorDesc(f) } // String returns current array as a string, which implements like json.Marshal does. @@ -741,118 +429,64 @@ func (a *Array) String() string { if a == nil { return "" } - a.mu.RLock() - defer a.mu.RUnlock() - buffer := bytes.NewBuffer(nil) - buffer.WriteByte('[') - s := "" - for k, v := range a.array { - s = gconv.String(v) - if gstr.IsNumeric(s) { - buffer.WriteString(s) - } else { - buffer.WriteString(`"` + gstr.QuoteMeta(s, `"\`) + `"`) - } - if k != len(a.array)-1 { - buffer.WriteByte(',') - } - } - buffer.WriteByte(']') - return buffer.String() + a.lazyInit() + return a.TArray.String() } // MarshalJSON implements the interface MarshalJSON for json.Marshal. // Note that do not use pointer as its receiver here. func (a Array) MarshalJSON() ([]byte, error) { - a.mu.RLock() - defer a.mu.RUnlock() - return json.Marshal(a.array) + a.lazyInit() + return a.TArray.MarshalJSON() } // UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal. func (a *Array) UnmarshalJSON(b []byte) error { - if a.array == nil { - a.array = make([]any, 0) - } - a.mu.Lock() - defer a.mu.Unlock() - if err := json.UnmarshalUseNumber(b, &a.array); err != nil { - return err - } - return nil + a.lazyInit() + return a.TArray.UnmarshalJSON(b) } // UnmarshalValue is an interface implement which sets any type of value for array. func (a *Array) UnmarshalValue(value any) error { - a.mu.Lock() - defer a.mu.Unlock() - switch value.(type) { - case string, []byte: - return json.UnmarshalUseNumber(gconv.Bytes(value), &a.array) - default: - a.array = gconv.SliceAny(value) - } - return nil + a.lazyInit() + return a.TArray.UnmarshalValue(value) } // Filter iterates array and filters elements using custom callback function. // It removes the element from array if callback function `filter` returns true, // it or else does nothing and continues iterating. func (a *Array) Filter(filter func(index int, value any) bool) *Array { - a.mu.Lock() - defer a.mu.Unlock() - for i := 0; i < len(a.array); { - if filter(i, a.array[i]) { - a.array = append(a.array[:i], a.array[i+1:]...) - } else { - i++ - } - } + a.lazyInit() + a.TArray.Filter(filter) return a } // FilterNil removes all nil value of the array. func (a *Array) FilterNil() *Array { - a.mu.Lock() - defer a.mu.Unlock() - for i := 0; i < len(a.array); { - if empty.IsNil(a.array[i]) { - a.array = append(a.array[:i], a.array[i+1:]...) - } else { - i++ - } - } + a.lazyInit() + a.TArray.FilterNil() return a } // FilterEmpty removes all empty value of the array. // Values like: 0, nil, false, "", len(slice/map/chan) == 0 are considered empty. func (a *Array) FilterEmpty() *Array { - a.mu.Lock() - defer a.mu.Unlock() - for i := 0; i < len(a.array); { - if empty.IsEmpty(a.array[i]) { - a.array = append(a.array[:i], a.array[i+1:]...) - } else { - i++ - } - } + a.lazyInit() + a.TArray.FilterEmpty() return a } // Walk applies a user supplied function `f` to every item of array. func (a *Array) Walk(f func(value any) any) *Array { - a.mu.Lock() - defer a.mu.Unlock() - for i, v := range a.array { - a.array[i] = f(v) - } + a.lazyInit() + a.TArray.Walk(f) return a } // IsEmpty checks whether the array is empty. func (a *Array) IsEmpty() bool { - return a.Len() == 0 + a.lazyInit() + return a.TArray.IsEmpty() } // DeepCopy implements interface for deep copy of current type. @@ -860,11 +494,8 @@ func (a *Array) DeepCopy() any { if a == nil { return nil } - a.mu.RLock() - defer a.mu.RUnlock() - newSlice := make([]any, len(a.array)) - for i, v := range a.array { - newSlice[i] = deepcopy.Copy(v) + a.lazyInit() + return &Array{ + TArray: a.TArray.DeepCopy().(*TArray[any]), } - return NewArrayFrom(newSlice, a.mu.IsSafe()) } diff --git a/container/garray/garray_normal_int.go b/container/garray/garray_normal_int.go index 87526a9f2..aa7eca72a 100644 --- a/container/garray/garray_normal_int.go +++ b/container/garray/garray_normal_int.go @@ -7,25 +7,19 @@ package garray import ( - "bytes" "fmt" - "math" "sort" + "sync" - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/errors/gerror" - "github.com/gogf/gf/v2/internal/json" - "github.com/gogf/gf/v2/internal/rwmutex" "github.com/gogf/gf/v2/util/gconv" - "github.com/gogf/gf/v2/util/grand" ) // IntArray is a golang int array with rich features. // It contains a concurrent-safe/unsafe switch, which should be set // when its initialization and cannot be changed then. type IntArray struct { - mu rwmutex.RWMutex - array []int + *TArray[int] + once sync.Once } // NewIntArray creates and returns an empty array. @@ -40,8 +34,7 @@ func NewIntArray(safe ...bool) *IntArray { // which is false in default. func NewIntArraySize(size int, cap int, safe ...bool) *IntArray { return &IntArray{ - mu: rwmutex.Create(safe...), - array: make([]int, size, cap), + TArray: NewTArraySize[int](size, cap, safe...), } } @@ -65,8 +58,7 @@ func NewIntArrayRange(start, end, step int, safe ...bool) *IntArray { // which is false in default. func NewIntArrayFrom(array []int, safe ...bool) *IntArray { return &IntArray{ - mu: rwmutex.Create(safe...), - array: array, + TArray: NewTArrayFrom(array, safe...), } } @@ -76,78 +68,66 @@ func NewIntArrayFrom(array []int, safe ...bool) *IntArray { func NewIntArrayFromCopy(array []int, safe ...bool) *IntArray { newArray := make([]int, len(array)) copy(newArray, array) - return &IntArray{ - mu: rwmutex.Create(safe...), - array: newArray, - } + return NewIntArrayFrom(newArray, safe...) +} + +// lazyInit lazily initializes the array. +func (a *IntArray) lazyInit() { + a.once.Do(func() { + if a.TArray == nil { + a.TArray = NewTArray[int](false) + } + }) } // At returns the value by the specified index. // If the given `index` is out of range of the array, it returns `0`. func (a *IntArray) At(index int) (value int) { - value, _ = a.Get(index) - return + a.lazyInit() + return a.TArray.At(index) } // Get returns the value by the specified index. // If the given `index` is out of range of the array, the `found` is false. func (a *IntArray) Get(index int) (value int, found bool) { - a.mu.RLock() - defer a.mu.RUnlock() - if index < 0 || index >= len(a.array) { - return 0, false - } - return a.array[index], true + a.lazyInit() + return a.TArray.Get(index) } // Set sets value to specified index. func (a *IntArray) Set(index int, value int) error { - a.mu.Lock() - defer a.mu.Unlock() - if index < 0 || index >= len(a.array) { - return gerror.NewCodef(gcode.CodeInvalidParameter, "index %d out of array range %d", index, len(a.array)) - } - a.array[index] = value - return nil + a.lazyInit() + return a.TArray.Set(index, value) } // SetArray sets the underlying slice array with the given `array`. func (a *IntArray) SetArray(array []int) *IntArray { - a.mu.Lock() - defer a.mu.Unlock() - a.array = array + a.lazyInit() + a.TArray.SetArray(array) return a } // Replace replaces the array items by given `array` from the beginning of array. func (a *IntArray) Replace(array []int) *IntArray { - a.mu.Lock() - defer a.mu.Unlock() - max := len(array) - if max > len(a.array) { - max = len(a.array) - } - for i := 0; i < max; i++ { - a.array[i] = array[i] - } + a.lazyInit() + a.TArray.Replace(array) return a } // Sum returns the sum of values in an array. func (a *IntArray) Sum() (sum int) { - a.mu.RLock() - defer a.mu.RUnlock() - for _, v := range a.array { - sum += v - } - return + a.lazyInit() + return a.TArray.Sum() } // Sort sorts the array in increasing order. // The parameter `reverse` controls whether sort in increasing order(default) or decreasing order. func (a *IntArray) Sort(reverse ...bool) *IntArray { + a.lazyInit() + a.mu.Lock() defer a.mu.Unlock() + if len(reverse) > 0 && reverse[0] { sort.Slice(a.array, func(i, j int) bool { return a.array[i] >= a.array[j] @@ -160,210 +140,101 @@ func (a *IntArray) Sort(reverse ...bool) *IntArray { // SortFunc sorts the array by custom function `less`. func (a *IntArray) SortFunc(less func(v1, v2 int) bool) *IntArray { - a.mu.Lock() - defer a.mu.Unlock() - sort.Slice(a.array, func(i, j int) bool { - return less(a.array[i], a.array[j]) - }) + a.lazyInit() + a.TArray.SortFunc(less) return a } // InsertBefore inserts the `values` to the front of `index`. func (a *IntArray) InsertBefore(index int, values ...int) error { - a.mu.Lock() - defer a.mu.Unlock() - if index < 0 || index >= len(a.array) { - return gerror.NewCodef( - gcode.CodeInvalidParameter, - "index %d out of array range %d", - index, len(a.array), - ) - } - rear := append([]int{}, a.array[index:]...) - a.array = append(a.array[0:index], values...) - a.array = append(a.array, rear...) - return nil + a.lazyInit() + return a.TArray.InsertBefore(index, values...) } // InsertAfter inserts the `value` to the back of `index`. func (a *IntArray) InsertAfter(index int, values ...int) error { - a.mu.Lock() - defer a.mu.Unlock() - if index < 0 || index >= len(a.array) { - return gerror.NewCodef( - gcode.CodeInvalidParameter, - "index %d out of array range %d", - index, len(a.array), - ) - } - rear := append([]int{}, a.array[index+1:]...) - a.array = append(a.array[0:index+1], values...) - a.array = append(a.array, rear...) - return nil + a.lazyInit() + return a.TArray.InsertAfter(index, values...) } // Remove removes an item by index. // If the given `index` is out of range of the array, the `found` is false. func (a *IntArray) Remove(index int) (value int, found bool) { - a.mu.Lock() - defer a.mu.Unlock() - return a.doRemoveWithoutLock(index) -} - -// doRemoveWithoutLock removes an item by index without lock. -func (a *IntArray) doRemoveWithoutLock(index int) (value int, found bool) { - if index < 0 || index >= len(a.array) { - return 0, false - } - // Determine array boundaries when deleting to improve deletion efficiency. - if index == 0 { - value := a.array[0] - a.array = a.array[1:] - return value, true - } else if index == len(a.array)-1 { - value := a.array[index] - a.array = a.array[:index] - return value, true - } - // If it is a non-boundary delete, - // it will involve the creation of an array, - // then the deletion is less efficient. - value = a.array[index] - a.array = append(a.array[:index], a.array[index+1:]...) - return value, true + a.lazyInit() + return a.TArray.Remove(index) } // RemoveValue removes an item by value. // It returns true if value is found in the array, or else false if not found. func (a *IntArray) RemoveValue(value int) bool { - a.mu.Lock() - defer a.mu.Unlock() - if i := a.doSearchWithoutLock(value); i != -1 { - a.doRemoveWithoutLock(i) - return true - } - return false + a.lazyInit() + return a.TArray.RemoveValue(value) } // RemoveValues removes multiple items by `values`. func (a *IntArray) RemoveValues(values ...int) { - a.mu.Lock() - defer a.mu.Unlock() - for _, value := range values { - if i := a.doSearchWithoutLock(value); i != -1 { - a.doRemoveWithoutLock(i) - } - } + a.lazyInit() + a.TArray.RemoveValues(values...) } // PushLeft pushes one or multiple items to the beginning of array. func (a *IntArray) PushLeft(value ...int) *IntArray { - a.mu.Lock() - a.array = append(value, a.array...) - a.mu.Unlock() + a.lazyInit() + a.TArray.PushLeft(value...) return a } // PushRight pushes one or multiple items to the end of array. // It equals to Append. func (a *IntArray) PushRight(value ...int) *IntArray { - a.mu.Lock() - a.array = append(a.array, value...) - a.mu.Unlock() + a.lazyInit() + a.TArray.PushRight(value...) return a } // PopLeft pops and returns an item from the beginning of array. // Note that if the array is empty, the `found` is false. func (a *IntArray) PopLeft() (value int, found bool) { - a.mu.Lock() - defer a.mu.Unlock() - if len(a.array) == 0 { - return 0, false - } - value = a.array[0] - a.array = a.array[1:] - return value, true + a.lazyInit() + return a.TArray.PopLeft() } // PopRight pops and returns an item from the end of array. // Note that if the array is empty, the `found` is false. func (a *IntArray) PopRight() (value int, found bool) { - a.mu.Lock() - defer a.mu.Unlock() - index := len(a.array) - 1 - if index < 0 { - return 0, false - } - value = a.array[index] - a.array = a.array[:index] - return value, true + a.lazyInit() + return a.TArray.PopRight() } // PopRand randomly pops and return an item out of array. // Note that if the array is empty, the `found` is false. func (a *IntArray) PopRand() (value int, found bool) { - a.mu.Lock() - defer a.mu.Unlock() - return a.doRemoveWithoutLock(grand.Intn(len(a.array))) + a.lazyInit() + return a.TArray.PopRand() } // PopRands randomly pops and returns `size` items out of array. // If the given `size` is greater than size of the array, it returns all elements of the array. // Note that if given `size` <= 0 or the array is empty, it returns nil. func (a *IntArray) PopRands(size int) []int { - a.mu.Lock() - defer a.mu.Unlock() - if size <= 0 || len(a.array) == 0 { - return nil - } - if size >= len(a.array) { - size = len(a.array) - } - array := make([]int, size) - for i := 0; i < size; i++ { - array[i], _ = a.doRemoveWithoutLock(grand.Intn(len(a.array))) - } - return array + a.lazyInit() + return a.TArray.PopRands(size) } // PopLefts pops and returns `size` items from the beginning of array. // If the given `size` is greater than size of the array, it returns all elements of the array. // Note that if given `size` <= 0 or the array is empty, it returns nil. func (a *IntArray) PopLefts(size int) []int { - a.mu.Lock() - defer a.mu.Unlock() - if size <= 0 || len(a.array) == 0 { - return nil - } - if size >= len(a.array) { - array := a.array - a.array = a.array[:0] - return array - } - value := a.array[0:size] - a.array = a.array[size:] - return value + a.lazyInit() + return a.TArray.PopLefts(size) } // PopRights pops and returns `size` items from the end of array. // If the given `size` is greater than size of the array, it returns all elements of the array. // Note that if given `size` <= 0 or the array is empty, it returns nil. func (a *IntArray) PopRights(size int) []int { - a.mu.Lock() - defer a.mu.Unlock() - if size <= 0 || len(a.array) == 0 { - return nil - } - index := len(a.array) - size - if index <= 0 { - array := a.array - a.array = a.array[:0] - return array - } - value := a.array[index:] - a.array = a.array[:index] - return value + a.lazyInit() + return a.TArray.PopRights(size) } // Range picks and returns items by range, like array[start:end]. @@ -374,26 +245,8 @@ func (a *IntArray) PopRights(size int) []int { // If `end` is omitted, then the sequence will have everything from start up // until the end of the array. func (a *IntArray) Range(start int, end ...int) []int { - a.mu.RLock() - defer a.mu.RUnlock() - offsetEnd := len(a.array) - if len(end) > 0 && end[0] < offsetEnd { - offsetEnd = end[0] - } - if start > offsetEnd { - return nil - } - if start < 0 { - start = 0 - } - array := ([]int)(nil) - if a.mu.IsSafe() { - array = make([]int, offsetEnd-start) - copy(array, a.array[start:offsetEnd]) - } else { - array = a.array[start:offsetEnd] - } - return array + a.lazyInit() + return a.TArray.Range(start, end...) } // SubSlice returns a slice of elements from the array as specified @@ -410,170 +263,84 @@ func (a *IntArray) Range(start int, end ...int) []int { // // Any possibility crossing the left border of array, it will fail. func (a *IntArray) SubSlice(offset int, length ...int) []int { - a.mu.RLock() - defer a.mu.RUnlock() - size := len(a.array) - if len(length) > 0 { - size = length[0] - } - if offset > len(a.array) { - return nil - } - if offset < 0 { - offset = len(a.array) + offset - if offset < 0 { - return nil - } - } - if size < 0 { - offset += size - size = -size - if offset < 0 { - return nil - } - } - end := offset + size - if end > len(a.array) { - end = len(a.array) - size = len(a.array) - offset - } - if a.mu.IsSafe() { - s := make([]int, size) - copy(s, a.array[offset:]) - return s - } else { - return a.array[offset:end] - } + a.lazyInit() + return a.TArray.SubSlice(offset, length...) } // Append is alias of PushRight,please See PushRight. func (a *IntArray) Append(value ...int) *IntArray { - a.mu.Lock() - a.array = append(a.array, value...) - a.mu.Unlock() + a.lazyInit() + a.TArray.Append(value...) return a } // Len returns the length of array. func (a *IntArray) Len() int { - a.mu.RLock() - length := len(a.array) - a.mu.RUnlock() - return length + a.lazyInit() + return a.TArray.Len() } // Slice returns the underlying data of array. // Note that, if it's in concurrent-safe usage, it returns a copy of underlying data, // or else a pointer to the underlying data. func (a *IntArray) Slice() []int { - array := ([]int)(nil) - if a.mu.IsSafe() { - a.mu.RLock() - defer a.mu.RUnlock() - array = make([]int, len(a.array)) - copy(array, a.array) - } else { - array = a.array - } - return array + a.lazyInit() + return a.TArray.Slice() } // Interfaces returns current array as []any. func (a *IntArray) Interfaces() []any { - a.mu.RLock() - defer a.mu.RUnlock() - array := make([]any, len(a.array)) - for k, v := range a.array { - array[k] = v - } - return array + a.lazyInit() + return a.TArray.Interfaces() } // Clone returns a new array, which is a copy of current array. func (a *IntArray) Clone() (newArray *IntArray) { - a.mu.RLock() - array := make([]int, len(a.array)) - copy(array, a.array) - a.mu.RUnlock() - return NewIntArrayFrom(array, a.mu.IsSafe()) + a.lazyInit() + return &IntArray{ + TArray: a.TArray.Clone(), + } } // Clear deletes all items of current array. func (a *IntArray) Clear() *IntArray { - a.mu.Lock() - if len(a.array) > 0 { - a.array = make([]int, 0) - } - a.mu.Unlock() + a.lazyInit() + a.TArray.Clear() return a } // Contains checks whether a value exists in the array. func (a *IntArray) Contains(value int) bool { - return a.Search(value) != -1 + a.lazyInit() + return a.TArray.Contains(value) } // Search searches array by `value`, returns the index of `value`, // or returns -1 if not exists. func (a *IntArray) Search(value int) int { - a.mu.RLock() - defer a.mu.RUnlock() - return a.doSearchWithoutLock(value) -} - -func (a *IntArray) doSearchWithoutLock(value int) int { - if len(a.array) == 0 { - return -1 - } - result := -1 - for index, v := range a.array { - if v == value { - result = index - break - } - } - return result + a.lazyInit() + return a.TArray.Search(value) } // Unique uniques the array, clear repeated items. // Example: [1,1,2,3,2] -> [1,2,3] func (a *IntArray) Unique() *IntArray { - a.mu.Lock() - defer a.mu.Unlock() - if len(a.array) == 0 { - return a - } - var ( - ok bool - temp int - uniqueSet = make(map[int]struct{}) - uniqueArray = make([]int, 0, len(a.array)) - ) - for i := 0; i < len(a.array); i++ { - temp = a.array[i] - if _, ok = uniqueSet[temp]; ok { - continue - } - uniqueSet[temp] = struct{}{} - uniqueArray = append(uniqueArray, temp) - } - a.array = uniqueArray + a.lazyInit() + a.TArray.Unique() return a } // LockFunc locks writing by callback function `f`. func (a *IntArray) LockFunc(f func(array []int)) *IntArray { - a.mu.Lock() - defer a.mu.Unlock() - f(a.array) + a.lazyInit() + a.TArray.LockFunc(f) return a } // RLockFunc locks reading by callback function `f`. func (a *IntArray) RLockFunc(f func(array []int)) *IntArray { - a.mu.RLock() - defer a.mu.RUnlock() - f(a.array) + a.lazyInit() + a.TArray.RLockFunc(f) return a } @@ -588,46 +355,16 @@ func (a *IntArray) Merge(array any) *IntArray { // Fill fills an array with num entries of the value `value`, // keys starting at the `startIndex` parameter. func (a *IntArray) Fill(startIndex int, num int, value int) error { - a.mu.Lock() - defer a.mu.Unlock() - if startIndex < 0 || startIndex > len(a.array) { - return gerror.NewCodef( - gcode.CodeInvalidParameter, - "index %d out of array range %d", - startIndex, len(a.array), - ) - } - for i := startIndex; i < startIndex+num; i++ { - if i > len(a.array)-1 { - a.array = append(a.array, value) - } else { - a.array[i] = value - } - } - return nil + a.lazyInit() + return a.TArray.Fill(startIndex, num, value) } // Chunk splits an array into multiple arrays, // the size of each array is determined by `size`. // The last chunk may contain less than size elements. func (a *IntArray) Chunk(size int) [][]int { - if size < 1 { - return nil - } - a.mu.RLock() - defer a.mu.RUnlock() - length := len(a.array) - chunks := int(math.Ceil(float64(length) / float64(size))) - var n [][]int - for i, end := 0, 0; chunks > 0; chunks-- { - end = (i + 1) * size - if end > length { - end = length - } - n = append(n, a.array[i*size:end]) - i++ - } - return n + a.lazyInit() + return a.TArray.Chunk(size) } // Pad pads array to the specified length with `value`. @@ -635,98 +372,47 @@ func (a *IntArray) Chunk(size int) [][]int { // If the absolute value of `size` is less than or equal to the length of the array // then no padding takes place. func (a *IntArray) Pad(size int, value int) *IntArray { - a.mu.Lock() - defer a.mu.Unlock() - if size == 0 || (size > 0 && size < len(a.array)) || (size < 0 && size > -len(a.array)) { - return a - } - n := size - if size < 0 { - n = -size - } - n -= len(a.array) - tmp := make([]int, n) - for i := 0; i < n; i++ { - tmp[i] = value - } - if size > 0 { - a.array = append(a.array, tmp...) - } else { - a.array = append(tmp, a.array...) - } + a.lazyInit() + a.TArray.Pad(size, value) return a } // Rand randomly returns one item from array(no deleting). func (a *IntArray) Rand() (value int, found bool) { - a.mu.RLock() - defer a.mu.RUnlock() - if len(a.array) == 0 { - return 0, false - } - return a.array[grand.Intn(len(a.array))], true + a.lazyInit() + return a.TArray.Rand() } // Rands randomly returns `size` items from array(no deleting). func (a *IntArray) Rands(size int) []int { - a.mu.RLock() - defer a.mu.RUnlock() - if size <= 0 || len(a.array) == 0 { - return nil - } - array := make([]int, size) - for i := 0; i < size; i++ { - array[i] = a.array[grand.Intn(len(a.array))] - } - return array + a.lazyInit() + return a.TArray.Rands(size) } // Shuffle randomly shuffles the array. func (a *IntArray) Shuffle() *IntArray { - a.mu.Lock() - defer a.mu.Unlock() - for i, v := range grand.Perm(len(a.array)) { - a.array[i], a.array[v] = a.array[v], a.array[i] - } + a.lazyInit() + a.TArray.Shuffle() return a } // Reverse makes array with elements in reverse order. func (a *IntArray) Reverse() *IntArray { - a.mu.Lock() - defer a.mu.Unlock() - for i, j := 0, len(a.array)-1; i < j; i, j = i+1, j-1 { - a.array[i], a.array[j] = a.array[j], a.array[i] - } + a.lazyInit() + a.TArray.Reverse() return a } // Join joins array elements with a string `glue`. func (a *IntArray) Join(glue string) string { - a.mu.RLock() - defer a.mu.RUnlock() - if len(a.array) == 0 { - return "" - } - buffer := bytes.NewBuffer(nil) - for k, v := range a.array { - buffer.WriteString(gconv.String(v)) - if k != len(a.array)-1 { - buffer.WriteString(glue) - } - } - return buffer.String() + a.lazyInit() + return a.TArray.Join(glue) } // CountValues counts the number of occurrences of all values in the array. func (a *IntArray) CountValues() map[int]int { - m := make(map[int]int) - a.mu.RLock() - defer a.mu.RUnlock() - for _, v := range a.array { - m[v]++ - } - return m + a.lazyInit() + return a.TArray.CountValues() } // Iterator is alias of IteratorAsc. @@ -737,25 +423,15 @@ func (a *IntArray) Iterator(f func(k int, v int) bool) { // IteratorAsc iterates the array readonly in ascending order with given callback function `f`. // If `f` returns true, then it continues iterating; or false to stop. func (a *IntArray) IteratorAsc(f func(k int, v int) bool) { - a.mu.RLock() - defer a.mu.RUnlock() - for k, v := range a.array { - if !f(k, v) { - break - } - } + a.lazyInit() + a.TArray.IteratorAsc(f) } // IteratorDesc iterates the array readonly in descending order with given callback function `f`. // If `f` returns true, then it continues iterating; or false to stop. func (a *IntArray) IteratorDesc(f func(k int, v int) bool) { - a.mu.RLock() - defer a.mu.RUnlock() - for i := len(a.array) - 1; i >= 0; i-- { - if !f(i, a.array[i]) { - break - } - } + a.lazyInit() + a.TArray.IteratorDesc(f) } // String returns current array as a string, which implements like json.Marshal does. @@ -769,80 +445,49 @@ func (a *IntArray) String() string { // MarshalJSON implements the interface MarshalJSON for json.Marshal. // Note that do not use pointer as its receiver here. func (a IntArray) MarshalJSON() ([]byte, error) { - a.mu.RLock() - defer a.mu.RUnlock() - return json.Marshal(a.array) + a.lazyInit() + return a.TArray.MarshalJSON() } // UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal. func (a *IntArray) UnmarshalJSON(b []byte) error { - if a.array == nil { - a.array = make([]int, 0) - } - a.mu.Lock() - defer a.mu.Unlock() - if err := json.UnmarshalUseNumber(b, &a.array); err != nil { - return err - } - return nil + a.lazyInit() + return a.TArray.UnmarshalJSON(b) } // UnmarshalValue is an interface implement which sets any type of value for array. func (a *IntArray) UnmarshalValue(value any) error { - a.mu.Lock() - defer a.mu.Unlock() - switch value.(type) { - case string, []byte: - return json.UnmarshalUseNumber(gconv.Bytes(value), &a.array) - default: - a.array = gconv.SliceInt(value) - } - return nil + a.lazyInit() + return a.TArray.UnmarshalValue(value) } // Filter iterates array and filters elements using custom callback function. // It removes the element from array if callback function `filter` returns true, // it or else does nothing and continues iterating. func (a *IntArray) Filter(filter func(index int, value int) bool) *IntArray { - a.mu.Lock() - defer a.mu.Unlock() - for i := 0; i < len(a.array); { - if filter(i, a.array[i]) { - a.array = append(a.array[:i], a.array[i+1:]...) - } else { - i++ - } - } + a.lazyInit() + a.TArray.Filter(filter) return a } // FilterEmpty removes all zero value of the array. func (a *IntArray) FilterEmpty() *IntArray { - a.mu.Lock() - defer a.mu.Unlock() - for i := 0; i < len(a.array); { - if a.array[i] == 0 { - a.array = append(a.array[:i], a.array[i+1:]...) - } else { - i++ - } - } + a.lazyInit() + a.TArray.FilterEmpty() return a } // Walk applies a user supplied function `f` to every item of array. func (a *IntArray) Walk(f func(value int) int) *IntArray { - a.mu.Lock() - defer a.mu.Unlock() - for i, v := range a.array { - a.array[i] = f(v) - } + a.lazyInit() + a.TArray.Walk(f) return a } // IsEmpty checks whether the array is empty. func (a *IntArray) IsEmpty() bool { - return a.Len() == 0 + a.lazyInit() + return a.TArray.IsEmpty() } // DeepCopy implements interface for deep copy of current type. @@ -850,9 +495,8 @@ func (a *IntArray) DeepCopy() any { if a == nil { return nil } - a.mu.RLock() - defer a.mu.RUnlock() - newSlice := make([]int, len(a.array)) - copy(newSlice, a.array) - return NewIntArrayFrom(newSlice, a.mu.IsSafe()) + a.lazyInit() + return &IntArray{ + TArray: a.TArray.DeepCopy().(*TArray[int]), + } } diff --git a/container/garray/garray_normal_str.go b/container/garray/garray_normal_str.go index 06b61c3a3..cb5440326 100644 --- a/container/garray/garray_normal_str.go +++ b/container/garray/garray_normal_str.go @@ -8,25 +8,20 @@ package garray import ( "bytes" - "math" "sort" "strings" + "sync" - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/errors/gerror" - "github.com/gogf/gf/v2/internal/json" - "github.com/gogf/gf/v2/internal/rwmutex" "github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/util/gconv" - "github.com/gogf/gf/v2/util/grand" ) // StrArray is a golang string array with rich features. // It contains a concurrent-safe/unsafe switch, which should be set // when its initialization and cannot be changed then. type StrArray struct { - mu rwmutex.RWMutex - array []string + *TArray[string] + once sync.Once } // NewStrArray creates and returns an empty array. @@ -41,8 +36,7 @@ func NewStrArray(safe ...bool) *StrArray { // which is false in default. func NewStrArraySize(size int, cap int, safe ...bool) *StrArray { return &StrArray{ - mu: rwmutex.Create(safe...), - array: make([]string, size, cap), + TArray: NewTArraySize[string](size, cap, safe...), } } @@ -51,8 +45,7 @@ func NewStrArraySize(size int, cap int, safe ...bool) *StrArray { // which is false in default. func NewStrArrayFrom(array []string, safe ...bool) *StrArray { return &StrArray{ - mu: rwmutex.Create(safe...), - array: array, + TArray: NewTArrayFrom(array, safe...), } } @@ -62,77 +55,64 @@ func NewStrArrayFrom(array []string, safe ...bool) *StrArray { func NewStrArrayFromCopy(array []string, safe ...bool) *StrArray { newArray := make([]string, len(array)) copy(newArray, array) - return &StrArray{ - mu: rwmutex.Create(safe...), - array: newArray, - } + return NewStrArrayFrom(newArray, safe...) +} + +// lazyInit lazily initializes the array. +func (a *StrArray) lazyInit() { + a.once.Do(func() { + if a.TArray == nil { + a.TArray = NewTArray[string](false) + } + }) } // At returns the value by the specified index. // If the given `index` is out of range of the array, it returns an empty string. func (a *StrArray) At(index int) (value string) { - value, _ = a.Get(index) - return + a.lazyInit() + return a.TArray.At(index) } // Get returns the value by the specified index. // If the given `index` is out of range of the array, the `found` is false. func (a *StrArray) Get(index int) (value string, found bool) { - a.mu.RLock() - defer a.mu.RUnlock() - if index < 0 || index >= len(a.array) { - return "", false - } - return a.array[index], true + a.lazyInit() + return a.TArray.Get(index) } // Set sets value to specified index. func (a *StrArray) Set(index int, value string) error { - a.mu.Lock() - defer a.mu.Unlock() - if index < 0 || index >= len(a.array) { - return gerror.NewCodef(gcode.CodeInvalidParameter, "index %d out of array range %d", index, len(a.array)) - } - a.array[index] = value - return nil + a.lazyInit() + return a.TArray.Set(index, value) } // SetArray sets the underlying slice array with the given `array`. func (a *StrArray) SetArray(array []string) *StrArray { - a.mu.Lock() - defer a.mu.Unlock() - a.array = array + a.lazyInit() + a.TArray.SetArray(array) return a } // Replace replaces the array items by given `array` from the beginning of array. func (a *StrArray) Replace(array []string) *StrArray { - a.mu.Lock() - defer a.mu.Unlock() - max := len(array) - if max > len(a.array) { - max = len(a.array) - } - for i := 0; i < max; i++ { - a.array[i] = array[i] - } + a.lazyInit() + a.TArray.Replace(array) return a } // Sum returns the sum of values in an array. func (a *StrArray) Sum() (sum int) { - a.mu.RLock() - defer a.mu.RUnlock() - for _, v := range a.array { - sum += gconv.Int(v) - } - return + a.lazyInit() + return a.TArray.Sum() } // Sort sorts the array in increasing order. // The parameter `reverse` controls whether sort // in increasing order(default) or decreasing order func (a *StrArray) Sort(reverse ...bool) *StrArray { + a.lazyInit() + a.mu.Lock() defer a.mu.Unlock() if len(reverse) > 0 && reverse[0] { @@ -147,200 +127,101 @@ func (a *StrArray) Sort(reverse ...bool) *StrArray { // SortFunc sorts the array by custom function `less`. func (a *StrArray) SortFunc(less func(v1, v2 string) bool) *StrArray { - a.mu.Lock() - defer a.mu.Unlock() - sort.Slice(a.array, func(i, j int) bool { - return less(a.array[i], a.array[j]) - }) + a.lazyInit() + a.TArray.SortFunc(less) return a } // InsertBefore inserts the `values` to the front of `index`. func (a *StrArray) InsertBefore(index int, values ...string) error { - a.mu.Lock() - defer a.mu.Unlock() - if index < 0 || index >= len(a.array) { - return gerror.NewCodef(gcode.CodeInvalidParameter, "index %d out of array range %d", index, len(a.array)) - } - rear := append([]string{}, a.array[index:]...) - a.array = append(a.array[0:index], values...) - a.array = append(a.array, rear...) - return nil + a.lazyInit() + return a.TArray.InsertBefore(index, values...) } // InsertAfter inserts the `values` to the back of `index`. func (a *StrArray) InsertAfter(index int, values ...string) error { - a.mu.Lock() - defer a.mu.Unlock() - if index < 0 || index >= len(a.array) { - return gerror.NewCodef(gcode.CodeInvalidParameter, "index %d out of array range %d", index, len(a.array)) - } - rear := append([]string{}, a.array[index+1:]...) - a.array = append(a.array[0:index+1], values...) - a.array = append(a.array, rear...) - return nil + a.lazyInit() + return a.TArray.InsertAfter(index, values...) } // Remove removes an item by index. // If the given `index` is out of range of the array, the `found` is false. func (a *StrArray) Remove(index int) (value string, found bool) { - a.mu.Lock() - defer a.mu.Unlock() - return a.doRemoveWithoutLock(index) -} - -// doRemoveWithoutLock removes an item by index without lock. -func (a *StrArray) doRemoveWithoutLock(index int) (value string, found bool) { - if index < 0 || index >= len(a.array) { - return "", false - } - // Determine array boundaries when deleting to improve deletion efficiency. - if index == 0 { - value := a.array[0] - a.array = a.array[1:] - return value, true - } else if index == len(a.array)-1 { - value := a.array[index] - a.array = a.array[:index] - return value, true - } - // If it is a non-boundary delete, - // it will involve the creation of an array, - // then the deletion is less efficient. - value = a.array[index] - a.array = append(a.array[:index], a.array[index+1:]...) - return value, true + a.lazyInit() + return a.TArray.Remove(index) } // RemoveValue removes an item by value. // It returns true if value is found in the array, or else false if not found. func (a *StrArray) RemoveValue(value string) bool { - if i := a.Search(value); i != -1 { - _, found := a.Remove(i) - return found - } - return false + a.lazyInit() + return a.TArray.RemoveValue(value) } // RemoveValues removes multiple items by `values`. func (a *StrArray) RemoveValues(values ...string) { - a.mu.Lock() - defer a.mu.Unlock() - for _, value := range values { - if i := a.doSearchWithoutLock(value); i != -1 { - a.doRemoveWithoutLock(i) - } - } + a.lazyInit() + a.TArray.RemoveValues(values...) } // PushLeft pushes one or multiple items to the beginning of array. func (a *StrArray) PushLeft(value ...string) *StrArray { - a.mu.Lock() - a.array = append(value, a.array...) - a.mu.Unlock() + a.lazyInit() + a.TArray.PushLeft(value...) return a } // PushRight pushes one or multiple items to the end of array. // It equals to Append. func (a *StrArray) PushRight(value ...string) *StrArray { - a.mu.Lock() - a.array = append(a.array, value...) - a.mu.Unlock() + a.lazyInit() + a.TArray.PushRight(value...) return a } // PopLeft pops and returns an item from the beginning of array. // Note that if the array is empty, the `found` is false. func (a *StrArray) PopLeft() (value string, found bool) { - a.mu.Lock() - defer a.mu.Unlock() - if len(a.array) == 0 { - return "", false - } - value = a.array[0] - a.array = a.array[1:] - return value, true + a.lazyInit() + return a.TArray.PopLeft() } // PopRight pops and returns an item from the end of array. // Note that if the array is empty, the `found` is false. func (a *StrArray) PopRight() (value string, found bool) { - a.mu.Lock() - defer a.mu.Unlock() - index := len(a.array) - 1 - if index < 0 { - return "", false - } - value = a.array[index] - a.array = a.array[:index] - return value, true + a.lazyInit() + return a.TArray.PopRight() } // PopRand randomly pops and return an item out of array. // Note that if the array is empty, the `found` is false. func (a *StrArray) PopRand() (value string, found bool) { - a.mu.Lock() - defer a.mu.Unlock() - return a.doRemoveWithoutLock(grand.Intn(len(a.array))) + a.lazyInit() + return a.TArray.PopRand() } // PopRands randomly pops and returns `size` items out of array. // If the given `size` is greater than size of the array, it returns all elements of the array. // Note that if given `size` <= 0 or the array is empty, it returns nil. func (a *StrArray) PopRands(size int) []string { - a.mu.Lock() - defer a.mu.Unlock() - if size <= 0 || len(a.array) == 0 { - return nil - } - if size >= len(a.array) { - size = len(a.array) - } - array := make([]string, size) - for i := 0; i < size; i++ { - array[i], _ = a.doRemoveWithoutLock(grand.Intn(len(a.array))) - } - return array + a.lazyInit() + return a.TArray.PopRands(size) } // PopLefts pops and returns `size` items from the beginning of array. // If the given `size` is greater than size of the array, it returns all elements of the array. // Note that if given `size` <= 0 or the array is empty, it returns nil. func (a *StrArray) PopLefts(size int) []string { - a.mu.Lock() - defer a.mu.Unlock() - if size <= 0 || len(a.array) == 0 { - return nil - } - if size >= len(a.array) { - array := a.array - a.array = a.array[:0] - return array - } - value := a.array[0:size] - a.array = a.array[size:] - return value + a.lazyInit() + return a.TArray.PopLefts(size) } // PopRights pops and returns `size` items from the end of array. // If the given `size` is greater than size of the array, it returns all elements of the array. // Note that if given `size` <= 0 or the array is empty, it returns nil. func (a *StrArray) PopRights(size int) []string { - a.mu.Lock() - defer a.mu.Unlock() - if size <= 0 || len(a.array) == 0 { - return nil - } - index := len(a.array) - size - if index <= 0 { - array := a.array - a.array = a.array[:0] - return array - } - value := a.array[index:] - a.array = a.array[:index] - return value + a.lazyInit() + return a.TArray.PopRights(size) } // Range picks and returns items by range, like array[start:end]. @@ -351,26 +232,8 @@ func (a *StrArray) PopRights(size int) []string { // If `end` is omitted, then the sequence will have everything from start up // until the end of the array. func (a *StrArray) Range(start int, end ...int) []string { - a.mu.RLock() - defer a.mu.RUnlock() - offsetEnd := len(a.array) - if len(end) > 0 && end[0] < offsetEnd { - offsetEnd = end[0] - } - if start > offsetEnd { - return nil - } - if start < 0 { - start = 0 - } - array := ([]string)(nil) - if a.mu.IsSafe() { - array = make([]string, offsetEnd-start) - copy(array, a.array[start:offsetEnd]) - } else { - array = a.array[start:offsetEnd] - } - return array + a.lazyInit() + return a.TArray.Range(start, end...) } // SubSlice returns a slice of elements from the array as specified @@ -387,111 +250,63 @@ func (a *StrArray) Range(start int, end ...int) []string { // // Any possibility crossing the left border of array, it will fail. func (a *StrArray) SubSlice(offset int, length ...int) []string { - a.mu.RLock() - defer a.mu.RUnlock() - size := len(a.array) - if len(length) > 0 { - size = length[0] - } - if offset > len(a.array) { - return nil - } - if offset < 0 { - offset = len(a.array) + offset - if offset < 0 { - return nil - } - } - if size < 0 { - offset += size - size = -size - if offset < 0 { - return nil - } - } - end := offset + size - if end > len(a.array) { - end = len(a.array) - size = len(a.array) - offset - } - if a.mu.IsSafe() { - s := make([]string, size) - copy(s, a.array[offset:]) - return s - } - return a.array[offset:end] + a.lazyInit() + return a.TArray.SubSlice(offset, length...) } // Append is alias of PushRight,please See PushRight. func (a *StrArray) Append(value ...string) *StrArray { - a.mu.Lock() - a.array = append(a.array, value...) - a.mu.Unlock() + a.lazyInit() + a.TArray.Append(value...) return a } // Len returns the length of array. func (a *StrArray) Len() int { - a.mu.RLock() - length := len(a.array) - a.mu.RUnlock() - return length + a.lazyInit() + return a.TArray.Len() } // Slice returns the underlying data of array. // Note that, if it's in concurrent-safe usage, it returns a copy of underlying data, // or else a pointer to the underlying data. func (a *StrArray) Slice() []string { - array := ([]string)(nil) - if a.mu.IsSafe() { - a.mu.RLock() - defer a.mu.RUnlock() - array = make([]string, len(a.array)) - copy(array, a.array) - } else { - array = a.array - } - return array + a.lazyInit() + return a.TArray.Slice() } // Interfaces returns current array as []any. func (a *StrArray) Interfaces() []any { - a.mu.RLock() - defer a.mu.RUnlock() - array := make([]any, len(a.array)) - for k, v := range a.array { - array[k] = v - } - return array + a.lazyInit() + return a.TArray.Interfaces() } // Clone returns a new array, which is a copy of current array. func (a *StrArray) Clone() (newArray *StrArray) { - a.mu.RLock() - array := make([]string, len(a.array)) - copy(array, a.array) - a.mu.RUnlock() - return NewStrArrayFrom(array, a.mu.IsSafe()) + a.lazyInit() + return &StrArray{ + TArray: a.TArray.Clone(), + } } // Clear deletes all items of current array. func (a *StrArray) Clear() *StrArray { - a.mu.Lock() - if len(a.array) > 0 { - a.array = make([]string, 0) - } - a.mu.Unlock() + a.lazyInit() + a.TArray.Clear() return a } // Contains checks whether a value exists in the array. func (a *StrArray) Contains(value string) bool { - return a.Search(value) != -1 + a.lazyInit() + return a.TArray.Contains(value) } // ContainsI checks whether a value exists in the array with case-insensitively. // Note that it internally iterates the whole array to do the comparison with case-insensitively. func (a *StrArray) ContainsI(value string) bool { + a.lazyInit() + a.mu.RLock() defer a.mu.RUnlock() if len(a.array) == 0 { @@ -508,64 +323,29 @@ func (a *StrArray) ContainsI(value string) bool { // Search searches array by `value`, returns the index of `value`, // or returns -1 if not exists. func (a *StrArray) Search(value string) int { - a.mu.RLock() - defer a.mu.RUnlock() - return a.doSearchWithoutLock(value) -} - -func (a *StrArray) doSearchWithoutLock(value string) int { - if len(a.array) == 0 { - return -1 - } - result := -1 - for index, v := range a.array { - if strings.Compare(v, value) == 0 { - result = index - break - } - } - return result + a.lazyInit() + return a.TArray.Search(value) } // Unique uniques the array, clear repeated items. // Example: [1,1,2,3,2] -> [1,2,3] func (a *StrArray) Unique() *StrArray { - a.mu.Lock() - defer a.mu.Unlock() - if len(a.array) == 0 { - return a - } - var ( - ok bool - temp string - uniqueSet = make(map[string]struct{}) - uniqueArray = make([]string, 0, len(a.array)) - ) - for i := 0; i < len(a.array); i++ { - temp = a.array[i] - if _, ok = uniqueSet[temp]; ok { - continue - } - uniqueSet[temp] = struct{}{} - uniqueArray = append(uniqueArray, temp) - } - a.array = uniqueArray + a.lazyInit() + a.TArray.Unique() return a } // LockFunc locks writing by callback function `f`. func (a *StrArray) LockFunc(f func(array []string)) *StrArray { - a.mu.Lock() - defer a.mu.Unlock() - f(a.array) + a.lazyInit() + a.TArray.LockFunc(f) return a } // RLockFunc locks reading by callback function `f`. func (a *StrArray) RLockFunc(f func(array []string)) *StrArray { - a.mu.RLock() - defer a.mu.RUnlock() - f(a.array) + a.lazyInit() + a.TArray.RLockFunc(f) return a } @@ -580,42 +360,16 @@ func (a *StrArray) Merge(array any) *StrArray { // Fill fills an array with num entries of the value `value`, // keys starting at the `startIndex` parameter. func (a *StrArray) Fill(startIndex int, num int, value string) error { - a.mu.Lock() - defer a.mu.Unlock() - if startIndex < 0 || startIndex > len(a.array) { - return gerror.NewCodef(gcode.CodeInvalidParameter, "index %d out of array range %d", startIndex, len(a.array)) - } - for i := startIndex; i < startIndex+num; i++ { - if i > len(a.array)-1 { - a.array = append(a.array, value) - } else { - a.array[i] = value - } - } - return nil + a.lazyInit() + return a.TArray.Fill(startIndex, num, value) } // Chunk splits an array into multiple arrays, // the size of each array is determined by `size`. // The last chunk may contain less than size elements. func (a *StrArray) Chunk(size int) [][]string { - if size < 1 { - return nil - } - a.mu.RLock() - defer a.mu.RUnlock() - length := len(a.array) - chunks := int(math.Ceil(float64(length) / float64(size))) - var n [][]string - for i, end := 0, 0; chunks > 0; chunks-- { - end = (i + 1) * size - if end > length { - end = length - } - n = append(n, a.array[i*size:end]) - i++ - } - return n + a.lazyInit() + return a.TArray.Chunk(size) } // Pad pads array to the specified length with `value`. @@ -623,98 +377,47 @@ func (a *StrArray) Chunk(size int) [][]string { // If the absolute value of `size` is less than or equal to the length of the array // then no padding takes place. func (a *StrArray) Pad(size int, value string) *StrArray { - a.mu.Lock() - defer a.mu.Unlock() - if size == 0 || (size > 0 && size < len(a.array)) || (size < 0 && size > -len(a.array)) { - return a - } - n := size - if size < 0 { - n = -size - } - n -= len(a.array) - tmp := make([]string, n) - for i := 0; i < n; i++ { - tmp[i] = value - } - if size > 0 { - a.array = append(a.array, tmp...) - } else { - a.array = append(tmp, a.array...) - } + a.lazyInit() + a.TArray.Pad(size, value) return a } // Rand randomly returns one item from array(no deleting). func (a *StrArray) Rand() (value string, found bool) { - a.mu.RLock() - defer a.mu.RUnlock() - if len(a.array) == 0 { - return "", false - } - return a.array[grand.Intn(len(a.array))], true + a.lazyInit() + return a.TArray.Rand() } // Rands randomly returns `size` items from array(no deleting). func (a *StrArray) Rands(size int) []string { - a.mu.RLock() - defer a.mu.RUnlock() - if size <= 0 || len(a.array) == 0 { - return nil - } - array := make([]string, size) - for i := 0; i < size; i++ { - array[i] = a.array[grand.Intn(len(a.array))] - } - return array + a.lazyInit() + return a.TArray.Rands(size) } // Shuffle randomly shuffles the array. func (a *StrArray) Shuffle() *StrArray { - a.mu.Lock() - defer a.mu.Unlock() - for i, v := range grand.Perm(len(a.array)) { - a.array[i], a.array[v] = a.array[v], a.array[i] - } + a.lazyInit() + a.TArray.Shuffle() return a } // Reverse makes array with elements in reverse order. func (a *StrArray) Reverse() *StrArray { - a.mu.Lock() - defer a.mu.Unlock() - for i, j := 0, len(a.array)-1; i < j; i, j = i+1, j-1 { - a.array[i], a.array[j] = a.array[j], a.array[i] - } + a.lazyInit() + a.TArray.Reverse() return a } // Join joins array elements with a string `glue`. func (a *StrArray) Join(glue string) string { - a.mu.RLock() - defer a.mu.RUnlock() - if len(a.array) == 0 { - return "" - } - buffer := bytes.NewBuffer(nil) - for k, v := range a.array { - buffer.WriteString(v) - if k != len(a.array)-1 { - buffer.WriteString(glue) - } - } - return buffer.String() + a.lazyInit() + return a.TArray.Join(glue) } // CountValues counts the number of occurrences of all values in the array. func (a *StrArray) CountValues() map[string]int { - m := make(map[string]int) - a.mu.RLock() - defer a.mu.RUnlock() - for _, v := range a.array { - m[v]++ - } - return m + a.lazyInit() + return a.TArray.CountValues() } // Iterator is alias of IteratorAsc. @@ -725,25 +428,15 @@ func (a *StrArray) Iterator(f func(k int, v string) bool) { // IteratorAsc iterates the array readonly in ascending order with given callback function `f`. // If `f` returns true, then it continues iterating; or false to stop. func (a *StrArray) IteratorAsc(f func(k int, v string) bool) { - a.mu.RLock() - defer a.mu.RUnlock() - for k, v := range a.array { - if !f(k, v) { - break - } - } + a.lazyInit() + a.TArray.IteratorAsc(f) } // IteratorDesc iterates the array readonly in descending order with given callback function `f`. // If `f` returns true, then it continues iterating; or false to stop. func (a *StrArray) IteratorDesc(f func(k int, v string) bool) { - a.mu.RLock() - defer a.mu.RUnlock() - for i := len(a.array) - 1; i >= 0; i-- { - if !f(i, a.array[i]) { - break - } - } + a.lazyInit() + a.TArray.IteratorDesc(f) } // String returns current array as a string, which implements like json.Marshal does. @@ -751,6 +444,9 @@ func (a *StrArray) String() string { if a == nil { return "" } + + a.lazyInit() + a.mu.RLock() defer a.mu.RUnlock() buffer := bytes.NewBuffer(nil) @@ -768,80 +464,49 @@ func (a *StrArray) String() string { // MarshalJSON implements the interface MarshalJSON for json.Marshal. // Note that do not use pointer as its receiver here. func (a StrArray) MarshalJSON() ([]byte, error) { - a.mu.RLock() - defer a.mu.RUnlock() - return json.Marshal(a.array) + a.lazyInit() + return a.TArray.MarshalJSON() } // UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal. func (a *StrArray) UnmarshalJSON(b []byte) error { - if a.array == nil { - a.array = make([]string, 0) - } - a.mu.Lock() - defer a.mu.Unlock() - if err := json.UnmarshalUseNumber(b, &a.array); err != nil { - return err - } - return nil + a.lazyInit() + return a.TArray.UnmarshalJSON(b) } // UnmarshalValue is an interface implement which sets any type of value for array. func (a *StrArray) UnmarshalValue(value any) error { - a.mu.Lock() - defer a.mu.Unlock() - switch value.(type) { - case string, []byte: - return json.UnmarshalUseNumber(gconv.Bytes(value), &a.array) - default: - a.array = gconv.SliceStr(value) - } - return nil + a.lazyInit() + return a.TArray.UnmarshalValue(value) } // Filter iterates array and filters elements using custom callback function. // It removes the element from array if callback function `filter` returns true, // it or else does nothing and continues iterating. func (a *StrArray) Filter(filter func(index int, value string) bool) *StrArray { - a.mu.Lock() - defer a.mu.Unlock() - for i := 0; i < len(a.array); { - if filter(i, a.array[i]) { - a.array = append(a.array[:i], a.array[i+1:]...) - } else { - i++ - } - } + a.lazyInit() + a.TArray.Filter(filter) return a } // FilterEmpty removes all empty string value of the array. func (a *StrArray) FilterEmpty() *StrArray { - a.mu.Lock() - defer a.mu.Unlock() - for i := 0; i < len(a.array); { - if a.array[i] == "" { - a.array = append(a.array[:i], a.array[i+1:]...) - } else { - i++ - } - } + a.lazyInit() + a.TArray.FilterEmpty() return a } // Walk applies a user supplied function `f` to every item of array. func (a *StrArray) Walk(f func(value string) string) *StrArray { - a.mu.Lock() - defer a.mu.Unlock() - for i, v := range a.array { - a.array[i] = f(v) - } + a.lazyInit() + a.TArray.Walk(f) return a } // IsEmpty checks whether the array is empty. func (a *StrArray) IsEmpty() bool { - return a.Len() == 0 + a.lazyInit() + return a.TArray.IsEmpty() } // DeepCopy implements interface for deep copy of current type. @@ -849,9 +514,8 @@ func (a *StrArray) DeepCopy() any { if a == nil { return nil } - a.mu.RLock() - defer a.mu.RUnlock() - newSlice := make([]string, len(a.array)) - copy(newSlice, a.array) - return NewStrArrayFrom(newSlice, a.mu.IsSafe()) + a.lazyInit() + return &StrArray{ + TArray: a.TArray.DeepCopy().(*TArray[string]), + } } diff --git a/container/garray/garray_normal_t.go b/container/garray/garray_normal_t.go new file mode 100644 index 000000000..fa0ce0540 --- /dev/null +++ b/container/garray/garray_normal_t.go @@ -0,0 +1,859 @@ +// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://github.com/gogf/gf. + +package garray + +import ( + "bytes" + "math" + "sort" + + "github.com/gogf/gf/v2/errors/gcode" + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/internal/deepcopy" + "github.com/gogf/gf/v2/internal/empty" + "github.com/gogf/gf/v2/internal/json" + "github.com/gogf/gf/v2/internal/rwmutex" + "github.com/gogf/gf/v2/text/gstr" + "github.com/gogf/gf/v2/util/gconv" + "github.com/gogf/gf/v2/util/grand" +) + +// TArray is a golang array with rich features. +// It contains a concurrent-safe/unsafe switch, which should be set +// when its initialization and cannot be changed then. +type TArray[T comparable] struct { + mu rwmutex.RWMutex + array []T +} + +// NewTArray creates and returns an empty array. +// The parameter `safe` is used to specify whether using array in concurrent-safety, +// which is false in default. +func NewTArray[T comparable](safe ...bool) *TArray[T] { + return NewTArraySize[T](0, 0, safe...) +} + +// NewTArraySize create and returns an array with given size and cap. +// The parameter `safe` is used to specify whether using array in concurrent-safety, +// which is false in default. +func NewTArraySize[T comparable](size int, cap int, safe ...bool) *TArray[T] { + return &TArray[T]{ + mu: rwmutex.Create(safe...), + array: make([]T, size, cap), + } +} + +// NewTArrayFrom creates and returns an array with given slice `array`. +// The parameter `safe` is used to specify whether using array in concurrent-safety, +// which is false in default. +func NewTArrayFrom[T comparable](array []T, safe ...bool) *TArray[T] { + return &TArray[T]{ + mu: rwmutex.Create(safe...), + array: array, + } +} + +// NewTArrayFromCopy creates and returns an array from a copy of given slice `array`. +// The parameter `safe` is used to specify whether using array in concurrent-safety, +// which is false in default. +func NewTArrayFromCopy[T comparable](array []T, safe ...bool) *TArray[T] { + newArray := make([]T, len(array)) + copy(newArray, array) + return &TArray[T]{ + mu: rwmutex.Create(safe...), + array: newArray, + } +} + +// At returns the value by the specified index. +// If the given `index` is out of range of the array, it returns `nil`. +func (a *TArray[T]) At(index int) (value T) { + value, _ = a.Get(index) + return +} + +// Get returns the value by the specified index. +// If the given `index` is out of range of the array, the `found` is false. +func (a *TArray[T]) Get(index int) (value T, found bool) { + a.mu.RLock() + defer a.mu.RUnlock() + if index < 0 || index >= len(a.array) { + found = false + return + } + return a.array[index], true +} + +// Set sets value to specified index. +func (a *TArray[T]) Set(index int, value T) error { + a.mu.Lock() + defer a.mu.Unlock() + if index < 0 || index >= len(a.array) { + return gerror.NewCodef(gcode.CodeInvalidParameter, "index %d out of array range %d", index, len(a.array)) + } + a.array[index] = value + return nil +} + +// SetArray sets the underlying slice array with the given `array`. +func (a *TArray[T]) SetArray(array []T) *TArray[T] { + a.mu.Lock() + defer a.mu.Unlock() + a.array = array + return a +} + +// Replace replaces the array items by given `array` from the beginning of array. +func (a *TArray[T]) Replace(array []T) *TArray[T] { + a.mu.Lock() + defer a.mu.Unlock() + max := len(array) + if max > len(a.array) { + max = len(a.array) + } + for i := 0; i < max; i++ { + a.array[i] = array[i] + } + return a +} + +// Sum returns the sum of values in an array. +func (a *TArray[T]) Sum() (sum int) { + a.mu.RLock() + defer a.mu.RUnlock() + for _, v := range a.array { + sum += gconv.Int(v) + } + return +} + +// SortFunc sorts the array by custom function `less`. +func (a *TArray[T]) SortFunc(less func(v1, v2 T) bool) *TArray[T] { + a.mu.Lock() + defer a.mu.Unlock() + sort.Slice(a.array, func(i, j int) bool { + return less(a.array[i], a.array[j]) + }) + return a +} + +// InsertBefore inserts the `values` to the front of `index`. +func (a *TArray[T]) InsertBefore(index int, values ...T) error { + a.mu.Lock() + defer a.mu.Unlock() + if index < 0 || index >= len(a.array) { + return gerror.NewCodef(gcode.CodeInvalidParameter, "index %d out of array range %d", index, len(a.array)) + } + rear := append([]T{}, a.array[index:]...) + a.array = append(a.array[0:index], values...) + a.array = append(a.array, rear...) + return nil +} + +// InsertAfter inserts the `values` to the back of `index`. +func (a *TArray[T]) InsertAfter(index int, values ...T) error { + a.mu.Lock() + defer a.mu.Unlock() + if index < 0 || index >= len(a.array) { + return gerror.NewCodef(gcode.CodeInvalidParameter, "index %d out of array range %d", index, len(a.array)) + } + rear := append([]T{}, a.array[index+1:]...) + a.array = append(a.array[0:index+1], values...) + a.array = append(a.array, rear...) + return nil +} + +// Remove removes an item by index. +// If the given `index` is out of range of the array, the `found` is false. +func (a *TArray[T]) Remove(index int) (value T, found bool) { + a.mu.Lock() + defer a.mu.Unlock() + return a.doRemoveWithoutLock(index) +} + +// doRemoveWithoutLock removes an item by index without lock. +func (a *TArray[T]) doRemoveWithoutLock(index int) (value T, found bool) { + if index < 0 || index >= len(a.array) { + found = false + return + } + // Determine array boundaries when deleting to improve deletion efficiency. + if index == 0 { + value := a.array[0] + a.array = a.array[1:] + return value, true + } else if index == len(a.array)-1 { + value := a.array[index] + a.array = a.array[:index] + return value, true + } + // If it is a non-boundary delete, + // it will involve the creation of an array, + // then the deletion is less efficient. + value = a.array[index] + a.array = append(a.array[:index], a.array[index+1:]...) + return value, true +} + +// RemoveValue removes an item by value. +// It returns true if value is found in the array, or else false if not found. +func (a *TArray[T]) RemoveValue(value T) bool { + a.mu.Lock() + defer a.mu.Unlock() + if i := a.doSearchWithoutLock(value); i != -1 { + a.doRemoveWithoutLock(i) + return true + } + return false +} + +// RemoveValues removes multiple items by `values`. +func (a *TArray[T]) RemoveValues(values ...T) { + a.mu.Lock() + defer a.mu.Unlock() + for _, value := range values { + if i := a.doSearchWithoutLock(value); i != -1 { + a.doRemoveWithoutLock(i) + } + } +} + +// PushLeft pushes one or multiple items to the beginning of array. +func (a *TArray[T]) PushLeft(value ...T) *TArray[T] { + a.mu.Lock() + a.array = append(value, a.array...) + a.mu.Unlock() + return a +} + +// PushRight pushes one or multiple items to the end of array. +// It equals to Append. +func (a *TArray[T]) PushRight(value ...T) *TArray[T] { + a.mu.Lock() + a.array = append(a.array, value...) + a.mu.Unlock() + return a +} + +// PopRand randomly pops and return an item out of array. +// Note that if the array is empty, the `found` is false. +func (a *TArray[T]) PopRand() (value T, found bool) { + a.mu.Lock() + defer a.mu.Unlock() + return a.doRemoveWithoutLock(grand.Intn(len(a.array))) +} + +// PopRands randomly pops and returns `size` items out of array. +func (a *TArray[T]) PopRands(size int) []T { + a.mu.Lock() + defer a.mu.Unlock() + if size <= 0 || len(a.array) == 0 { + return nil + } + if size >= len(a.array) { + size = len(a.array) + } + array := make([]T, size) + for i := 0; i < size; i++ { + array[i], _ = a.doRemoveWithoutLock(grand.Intn(len(a.array))) + } + return array +} + +// PopLeft pops and returns an item from the beginning of array. +// Note that if the array is empty, the `found` is false. +func (a *TArray[T]) PopLeft() (value T, found bool) { + a.mu.Lock() + defer a.mu.Unlock() + if len(a.array) == 0 { + found = false + return + } + value = a.array[0] + a.array = a.array[1:] + return value, true +} + +// PopRight pops and returns an item from the end of array. +// Note that if the array is empty, the `found` is false. +func (a *TArray[T]) PopRight() (value T, found bool) { + a.mu.Lock() + defer a.mu.Unlock() + index := len(a.array) - 1 + if index < 0 { + found = false + return + } + value = a.array[index] + a.array = a.array[:index] + return value, true +} + +// PopLefts pops and returns `size` items from the beginning of array. +func (a *TArray[T]) PopLefts(size int) []T { + a.mu.Lock() + defer a.mu.Unlock() + if size <= 0 || len(a.array) == 0 { + return nil + } + if size >= len(a.array) { + array := a.array + a.array = a.array[:0] + return array + } + value := a.array[0:size] + a.array = a.array[size:] + return value +} + +// PopRights pops and returns `size` items from the end of array. +func (a *TArray[T]) PopRights(size int) []T { + a.mu.Lock() + defer a.mu.Unlock() + if size <= 0 || len(a.array) == 0 { + return nil + } + index := len(a.array) - size + if index <= 0 { + array := a.array + a.array = a.array[:0] + return array + } + value := a.array[index:] + a.array = a.array[:index] + return value +} + +// Range picks and returns items by range, like array[start:end]. +// Notice, if in concurrent-safe usage, it returns a copy of slice; +// else a pointer to the underlying data. +// +// If `end` is negative, then the offset will start from the end of array. +// If `end` is omitted, then the sequence will have everything from start up +// until the end of the array. +func (a *TArray[T]) Range(start int, end ...int) []T { + a.mu.RLock() + defer a.mu.RUnlock() + offsetEnd := len(a.array) + if len(end) > 0 && end[0] < offsetEnd { + offsetEnd = end[0] + } + if start > offsetEnd { + return nil + } + if start < 0 { + start = 0 + } + array := ([]T)(nil) + if a.mu.IsSafe() { + array = make([]T, offsetEnd-start) + copy(array, a.array[start:offsetEnd]) + } else { + array = a.array[start:offsetEnd] + } + return array +} + +// SubSlice returns a slice of elements from the array as specified +// by the `offset` and `size` parameters. +// If in concurrent safe usage, it returns a copy of the slice; else a pointer. +// +// If offset is non-negative, the sequence will start at that offset in the array. +// If offset is negative, the sequence will start that far from the end of the array. +// +// If length is given and is positive, then the sequence will have up to that many elements in it. +// If the array is shorter than the length, then only the available array elements will be present. +// If length is given and is negative then the sequence will stop that many elements from the end of the array. +// If it is omitted, then the sequence will have everything from offset up until the end of the array. +// +// Any possibility crossing the left border of array, it will fail. +func (a *TArray[T]) SubSlice(offset int, length ...int) []T { + a.mu.RLock() + defer a.mu.RUnlock() + size := len(a.array) + if len(length) > 0 { + size = length[0] + } + if offset > len(a.array) { + return nil + } + if offset < 0 { + offset = len(a.array) + offset + if offset < 0 { + return nil + } + } + if size < 0 { + offset += size + size = -size + if offset < 0 { + return nil + } + } + end := offset + size + if end > len(a.array) { + end = len(a.array) + size = len(a.array) - offset + } + if a.mu.IsSafe() { + s := make([]T, size) + copy(s, a.array[offset:]) + return s + } else { + return a.array[offset:end] + } +} + +// Append is alias of PushRight, please See PushRight. +func (a *TArray[T]) Append(value ...T) *TArray[T] { + a.PushRight(value...) + return a +} + +// Len returns the length of array. +func (a *TArray[T]) Len() int { + a.mu.RLock() + length := len(a.array) + a.mu.RUnlock() + return length +} + +// Slice returns the underlying data of array. +// Note that, if it's in concurrent-safe usage, it returns a copy of underlying data, +// or else a pointer to the underlying data. +func (a *TArray[T]) Slice() []T { + if a.mu.IsSafe() { + a.mu.RLock() + defer a.mu.RUnlock() + array := make([]T, len(a.array)) + copy(array, a.array) + return array + } else { + return a.array + } +} + +// Interfaces returns current array as []any. +func (a *TArray[T]) Interfaces() []any { + return tToAnySlice(a.Slice()) +} + +// Clone returns a new array, which is a copy of current array. +func (a *TArray[T]) Clone() (newArray *TArray[T]) { + a.mu.RLock() + array := make([]T, len(a.array)) + copy(array, a.array) + a.mu.RUnlock() + return NewTArrayFrom(array, a.mu.IsSafe()) +} + +// Clear deletes all items of current array. +func (a *TArray[T]) Clear() *TArray[T] { + a.mu.Lock() + if len(a.array) > 0 { + a.array = make([]T, 0) + } + a.mu.Unlock() + return a +} + +// Contains checks whether a value exists in the array. +func (a *TArray[T]) Contains(value T) bool { + return a.Search(value) != -1 +} + +// Search searches array by `value`, returns the index of `value`, +// or returns -1 if not exists. +func (a *TArray[T]) Search(value T) int { + a.mu.RLock() + defer a.mu.RUnlock() + return a.doSearchWithoutLock(value) +} + +func (a *TArray[T]) doSearchWithoutLock(value T) int { + if len(a.array) == 0 { + return -1 + } + result := -1 + for index, v := range a.array { + if v == value { + result = index + break + } + } + return result +} + +// Unique uniques the array, clear repeated items. +// Example: [1,1,2,3,2] -> [1,2,3] +func (a *TArray[T]) Unique() *TArray[T] { + a.mu.Lock() + defer a.mu.Unlock() + if len(a.array) == 0 { + return a + } + var ( + ok bool + temp T + uniqueSet = make(map[T]struct{}) + uniqueArray = make([]T, 0, len(a.array)) + ) + for i := 0; i < len(a.array); i++ { + temp = a.array[i] + if _, ok = uniqueSet[temp]; ok { + continue + } + uniqueSet[temp] = struct{}{} + uniqueArray = append(uniqueArray, temp) + } + a.array = uniqueArray + return a +} + +// LockFunc locks writing by callback function `f`. +func (a *TArray[T]) LockFunc(f func(array []T)) *TArray[T] { + a.mu.Lock() + defer a.mu.Unlock() + f(a.array) + return a +} + +// RLockFunc locks reading by callback function `f`. +func (a *TArray[T]) RLockFunc(f func(array []T)) *TArray[T] { + a.mu.RLock() + defer a.mu.RUnlock() + f(a.array) + return a +} + +// Merge merges `array` into current array. +// The parameter `array` can be any garray or slice type. +// The difference between Merge and Append is Append supports only specified slice type, +// but Merge supports more parameter types. +func (a *TArray[T]) Merge(array any) *TArray[T] { + var vals []T + switch v := array.(type) { + case *SortedTArray[T]: + vals = v.Slice() + case *TArray[T]: + vals = v.Slice() + case []T: + vals = v + default: + interfaces := gconv.Interfaces(v) + if err := gconv.Scan(interfaces, &vals); err != nil { + panic(err) + } + } + + return a.Append(vals...) +} + +// Fill fills an array with num entries of the value `value`, +// keys starting at the `startIndex` parameter. +func (a *TArray[T]) Fill(startIndex int, num int, value T) error { + a.mu.Lock() + defer a.mu.Unlock() + if startIndex < 0 || startIndex > len(a.array) { + return gerror.NewCodef(gcode.CodeInvalidParameter, "index %d out of array range %d", startIndex, len(a.array)) + } + for i := startIndex; i < startIndex+num; i++ { + if i > len(a.array)-1 { + a.array = append(a.array, value) + } else { + a.array[i] = value + } + } + return nil +} + +// Chunk splits an array into multiple arrays, +// the size of each array is determined by `size`. +// The last chunk may contain less than size elements. +func (a *TArray[T]) Chunk(size int) [][]T { + if size < 1 { + return nil + } + a.mu.RLock() + defer a.mu.RUnlock() + length := len(a.array) + chunks := int(math.Ceil(float64(length) / float64(size))) + var n [][]T + for i, end := 0, 0; chunks > 0; chunks-- { + end = (i + 1) * size + if end > length { + end = length + } + n = append(n, a.array[i*size:end]) + i++ + } + return n +} + +// Pad pads array to the specified length with `value`. +// If size is positive then the array is padded on the right, or negative on the left. +// If the absolute value of `size` is less than or equal to the length of the array +// then no padding takes place. +func (a *TArray[T]) Pad(size int, val T) *TArray[T] { + a.mu.Lock() + defer a.mu.Unlock() + if size == 0 || (size > 0 && size < len(a.array)) || (size < 0 && size > -len(a.array)) { + return a + } + n := size + if size < 0 { + n = -size + } + n -= len(a.array) + tmp := make([]T, n) + for i := 0; i < n; i++ { + tmp[i] = val + } + if size > 0 { + a.array = append(a.array, tmp...) + } else { + a.array = append(tmp, a.array...) + } + return a +} + +// Rand randomly returns one item from array(no deleting). +func (a *TArray[T]) Rand() (value T, found bool) { + a.mu.RLock() + defer a.mu.RUnlock() + if len(a.array) == 0 { + found = false + return + } + return a.array[grand.Intn(len(a.array))], true +} + +// Rands randomly returns `size` items from array(no deleting). +func (a *TArray[T]) Rands(size int) []T { + a.mu.RLock() + defer a.mu.RUnlock() + if size <= 0 || len(a.array) == 0 { + return nil + } + array := make([]T, size) + for i := 0; i < size; i++ { + array[i] = a.array[grand.Intn(len(a.array))] + } + return array +} + +// Shuffle randomly shuffles the array. +func (a *TArray[T]) Shuffle() *TArray[T] { + a.mu.Lock() + defer a.mu.Unlock() + for i, v := range grand.Perm(len(a.array)) { + a.array[i], a.array[v] = a.array[v], a.array[i] + } + return a +} + +// Reverse makes array with elements in reverse order. +func (a *TArray[T]) Reverse() *TArray[T] { + a.mu.Lock() + defer a.mu.Unlock() + for i, j := 0, len(a.array)-1; i < j; i, j = i+1, j-1 { + a.array[i], a.array[j] = a.array[j], a.array[i] + } + return a +} + +// Join joins array elements with a string `glue`. +func (a *TArray[T]) Join(glue string) string { + a.mu.RLock() + defer a.mu.RUnlock() + if len(a.array) == 0 { + return "" + } + buffer := bytes.NewBuffer(nil) + for k, v := range a.array { + buffer.WriteString(gconv.String(v)) + if k != len(a.array)-1 { + buffer.WriteString(glue) + } + } + return buffer.String() +} + +// CountValues counts the number of occurrences of all values in the array. +func (a *TArray[T]) CountValues() map[T]int { + m := make(map[T]int) + a.mu.RLock() + defer a.mu.RUnlock() + for _, v := range a.array { + m[v]++ + } + return m +} + +// Iterator is alias of IteratorAsc. +func (a *TArray[T]) Iterator(f func(k int, v T) bool) { + a.IteratorAsc(f) +} + +// IteratorAsc iterates the array readonly in ascending order with given callback function `f`. +// If `f` returns true, then it continues iterating; or false to stop. +func (a *TArray[T]) IteratorAsc(f func(k int, v T) bool) { + a.mu.RLock() + defer a.mu.RUnlock() + for k, v := range a.array { + if !f(k, v) { + break + } + } +} + +// IteratorDesc iterates the array readonly in descending order with given callback function `f`. +// If `f` returns true, then it continues iterating; or false to stop. +func (a *TArray[T]) IteratorDesc(f func(k int, v T) bool) { + a.mu.RLock() + defer a.mu.RUnlock() + for i := len(a.array) - 1; i >= 0; i-- { + if !f(i, a.array[i]) { + break + } + } +} + +// String returns current array as a string, which implements like json.Marshal does. +func (a *TArray[T]) String() string { + if a == nil { + return "" + } + a.mu.RLock() + defer a.mu.RUnlock() + buffer := bytes.NewBuffer(nil) + buffer.WriteByte('[') + s := "" + for k, v := range a.array { + s = gconv.String(v) + if gstr.IsNumeric(s) { + buffer.WriteString(s) + } else { + buffer.WriteString(`"` + gstr.QuoteMeta(s, `"\`) + `"`) + } + if k != len(a.array)-1 { + buffer.WriteByte(',') + } + } + buffer.WriteByte(']') + return buffer.String() +} + +// MarshalJSON implements the interface MarshalJSON for json.Marshal. +// Note that do not use pointer as its receiver here. +func (a TArray[T]) MarshalJSON() ([]byte, error) { + a.mu.RLock() + defer a.mu.RUnlock() + return json.Marshal(a.array) +} + +// UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal. +func (a *TArray[T]) UnmarshalJSON(b []byte) error { + if a.array == nil { + a.array = make([]T, 0) + } + a.mu.Lock() + defer a.mu.Unlock() + if err := json.UnmarshalUseNumber(b, &a.array); err != nil { + return err + } + return nil +} + +// UnmarshalValue is an interface implement which sets any type of value for array. +func (a *TArray[T]) UnmarshalValue(value any) error { + a.mu.Lock() + defer a.mu.Unlock() + switch value.(type) { + case string, []byte: + return json.UnmarshalUseNumber(gconv.Bytes(value), &a.array) + default: + if err := gconv.Scan(gconv.SliceAny(value), &a.array); err != nil { + return err + } + } + return nil +} + +// Filter iterates array and filters elements using custom callback function. +// It removes the element from array if callback function `filter` returns true, +// it or else does nothing and continues iterating. +func (a *TArray[T]) Filter(filter func(index int, value T) bool) *TArray[T] { + a.mu.Lock() + defer a.mu.Unlock() + for i := 0; i < len(a.array); { + if filter(i, a.array[i]) { + a.array = append(a.array[:i], a.array[i+1:]...) + } else { + i++ + } + } + return a +} + +// FilterNil removes all nil value of the array. +func (a *TArray[T]) FilterNil() *TArray[T] { + a.mu.Lock() + defer a.mu.Unlock() + for i := 0; i < len(a.array); { + if empty.IsNil(a.array[i]) { + a.array = append(a.array[:i], a.array[i+1:]...) + } else { + i++ + } + } + return a +} + +// FilterEmpty removes all empty value of the array. +// Values like: 0, nil, false, "", len(slice/map/chan) == 0 are considered empty. +func (a *TArray[T]) FilterEmpty() *TArray[T] { + a.mu.Lock() + defer a.mu.Unlock() + for i := 0; i < len(a.array); { + if empty.IsEmpty(a.array[i]) { + a.array = append(a.array[:i], a.array[i+1:]...) + } else { + i++ + } + } + return a +} + +// Walk applies a user supplied function `f` to every item of array. +func (a *TArray[T]) Walk(f func(value T) T) *TArray[T] { + a.mu.Lock() + defer a.mu.Unlock() + for i, v := range a.array { + a.array[i] = f(v) + } + return a +} + +// IsEmpty checks whether the array is empty. +func (a *TArray[T]) IsEmpty() bool { + return a.Len() == 0 +} + +// DeepCopy implements interface for deep copy of current type. +func (a *TArray[T]) DeepCopy() any { + if a == nil { + return nil + } + a.mu.RLock() + defer a.mu.RUnlock() + newSlice := make([]T, len(a.array)) + for i, v := range a.array { + newSlice[i] = deepcopy.Copy(v).(T) + } + return NewTArrayFrom(newSlice, a.mu.IsSafe()) +} diff --git a/container/garray/garray_sorted_any.go b/container/garray/garray_sorted_any.go index 3644933ae..00029bff0 100644 --- a/container/garray/garray_sorted_any.go +++ b/container/garray/garray_sorted_any.go @@ -7,19 +7,11 @@ package garray import ( - "bytes" "fmt" - "math" "sort" + "sync" - "github.com/gogf/gf/v2/internal/deepcopy" - "github.com/gogf/gf/v2/internal/empty" - "github.com/gogf/gf/v2/internal/json" - "github.com/gogf/gf/v2/internal/rwmutex" - "github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/util/gconv" - "github.com/gogf/gf/v2/util/grand" - "github.com/gogf/gf/v2/util/gutil" ) // SortedArray is a golang sorted array with rich features. @@ -28,10 +20,17 @@ import ( // It contains a concurrent-safe/unsafe switch, which should be set // when its initialization and cannot be changed then. type SortedArray struct { - mu rwmutex.RWMutex - array []any - unique bool // Whether enable unique feature(false) - comparator func(a, b any) int // Comparison function(it returns -1: a < b; 0: a == b; 1: a > b) + *SortedTArray[any] + once sync.Once +} + +// lazyInit lazily initializes the array. +func (a *SortedArray) lazyInit() { + a.once.Do(func() { + if a.SortedTArray == nil { + a.SortedTArray = NewSortedTArraySize[any](0, nil, false) + } + }) } // NewSortedArray creates and returns an empty sorted array. @@ -49,9 +48,7 @@ func NewSortedArray(comparator func(a, b any) int, safe ...bool) *SortedArray { // which is false in default. func NewSortedArraySize(cap int, comparator func(a, b any) int, safe ...bool) *SortedArray { return &SortedArray{ - mu: rwmutex.Create(safe...), - array: make([]any, 0, cap), - comparator: comparator, + SortedTArray: NewSortedTArraySize(cap, comparator, safe...), } } @@ -94,224 +91,111 @@ func NewSortedArrayFromCopy(array []any, comparator func(a, b any) int, safe ... // At returns the value by the specified index. // If the given `index` is out of range of the array, it returns `nil`. func (a *SortedArray) At(index int) (value any) { - value, _ = a.Get(index) - return + a.lazyInit() + return a.SortedTArray.At(index) } // SetArray sets the underlying slice array with the given `array`. func (a *SortedArray) SetArray(array []any) *SortedArray { - a.mu.Lock() - defer a.mu.Unlock() - a.array = array - sort.Slice(a.array, func(i, j int) bool { - return a.getComparator()(a.array[i], a.array[j]) < 0 - }) + a.lazyInit() + a.SortedTArray.SetArray(array) return a } // SetComparator sets/changes the comparator for sorting. // It resorts the array as the comparator is changed. func (a *SortedArray) SetComparator(comparator func(a, b any) int) { - a.mu.Lock() - defer a.mu.Unlock() - a.comparator = comparator - sort.Slice(a.array, func(i, j int) bool { - return a.getComparator()(a.array[i], a.array[j]) < 0 - }) + a.lazyInit() + a.SortedTArray.SetComparator(comparator) } // Sort sorts the array in increasing order. // The parameter `reverse` controls whether sort // in increasing order(default) or decreasing order func (a *SortedArray) Sort() *SortedArray { - a.mu.Lock() - defer a.mu.Unlock() - sort.Slice(a.array, func(i, j int) bool { - return a.getComparator()(a.array[i], a.array[j]) < 0 - }) + a.lazyInit() + a.SortedTArray.Sort() return a } // Add adds one or multiple values to sorted array, the array always keeps sorted. // It's alias of function Append, see Append. func (a *SortedArray) Add(values ...any) *SortedArray { - return a.Append(values...) + a.lazyInit() + a.SortedTArray.Add(values...) + return a } // Append adds one or multiple values to sorted array, the array always keeps sorted. func (a *SortedArray) Append(values ...any) *SortedArray { - if len(values) == 0 { - return a - } - a.mu.Lock() - defer a.mu.Unlock() - for _, value := range values { - index, cmp := a.binSearch(value, false) - if a.unique && cmp == 0 { - continue - } - if index < 0 { - a.array = append(a.array, value) - continue - } - if cmp > 0 { - index++ - } - a.array = append(a.array[:index], append([]any{value}, a.array[index:]...)...) - } + a.SortedTArray.Append(values...) return a } // Get returns the value by the specified index. // If the given `index` is out of range of the array, the `found` is false. func (a *SortedArray) Get(index int) (value any, found bool) { - a.mu.RLock() - defer a.mu.RUnlock() - if index < 0 || index >= len(a.array) { - return nil, false - } - return a.array[index], true + a.lazyInit() + return a.SortedTArray.Get(index) } // Remove removes an item by index. // If the given `index` is out of range of the array, the `found` is false. func (a *SortedArray) Remove(index int) (value any, found bool) { - a.mu.Lock() - defer a.mu.Unlock() - return a.doRemoveWithoutLock(index) -} - -// doRemoveWithoutLock removes an item by index without lock. -func (a *SortedArray) doRemoveWithoutLock(index int) (value any, found bool) { - if index < 0 || index >= len(a.array) { - return nil, false - } - // Determine array boundaries when deleting to improve deletion efficiency. - if index == 0 { - value := a.array[0] - a.array = a.array[1:] - return value, true - } else if index == len(a.array)-1 { - value := a.array[index] - a.array = a.array[:index] - return value, true - } - // If it is a non-boundary delete, - // it will involve the creation of an array, - // then the deletion is less efficient. - value = a.array[index] - a.array = append(a.array[:index], a.array[index+1:]...) - return value, true + a.lazyInit() + return a.SortedTArray.Remove(index) } // RemoveValue removes an item by value. // It returns true if value is found in the array, or else false if not found. func (a *SortedArray) RemoveValue(value any) bool { - a.mu.Lock() - defer a.mu.Unlock() - if i, r := a.binSearch(value, false); r == 0 { - _, res := a.doRemoveWithoutLock(i) - return res - } - return false + a.lazyInit() + return a.SortedTArray.RemoveValue(value) } // RemoveValues removes an item by `values`. func (a *SortedArray) RemoveValues(values ...any) { - a.mu.Lock() - defer a.mu.Unlock() - for _, value := range values { - if i, r := a.binSearch(value, false); r == 0 { - a.doRemoveWithoutLock(i) - } - } + a.lazyInit() + a.SortedTArray.RemoveValues(values...) } // PopLeft pops and returns an item from the beginning of array. // Note that if the array is empty, the `found` is false. func (a *SortedArray) PopLeft() (value any, found bool) { - a.mu.Lock() - defer a.mu.Unlock() - if len(a.array) == 0 { - return nil, false - } - value = a.array[0] - a.array = a.array[1:] - return value, true + a.lazyInit() + return a.SortedTArray.PopLeft() } // PopRight pops and returns an item from the end of array. // Note that if the array is empty, the `found` is false. func (a *SortedArray) PopRight() (value any, found bool) { - a.mu.Lock() - defer a.mu.Unlock() - index := len(a.array) - 1 - if index < 0 { - return nil, false - } - value = a.array[index] - a.array = a.array[:index] - return value, true + a.lazyInit() + return a.SortedTArray.PopRight() } // PopRand randomly pops and return an item out of array. // Note that if the array is empty, the `found` is false. func (a *SortedArray) PopRand() (value any, found bool) { - a.mu.Lock() - defer a.mu.Unlock() - return a.doRemoveWithoutLock(grand.Intn(len(a.array))) + a.lazyInit() + return a.SortedTArray.PopRand() } // PopRands randomly pops and returns `size` items out of array. func (a *SortedArray) PopRands(size int) []any { - a.mu.Lock() - defer a.mu.Unlock() - if size <= 0 || len(a.array) == 0 { - return nil - } - if size >= len(a.array) { - size = len(a.array) - } - array := make([]any, size) - for i := 0; i < size; i++ { - array[i], _ = a.doRemoveWithoutLock(grand.Intn(len(a.array))) - } - return array + a.lazyInit() + return a.SortedTArray.PopRands(size) } // PopLefts pops and returns `size` items from the beginning of array. func (a *SortedArray) PopLefts(size int) []any { - a.mu.Lock() - defer a.mu.Unlock() - if size <= 0 || len(a.array) == 0 { - return nil - } - if size >= len(a.array) { - array := a.array - a.array = a.array[:0] - return array - } - value := a.array[0:size] - a.array = a.array[size:] - return value + a.lazyInit() + return a.SortedTArray.PopLefts(size) } // PopRights pops and returns `size` items from the end of array. func (a *SortedArray) PopRights(size int) []any { - a.mu.Lock() - defer a.mu.Unlock() - if size <= 0 || len(a.array) == 0 { - return nil - } - index := len(a.array) - size - if index <= 0 { - array := a.array - a.array = a.array[:0] - return array - } - value := a.array[index:] - a.array = a.array[:index] - return value + a.lazyInit() + return a.SortedTArray.PopRights(size) } // Range picks and returns items by range, like array[start:end]. @@ -322,26 +206,7 @@ func (a *SortedArray) PopRights(size int) []any { // If `end` is omitted, then the sequence will have everything from start up // until the end of the array. func (a *SortedArray) Range(start int, end ...int) []any { - a.mu.RLock() - defer a.mu.RUnlock() - offsetEnd := len(a.array) - if len(end) > 0 && end[0] < offsetEnd { - offsetEnd = end[0] - } - if start > offsetEnd { - return nil - } - if start < 0 { - start = 0 - } - array := ([]any)(nil) - if a.mu.IsSafe() { - array = make([]any, offsetEnd-start) - copy(array, a.array[start:offsetEnd]) - } else { - array = a.array[start:offsetEnd] - } - return array + return a.SortedTArray.Range(start, end...) } // SubSlice returns a slice of elements from the array as specified @@ -358,194 +223,91 @@ func (a *SortedArray) Range(start int, end ...int) []any { // // Any possibility crossing the left border of array, it will fail. func (a *SortedArray) SubSlice(offset int, length ...int) []any { - a.mu.RLock() - defer a.mu.RUnlock() - size := len(a.array) - if len(length) > 0 { - size = length[0] - } - if offset > len(a.array) { - return nil - } - if offset < 0 { - offset = len(a.array) + offset - if offset < 0 { - return nil - } - } - if size < 0 { - offset += size - size = -size - if offset < 0 { - return nil - } - } - end := offset + size - if end > len(a.array) { - end = len(a.array) - size = len(a.array) - offset - } - if a.mu.IsSafe() { - s := make([]any, size) - copy(s, a.array[offset:]) - return s - } else { - return a.array[offset:end] - } + a.lazyInit() + return a.SortedTArray.SubSlice(offset, length...) } // Sum returns the sum of values in an array. func (a *SortedArray) Sum() (sum int) { - a.mu.RLock() - defer a.mu.RUnlock() - for _, v := range a.array { - sum += gconv.Int(v) - } - return + a.lazyInit() + return a.SortedTArray.Sum() } // Len returns the length of array. func (a *SortedArray) Len() int { - a.mu.RLock() - length := len(a.array) - a.mu.RUnlock() - return length + a.lazyInit() + return a.SortedTArray.Len() } // Slice returns the underlying data of array. // Note that, if it's in concurrent-safe usage, it returns a copy of underlying data, // or else a pointer to the underlying data. func (a *SortedArray) Slice() []any { - var array []any - if a.mu.IsSafe() { - a.mu.RLock() - defer a.mu.RUnlock() - array = make([]any, len(a.array)) - copy(array, a.array) - } else { - array = a.array - } - return array + a.lazyInit() + return a.SortedTArray.Slice() } // Interfaces returns current array as []any. func (a *SortedArray) Interfaces() []any { - return a.Slice() + a.lazyInit() + return a.SortedTArray.Interfaces() } // Contains checks whether a value exists in the array. func (a *SortedArray) Contains(value any) bool { - return a.Search(value) != -1 + a.lazyInit() + return a.SortedTArray.Contains(value) } // Search searches array by `value`, returns the index of `value`, // or returns -1 if not exists. func (a *SortedArray) Search(value any) (index int) { - if i, r := a.binSearch(value, true); r == 0 { - return i - } - return -1 -} - -// Binary search. -// It returns the last compared index and the result. -// If `result` equals to 0, it means the value at `index` is equals to `value`. -// If `result` lesser than 0, it means the value at `index` is lesser than `value`. -// If `result` greater than 0, it means the value at `index` is greater than `value`. -func (a *SortedArray) binSearch(value any, lock bool) (index int, result int) { - if lock { - a.mu.RLock() - defer a.mu.RUnlock() - } - if len(a.array) == 0 { - return -1, -2 - } - min := 0 - max := len(a.array) - 1 - mid := 0 - cmp := -2 - for min <= max { - mid = min + (max-min)/2 - cmp = a.getComparator()(value, a.array[mid]) - switch { - case cmp < 0: - max = mid - 1 - case cmp > 0: - min = mid + 1 - default: - return mid, cmp - } - } - return mid, cmp + a.lazyInit() + return a.SortedTArray.Search(value) } // SetUnique sets unique mark to the array, // which means it does not contain any repeated items. // It also does unique check, remove all repeated items. func (a *SortedArray) SetUnique(unique bool) *SortedArray { - oldUnique := a.unique - a.unique = unique - if unique && oldUnique != unique { - a.Unique() - } + a.lazyInit() + a.SortedTArray.SetUnique(unique) return a } // Unique uniques the array, clear repeated items. func (a *SortedArray) Unique() *SortedArray { - a.mu.Lock() - defer a.mu.Unlock() - if len(a.array) == 0 { - return a - } - for i := 0; i < len(a.array)-1; { - if a.getComparator()(a.array[i], a.array[i+1]) == 0 { - a.array = append(a.array[:i+1], a.array[i+2:]...) - } else { - i++ - } - } + a.lazyInit() + a.SortedTArray.Unique() return a } // Clone returns a new array, which is a copy of current array. func (a *SortedArray) Clone() (newArray *SortedArray) { - a.mu.RLock() - array := make([]any, len(a.array)) - copy(array, a.array) - a.mu.RUnlock() - return NewSortedArrayFrom(array, a.comparator, a.mu.IsSafe()) + a.lazyInit() + return &SortedArray{ + SortedTArray: a.SortedTArray.Clone(), + } } // Clear deletes all items of current array. func (a *SortedArray) Clear() *SortedArray { - a.mu.Lock() - if len(a.array) > 0 { - a.array = make([]any, 0) - } - a.mu.Unlock() + a.lazyInit() + a.SortedTArray.Clear() return a } // LockFunc locks writing by callback function `f`. func (a *SortedArray) LockFunc(f func(array []any)) *SortedArray { - a.mu.Lock() - defer a.mu.Unlock() - - // Keep the array always sorted. - defer sort.Slice(a.array, func(i, j int) bool { - return a.getComparator()(a.array[i], a.array[j]) < 0 - }) - - f(a.array) + a.lazyInit() + a.SortedTArray.LockFunc(f) return a } // RLockFunc locks reading by callback function `f`. func (a *SortedArray) RLockFunc(f func(array []any)) *SortedArray { - a.mu.RLock() - defer a.mu.RUnlock() - f(a.array) + a.lazyInit() + a.SortedTArray.RLockFunc(f) return a } @@ -561,104 +323,52 @@ func (a *SortedArray) Merge(array any) *SortedArray { // the size of each array is determined by `size`. // The last chunk may contain less than size elements. func (a *SortedArray) Chunk(size int) [][]any { - if size < 1 { - return nil - } - a.mu.RLock() - defer a.mu.RUnlock() - length := len(a.array) - chunks := int(math.Ceil(float64(length) / float64(size))) - var n [][]any - for i, end := 0, 0; chunks > 0; chunks-- { - end = (i + 1) * size - if end > length { - end = length - } - n = append(n, a.array[i*size:end]) - i++ - } - return n + a.lazyInit() + return a.SortedTArray.Chunk(size) } // Rand randomly returns one item from array(no deleting). func (a *SortedArray) Rand() (value any, found bool) { - a.mu.RLock() - defer a.mu.RUnlock() - if len(a.array) == 0 { - return nil, false - } - return a.array[grand.Intn(len(a.array))], true + a.lazyInit() + return a.SortedTArray.Rand() } // Rands randomly returns `size` items from array(no deleting). func (a *SortedArray) Rands(size int) []any { - a.mu.RLock() - defer a.mu.RUnlock() - if size <= 0 || len(a.array) == 0 { - return nil - } - array := make([]any, size) - for i := 0; i < size; i++ { - array[i] = a.array[grand.Intn(len(a.array))] - } - return array + a.lazyInit() + return a.SortedTArray.Rands(size) } // Join joins array elements with a string `glue`. func (a *SortedArray) Join(glue string) string { - a.mu.RLock() - defer a.mu.RUnlock() - if len(a.array) == 0 { - return "" - } - buffer := bytes.NewBuffer(nil) - for k, v := range a.array { - buffer.WriteString(gconv.String(v)) - if k != len(a.array)-1 { - buffer.WriteString(glue) - } - } - return buffer.String() + a.lazyInit() + return a.SortedTArray.Join(glue) } // CountValues counts the number of occurrences of all values in the array. func (a *SortedArray) CountValues() map[any]int { - m := make(map[any]int) - a.mu.RLock() - defer a.mu.RUnlock() - for _, v := range a.array { - m[v]++ - } - return m + a.lazyInit() + return a.SortedTArray.CountValues() } // Iterator is alias of IteratorAsc. func (a *SortedArray) Iterator(f func(k int, v any) bool) { - a.IteratorAsc(f) + a.lazyInit() + a.SortedTArray.Iterator(f) } // IteratorAsc iterates the array readonly in ascending order with given callback function `f`. // If `f` returns true, then it continues iterating; or false to stop. func (a *SortedArray) IteratorAsc(f func(k int, v any) bool) { - a.mu.RLock() - defer a.mu.RUnlock() - for k, v := range a.array { - if !f(k, v) { - break - } - } + a.lazyInit() + a.SortedTArray.IteratorAsc(f) } // IteratorDesc iterates the array readonly in descending order with given callback function `f`. // If `f` returns true, then it continues iterating; or false to stop. func (a *SortedArray) IteratorDesc(f func(k int, v any) bool) { - a.mu.RLock() - defer a.mu.RUnlock() - for i := len(a.array) - 1; i >= 0; i-- { - if !f(i, a.array[i]) { - break - } - } + a.lazyInit() + a.SortedTArray.IteratorDesc(f) } // String returns current array as a string, which implements like json.Marshal does. @@ -666,94 +376,35 @@ func (a *SortedArray) String() string { if a == nil { return "" } - a.mu.RLock() - defer a.mu.RUnlock() - buffer := bytes.NewBuffer(nil) - buffer.WriteByte('[') - s := "" - for k, v := range a.array { - s = gconv.String(v) - if gstr.IsNumeric(s) { - buffer.WriteString(s) - } else { - buffer.WriteString(`"` + gstr.QuoteMeta(s, `"\`) + `"`) - } - if k != len(a.array)-1 { - buffer.WriteByte(',') - } - } - buffer.WriteByte(']') - return buffer.String() + a.lazyInit() + return a.SortedTArray.String() } // MarshalJSON implements the interface MarshalJSON for json.Marshal. // Note that do not use pointer as its receiver here. func (a SortedArray) MarshalJSON() ([]byte, error) { - a.mu.RLock() - defer a.mu.RUnlock() - return json.Marshal(a.array) + a.lazyInit() + return a.SortedTArray.MarshalJSON() } // UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal. // Note that the comparator is set as string comparator in default. func (a *SortedArray) UnmarshalJSON(b []byte) error { - if a.comparator == nil { - a.array = make([]any, 0) - a.comparator = gutil.ComparatorString - } - a.mu.Lock() - defer a.mu.Unlock() - if err := json.UnmarshalUseNumber(b, &a.array); err != nil { - return err - } - if a.comparator != nil && a.array != nil { - sort.Slice(a.array, func(i, j int) bool { - return a.comparator(a.array[i], a.array[j]) < 0 - }) - } - return nil + a.lazyInit() + return a.SortedTArray.UnmarshalJSON(b) } // UnmarshalValue is an interface implement which sets any type of value for array. // Note that the comparator is set as string comparator in default. func (a *SortedArray) UnmarshalValue(value any) (err error) { - if a.comparator == nil { - a.comparator = gutil.ComparatorString - } - a.mu.Lock() - defer a.mu.Unlock() - switch value.(type) { - case string, []byte: - err = json.UnmarshalUseNumber(gconv.Bytes(value), &a.array) - default: - a.array = gconv.SliceAny(value) - } - if a.comparator != nil && a.array != nil { - sort.Slice(a.array, func(i, j int) bool { - return a.comparator(a.array[i], a.array[j]) < 0 - }) - } - return err + a.lazyInit() + return a.SortedTArray.UnmarshalValue(value) } // FilterNil removes all nil value of the array. func (a *SortedArray) FilterNil() *SortedArray { - a.mu.Lock() - defer a.mu.Unlock() - for i := 0; i < len(a.array); { - if empty.IsNil(a.array[i]) { - a.array = append(a.array[:i], a.array[i+1:]...) - } else { - break - } - } - for i := len(a.array) - 1; i >= 0; { - if empty.IsNil(a.array[i]) { - a.array = append(a.array[:i], a.array[i+1:]...) - } else { - break - } - } + a.lazyInit() + a.SortedTArray.FilterNil() return a } @@ -761,78 +412,36 @@ func (a *SortedArray) FilterNil() *SortedArray { // It removes the element from array if callback function `filter` returns true, // it or else does nothing and continues iterating. func (a *SortedArray) Filter(filter func(index int, value any) bool) *SortedArray { - a.mu.Lock() - defer a.mu.Unlock() - for i := 0; i < len(a.array); { - if filter(i, a.array[i]) { - a.array = append(a.array[:i], a.array[i+1:]...) - } else { - i++ - } - } + a.lazyInit() + a.SortedTArray.Filter(filter) return a } // FilterEmpty removes all empty value of the array. // Values like: 0, nil, false, "", len(slice/map/chan) == 0 are considered empty. func (a *SortedArray) FilterEmpty() *SortedArray { - a.mu.Lock() - defer a.mu.Unlock() - for i := 0; i < len(a.array); { - if empty.IsEmpty(a.array[i]) { - a.array = append(a.array[:i], a.array[i+1:]...) - } else { - break - } - } - for i := len(a.array) - 1; i >= 0; { - if empty.IsEmpty(a.array[i]) { - a.array = append(a.array[:i], a.array[i+1:]...) - } else { - break - } - } + a.lazyInit() + a.SortedTArray.FilterEmpty() return a } // Walk applies a user supplied function `f` to every item of array. func (a *SortedArray) Walk(f func(value any) any) *SortedArray { - a.mu.Lock() - defer a.mu.Unlock() - // Keep the array always sorted. - defer sort.Slice(a.array, func(i, j int) bool { - return a.getComparator()(a.array[i], a.array[j]) < 0 - }) - for i, v := range a.array { - a.array[i] = f(v) - } + a.lazyInit() + a.SortedTArray.Walk(f) return a } // IsEmpty checks whether the array is empty. func (a *SortedArray) IsEmpty() bool { - return a.Len() == 0 -} - -// getComparator returns the comparator if it's previously set, -// or else it panics. -func (a *SortedArray) getComparator() func(a, b any) int { - if a.comparator == nil { - panic("comparator is missing for sorted array") - } - return a.comparator + a.lazyInit() + return a.SortedTArray.IsEmpty() } // DeepCopy implements interface for deep copy of current type. func (a *SortedArray) DeepCopy() any { - if a == nil { - return nil + a.lazyInit() + return &SortedArray{ + SortedTArray: a.SortedTArray.DeepCopy().(*SortedTArray[any]), } - a.mu.RLock() - defer a.mu.RUnlock() - newSlice := make([]any, len(a.array)) - for i, v := range a.array { - newSlice[i] = deepcopy.Copy(v) - } - return NewSortedArrayFrom(newSlice, a.comparator, a.mu.IsSafe()) } diff --git a/container/garray/garray_sorted_int.go b/container/garray/garray_sorted_int.go index 48d8469b1..a4a27a06e 100644 --- a/container/garray/garray_sorted_int.go +++ b/container/garray/garray_sorted_int.go @@ -7,15 +7,10 @@ package garray import ( - "bytes" "fmt" - "math" - "sort" + "sync" - "github.com/gogf/gf/v2/internal/json" - "github.com/gogf/gf/v2/internal/rwmutex" "github.com/gogf/gf/v2/util/gconv" - "github.com/gogf/gf/v2/util/grand" ) // SortedIntArray is a golang sorted int array with rich features. @@ -24,10 +19,18 @@ import ( // It contains a concurrent-safe/unsafe switch, which should be set // when its initialization and cannot be changed then. type SortedIntArray struct { - mu rwmutex.RWMutex - array []int - unique bool // Whether enable unique feature(false) - comparator func(a, b int) int // Comparison function(it returns -1: a < b; 0: a == b; 1: a > b) + *SortedTArray[int] + once sync.Once +} + +// lazyInit lazily initializes the array. +func (a *SortedIntArray) lazyInit() { + a.once.Do(func() { + if a.SortedTArray == nil { + a.SortedTArray = NewSortedTArraySize(0, defaultComparatorInt, false) + a.SetSorter(quickSortInt) + } + }) } // NewSortedIntArray creates and returns an empty sorted array. @@ -49,10 +52,10 @@ func NewSortedIntArrayComparator(comparator func(a, b int) int, safe ...bool) *S // The parameter `safe` is used to specify whether using array in concurrent-safety, // which is false in default. func NewSortedIntArraySize(cap int, safe ...bool) *SortedIntArray { + a := NewSortedTArraySize(cap, defaultComparatorInt, safe...) + a.SetSorter(quickSortInt) return &SortedIntArray{ - mu: rwmutex.Create(safe...), - array: make([]int, 0, cap), - comparator: defaultComparatorInt, + SortedTArray: a, } } @@ -77,7 +80,7 @@ func NewSortedIntArrayRange(start, end, step int, safe ...bool) *SortedIntArray func NewSortedIntArrayFrom(array []int, safe ...bool) *SortedIntArray { a := NewSortedIntArraySize(0, safe...) a.array = array - sort.Ints(a.array) + a.sorter(a.array, defaultComparatorInt) return a } @@ -93,16 +96,14 @@ func NewSortedIntArrayFromCopy(array []int, safe ...bool) *SortedIntArray { // At returns the value by the specified index. // If the given `index` is out of range of the array, it returns `0`. func (a *SortedIntArray) At(index int) (value int) { - value, _ = a.Get(index) - return + a.lazyInit() + return a.SortedTArray.At(index) } // SetArray sets the underlying slice array with the given `array`. func (a *SortedIntArray) SetArray(array []int) *SortedIntArray { - a.mu.Lock() - defer a.mu.Unlock() - a.array = array - quickSortInt(a.array, a.getComparator()) + a.lazyInit() + a.SortedTArray.SetArray(array) return a } @@ -110,200 +111,95 @@ func (a *SortedIntArray) SetArray(array []int) *SortedIntArray { // The parameter `reverse` controls whether sort // in increasing order(default) or decreasing order. func (a *SortedIntArray) Sort() *SortedIntArray { - a.mu.Lock() - defer a.mu.Unlock() - quickSortInt(a.array, a.getComparator()) + a.lazyInit() + a.SortedTArray.Sort() return a } // Add adds one or multiple values to sorted array, the array always keeps sorted. // It's alias of function Append, see Append. func (a *SortedIntArray) Add(values ...int) *SortedIntArray { + a.lazyInit() return a.Append(values...) } // Append adds one or multiple values to sorted array, the array always keeps sorted. func (a *SortedIntArray) Append(values ...int) *SortedIntArray { - if len(values) == 0 { - return a - } - a.mu.Lock() - defer a.mu.Unlock() - for _, value := range values { - index, cmp := a.binSearch(value, false) - if a.unique && cmp == 0 { - continue - } - if index < 0 { - a.array = append(a.array, value) - continue - } - if cmp > 0 { - index++ - } - rear := append([]int{}, a.array[index:]...) - a.array = append(a.array[0:index], value) - a.array = append(a.array, rear...) - } + a.lazyInit() + a.SortedTArray.Append(values...) return a } // Get returns the value by the specified index. // If the given `index` is out of range of the array, the `found` is false. func (a *SortedIntArray) Get(index int) (value int, found bool) { - a.mu.RLock() - defer a.mu.RUnlock() - if index < 0 || index >= len(a.array) { - return 0, false - } - return a.array[index], true + a.lazyInit() + return a.SortedTArray.Get(index) } // Remove removes an item by index. // If the given `index` is out of range of the array, the `found` is false. func (a *SortedIntArray) Remove(index int) (value int, found bool) { - a.mu.Lock() - defer a.mu.Unlock() - return a.doRemoveWithoutLock(index) -} - -// doRemoveWithoutLock removes an item by index without lock. -func (a *SortedIntArray) doRemoveWithoutLock(index int) (value int, found bool) { - if index < 0 || index >= len(a.array) { - return 0, false - } - // Determine array boundaries when deleting to improve deletion efficiency. - if index == 0 { - value := a.array[0] - a.array = a.array[1:] - return value, true - } else if index == len(a.array)-1 { - value := a.array[index] - a.array = a.array[:index] - return value, true - } - // If it is a non-boundary delete, - // it will involve the creation of an array, - // then the deletion is less efficient. - value = a.array[index] - a.array = append(a.array[:index], a.array[index+1:]...) - return value, true + a.lazyInit() + return a.SortedTArray.Remove(index) } // RemoveValue removes an item by value. // It returns true if value is found in the array, or else false if not found. func (a *SortedIntArray) RemoveValue(value int) bool { - a.mu.Lock() - defer a.mu.Unlock() - if i, r := a.binSearch(value, false); r == 0 { - _, res := a.doRemoveWithoutLock(i) - return res - } - return false + a.lazyInit() + return a.SortedTArray.RemoveValue(value) } // RemoveValues removes an item by `values`. func (a *SortedIntArray) RemoveValues(values ...int) { - a.mu.Lock() - defer a.mu.Unlock() - for _, value := range values { - if i, r := a.binSearch(value, false); r == 0 { - a.doRemoveWithoutLock(i) - } - } + a.lazyInit() + a.SortedTArray.RemoveValues(values...) } // PopLeft pops and returns an item from the beginning of array. // Note that if the array is empty, the `found` is false. func (a *SortedIntArray) PopLeft() (value int, found bool) { - a.mu.Lock() - defer a.mu.Unlock() - if len(a.array) == 0 { - return 0, false - } - value = a.array[0] - a.array = a.array[1:] - return value, true + a.lazyInit() + return a.SortedTArray.PopLeft() } // PopRight pops and returns an item from the end of array. // Note that if the array is empty, the `found` is false. func (a *SortedIntArray) PopRight() (value int, found bool) { - a.mu.Lock() - defer a.mu.Unlock() - index := len(a.array) - 1 - if index < 0 { - return 0, false - } - value = a.array[index] - a.array = a.array[:index] - return value, true + a.lazyInit() + return a.SortedTArray.PopRight() } // PopRand randomly pops and return an item out of array. // Note that if the array is empty, the `found` is false. func (a *SortedIntArray) PopRand() (value int, found bool) { - a.mu.Lock() - defer a.mu.Unlock() - return a.doRemoveWithoutLock(grand.Intn(len(a.array))) + a.lazyInit() + return a.SortedTArray.PopRand() } // PopRands randomly pops and returns `size` items out of array. // If the given `size` is greater than size of the array, it returns all elements of the array. // Note that if given `size` <= 0 or the array is empty, it returns nil. func (a *SortedIntArray) PopRands(size int) []int { - a.mu.Lock() - defer a.mu.Unlock() - if size <= 0 || len(a.array) == 0 { - return nil - } - if size >= len(a.array) { - size = len(a.array) - } - array := make([]int, size) - for i := 0; i < size; i++ { - array[i], _ = a.doRemoveWithoutLock(grand.Intn(len(a.array))) - } - return array + a.lazyInit() + return a.SortedTArray.PopRands(size) } // PopLefts pops and returns `size` items from the beginning of array. // If the given `size` is greater than size of the array, it returns all elements of the array. // Note that if given `size` <= 0 or the array is empty, it returns nil. func (a *SortedIntArray) PopLefts(size int) []int { - a.mu.Lock() - defer a.mu.Unlock() - if size <= 0 || len(a.array) == 0 { - return nil - } - if size >= len(a.array) { - array := a.array - a.array = a.array[:0] - return array - } - value := a.array[0:size] - a.array = a.array[size:] - return value + a.lazyInit() + return a.SortedTArray.PopLefts(size) } // PopRights pops and returns `size` items from the end of array. // If the given `size` is greater than size of the array, it returns all elements of the array. // Note that if given `size` <= 0 or the array is empty, it returns nil. func (a *SortedIntArray) PopRights(size int) []int { - a.mu.Lock() - defer a.mu.Unlock() - if size <= 0 || len(a.array) == 0 { - return nil - } - index := len(a.array) - size - if index <= 0 { - array := a.array - a.array = a.array[:0] - return array - } - value := a.array[index:] - a.array = a.array[:index] - return value + a.lazyInit() + return a.SortedTArray.PopRights(size) } // Range picks and returns items by range, like array[start:end]. @@ -314,26 +210,8 @@ func (a *SortedIntArray) PopRights(size int) []int { // If `end` is omitted, then the sequence will have everything from start up // until the end of the array. func (a *SortedIntArray) Range(start int, end ...int) []int { - a.mu.RLock() - defer a.mu.RUnlock() - offsetEnd := len(a.array) - if len(end) > 0 && end[0] < offsetEnd { - offsetEnd = end[0] - } - if start > offsetEnd { - return nil - } - if start < 0 { - start = 0 - } - array := ([]int)(nil) - if a.mu.IsSafe() { - array = make([]int, offsetEnd-start) - copy(array, a.array[start:offsetEnd]) - } else { - array = a.array[start:offsetEnd] - } - return array + a.lazyInit() + return a.SortedTArray.Range(start, end...) } // SubSlice returns a slice of elements from the array as specified @@ -350,194 +228,91 @@ func (a *SortedIntArray) Range(start int, end ...int) []int { // // Any possibility crossing the left border of array, it will fail. func (a *SortedIntArray) SubSlice(offset int, length ...int) []int { - a.mu.RLock() - defer a.mu.RUnlock() - size := len(a.array) - if len(length) > 0 { - size = length[0] - } - if offset > len(a.array) { - return nil - } - if offset < 0 { - offset = len(a.array) + offset - if offset < 0 { - return nil - } - } - if size < 0 { - offset += size - size = -size - if offset < 0 { - return nil - } - } - end := offset + size - if end > len(a.array) { - end = len(a.array) - size = len(a.array) - offset - } - if a.mu.IsSafe() { - s := make([]int, size) - copy(s, a.array[offset:]) - return s - } else { - return a.array[offset:end] - } + a.lazyInit() + return a.SortedTArray.SubSlice(offset, length...) } // Len returns the length of array. func (a *SortedIntArray) Len() int { - a.mu.RLock() - length := len(a.array) - a.mu.RUnlock() - return length + a.lazyInit() + return a.SortedTArray.Len() } // Sum returns the sum of values in an array. func (a *SortedIntArray) Sum() (sum int) { - a.mu.RLock() - defer a.mu.RUnlock() - for _, v := range a.array { - sum += v - } - return + a.lazyInit() + return a.SortedTArray.Sum() } // Slice returns the underlying data of array. // Note that, if it's in concurrent-safe usage, it returns a copy of underlying data, // or else a pointer to the underlying data. func (a *SortedIntArray) Slice() []int { - array := ([]int)(nil) - if a.mu.IsSafe() { - a.mu.RLock() - defer a.mu.RUnlock() - array = make([]int, len(a.array)) - copy(array, a.array) - } else { - array = a.array - } - return array + a.lazyInit() + return a.SortedTArray.Slice() } // Interfaces returns current array as []any. func (a *SortedIntArray) Interfaces() []any { - a.mu.RLock() - defer a.mu.RUnlock() - array := make([]any, len(a.array)) - for k, v := range a.array { - array[k] = v - } - return array + a.lazyInit() + return a.SortedTArray.Interfaces() } // Contains checks whether a value exists in the array. func (a *SortedIntArray) Contains(value int) bool { - return a.Search(value) != -1 + a.lazyInit() + return a.SortedTArray.Contains(value) } // Search searches array by `value`, returns the index of `value`, // or returns -1 if not exists. func (a *SortedIntArray) Search(value int) (index int) { - if i, r := a.binSearch(value, true); r == 0 { - return i - } - return -1 -} - -// Binary search. -// It returns the last compared index and the result. -// If `result` equals to 0, it means the value at `index` is equals to `value`. -// If `result` lesser than 0, it means the value at `index` is lesser than `value`. -// If `result` greater than 0, it means the value at `index` is greater than `value`. -func (a *SortedIntArray) binSearch(value int, lock bool) (index int, result int) { - if lock { - a.mu.RLock() - defer a.mu.RUnlock() - } - if len(a.array) == 0 { - return -1, -2 - } - min := 0 - max := len(a.array) - 1 - mid := 0 - cmp := -2 - for min <= max { - mid = min + int((max-min)/2) - cmp = a.getComparator()(value, a.array[mid]) - switch { - case cmp < 0: - max = mid - 1 - case cmp > 0: - min = mid + 1 - default: - return mid, cmp - } - } - return mid, cmp + a.lazyInit() + return a.SortedTArray.Search(value) } // SetUnique sets unique mark to the array, // which means it does not contain any repeated items. // It also do unique check, remove all repeated items. func (a *SortedIntArray) SetUnique(unique bool) *SortedIntArray { - oldUnique := a.unique - a.unique = unique - if unique && oldUnique != unique { - a.Unique() - } + a.lazyInit() + a.SortedTArray.SetUnique(unique) return a } // Unique uniques the array, clear repeated items. func (a *SortedIntArray) Unique() *SortedIntArray { - a.mu.Lock() - defer a.mu.Unlock() - if len(a.array) == 0 { - return a - } - for i := 0; i < len(a.array)-1; { - if a.getComparator()(a.array[i], a.array[i+1]) == 0 { - a.array = append(a.array[:i+1], a.array[i+2:]...) - } else { - i++ - } - } + a.lazyInit() + a.SortedTArray.Unique() return a } // Clone returns a new array, which is a copy of current array. func (a *SortedIntArray) Clone() (newArray *SortedIntArray) { - a.mu.RLock() - array := make([]int, len(a.array)) - copy(array, a.array) - a.mu.RUnlock() - return NewSortedIntArrayFrom(array, a.mu.IsSafe()) + a.lazyInit() + return &SortedIntArray{ + SortedTArray: a.SortedTArray.Clone(), + } } // Clear deletes all items of current array. func (a *SortedIntArray) Clear() *SortedIntArray { - a.mu.Lock() - if len(a.array) > 0 { - a.array = make([]int, 0) - } - a.mu.Unlock() + a.lazyInit() + a.SortedTArray.Clear() return a } // LockFunc locks writing by callback function `f`. func (a *SortedIntArray) LockFunc(f func(array []int)) *SortedIntArray { - a.mu.Lock() - defer a.mu.Unlock() - f(a.array) + a.lazyInit() + a.SortedTArray.LockFunc(f) return a } // RLockFunc locks reading by callback function `f`. func (a *SortedIntArray) RLockFunc(f func(array []int)) *SortedIntArray { - a.mu.RLock() - defer a.mu.RUnlock() - f(a.array) + a.lazyInit() + a.SortedTArray.RLockFunc(f) return a } @@ -546,6 +321,7 @@ func (a *SortedIntArray) RLockFunc(f func(array []int)) *SortedIntArray { // The difference between Merge and Append is Append supports only specified slice type, // but Merge supports more parameter types. func (a *SortedIntArray) Merge(array any) *SortedIntArray { + a.lazyInit() return a.Add(gconv.Ints(array)...) } @@ -553,104 +329,52 @@ func (a *SortedIntArray) Merge(array any) *SortedIntArray { // the size of each array is determined by `size`. // The last chunk may contain less than size elements. func (a *SortedIntArray) Chunk(size int) [][]int { - if size < 1 { - return nil - } - a.mu.RLock() - defer a.mu.RUnlock() - length := len(a.array) - chunks := int(math.Ceil(float64(length) / float64(size))) - var n [][]int - for i, end := 0, 0; chunks > 0; chunks-- { - end = (i + 1) * size - if end > length { - end = length - } - n = append(n, a.array[i*size:end]) - i++ - } - return n + a.lazyInit() + return a.SortedTArray.Chunk(size) } // Rand randomly returns one item from array(no deleting). func (a *SortedIntArray) Rand() (value int, found bool) { - a.mu.RLock() - defer a.mu.RUnlock() - if len(a.array) == 0 { - return 0, false - } - return a.array[grand.Intn(len(a.array))], true + a.lazyInit() + return a.SortedTArray.Rand() } // Rands randomly returns `size` items from array(no deleting). func (a *SortedIntArray) Rands(size int) []int { - a.mu.RLock() - defer a.mu.RUnlock() - if size <= 0 || len(a.array) == 0 { - return nil - } - array := make([]int, size) - for i := 0; i < size; i++ { - array[i] = a.array[grand.Intn(len(a.array))] - } - return array + a.lazyInit() + return a.SortedTArray.Rands(size) } // Join joins array elements with a string `glue`. func (a *SortedIntArray) Join(glue string) string { - a.mu.RLock() - defer a.mu.RUnlock() - if len(a.array) == 0 { - return "" - } - buffer := bytes.NewBuffer(nil) - for k, v := range a.array { - buffer.WriteString(gconv.String(v)) - if k != len(a.array)-1 { - buffer.WriteString(glue) - } - } - return buffer.String() + a.lazyInit() + return a.SortedTArray.Join(glue) } // CountValues counts the number of occurrences of all values in the array. func (a *SortedIntArray) CountValues() map[int]int { - m := make(map[int]int) - a.mu.RLock() - defer a.mu.RUnlock() - for _, v := range a.array { - m[v]++ - } - return m + a.lazyInit() + return a.SortedTArray.CountValues() } // Iterator is alias of IteratorAsc. func (a *SortedIntArray) Iterator(f func(k int, v int) bool) { - a.IteratorAsc(f) + a.lazyInit() + a.SortedTArray.Iterator(f) } // IteratorAsc iterates the array readonly in ascending order with given callback function `f`. // If `f` returns true, then it continues iterating; or false to stop. func (a *SortedIntArray) IteratorAsc(f func(k int, v int) bool) { - a.mu.RLock() - defer a.mu.RUnlock() - for k, v := range a.array { - if !f(k, v) { - break - } - } + a.lazyInit() + a.SortedTArray.IteratorAsc(f) } // IteratorDesc iterates the array readonly in descending order with given callback function `f`. // If `f` returns true, then it continues iterating; or false to stop. func (a *SortedIntArray) IteratorDesc(f func(k int, v int) bool) { - a.mu.RLock() - defer a.mu.RUnlock() - for i := len(a.array) - 1; i >= 0; i-- { - if !f(i, a.array[i]) { - break - } - } + a.lazyInit() + a.SortedTArray.IteratorDesc(f) } // String returns current array as a string, which implements like json.Marshal does. @@ -658,73 +382,64 @@ func (a *SortedIntArray) String() string { if a == nil { return "" } + a.lazyInit() return "[" + a.Join(",") + "]" } // MarshalJSON implements the interface MarshalJSON for json.Marshal. // Note that do not use pointer as its receiver here. func (a SortedIntArray) MarshalJSON() ([]byte, error) { - a.mu.RLock() - defer a.mu.RUnlock() - return json.Marshal(a.array) + a.lazyInit() + return a.SortedTArray.MarshalJSON() } // UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal. func (a *SortedIntArray) UnmarshalJSON(b []byte) error { - if a.comparator == nil { - a.array = make([]int, 0) + a.lazyInit() + if a.comparator == nil || a.sorter == nil { a.comparator = defaultComparatorInt + a.sorter = quickSortInt + a.array = make([]int, 0) } - a.mu.Lock() - defer a.mu.Unlock() - if err := json.UnmarshalUseNumber(b, &a.array); err != nil { - return err - } - if a.array != nil { - sort.Ints(a.array) - } - return nil + + return a.SortedTArray.UnmarshalJSON(b) } // UnmarshalValue is an interface implement which sets any type of value for array. func (a *SortedIntArray) UnmarshalValue(value any) (err error) { - if a.comparator == nil { + a.lazyInit() + if a.comparator == nil || a.sorter == nil { a.comparator = defaultComparatorInt + a.sorter = quickSortInt } - a.mu.Lock() - defer a.mu.Unlock() - switch value.(type) { - case string, []byte: - err = json.UnmarshalUseNumber(gconv.Bytes(value), &a.array) - default: - a.array = gconv.SliceInt(value) - } - if a.array != nil { - sort.Ints(a.array) - } - return err + + return a.SortedTArray.UnmarshalValue(value) } // Filter iterates array and filters elements using custom callback function. // It removes the element from array if callback function `filter` returns true, // it or else does nothing and continues iterating. func (a *SortedIntArray) Filter(filter func(index int, value int) bool) *SortedIntArray { - a.mu.Lock() - defer a.mu.Unlock() - for i := 0; i < len(a.array); { - if filter(i, a.array[i]) { - a.array = append(a.array[:i], a.array[i+1:]...) - } else { - i++ - } - } + a.lazyInit() + a.SortedTArray.Filter(filter) return a } // FilterEmpty removes all zero value of the array. func (a *SortedIntArray) FilterEmpty() *SortedIntArray { + a.lazyInit() a.mu.Lock() defer a.mu.Unlock() + + if len(a.array) == 0 { + return a + } + + if a.array[0] != 0 && a.array[len(a.array)-1] != 0 { + a.SortedTArray.FilterEmpty() + return a + } + for i := 0; i < len(a.array); { if a.array[i] == 0 { a.array = append(a.array[:i], a.array[i+1:]...) @@ -735,6 +450,7 @@ func (a *SortedIntArray) FilterEmpty() *SortedIntArray { for i := len(a.array) - 1; i >= 0; { if a.array[i] == 0 { a.array = append(a.array[:i], a.array[i+1:]...) + i-- } else { break } @@ -744,40 +460,21 @@ func (a *SortedIntArray) FilterEmpty() *SortedIntArray { // Walk applies a user supplied function `f` to every item of array. func (a *SortedIntArray) Walk(f func(value int) int) *SortedIntArray { - a.mu.Lock() - defer a.mu.Unlock() - - // Keep the array always sorted. - defer quickSortInt(a.array, a.getComparator()) - - for i, v := range a.array { - a.array[i] = f(v) - } + a.lazyInit() + a.SortedTArray.Walk(f) return a } // IsEmpty checks whether the array is empty. func (a *SortedIntArray) IsEmpty() bool { - return a.Len() == 0 -} - -// getComparator returns the comparator if it's previously set, -// or else it returns a default comparator. -func (a *SortedIntArray) getComparator() func(a, b int) int { - if a.comparator == nil { - return defaultComparatorInt - } - return a.comparator + a.lazyInit() + return a.SortedTArray.IsEmpty() } // DeepCopy implements interface for deep copy of current type. func (a *SortedIntArray) DeepCopy() any { - if a == nil { - return nil + a.lazyInit() + return &SortedIntArray{ + SortedTArray: a.SortedTArray.DeepCopy().(*SortedTArray[int]), } - a.mu.RLock() - defer a.mu.RUnlock() - newSlice := make([]int, len(a.array)) - copy(newSlice, a.array) - return NewSortedIntArrayFrom(newSlice, a.mu.IsSafe()) } diff --git a/container/garray/garray_sorted_str.go b/container/garray/garray_sorted_str.go index 6a50ae24c..e4d57188e 100644 --- a/container/garray/garray_sorted_str.go +++ b/container/garray/garray_sorted_str.go @@ -8,15 +8,11 @@ package garray import ( "bytes" - "math" - "sort" "strings" + "sync" - "github.com/gogf/gf/v2/internal/json" - "github.com/gogf/gf/v2/internal/rwmutex" "github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/util/gconv" - "github.com/gogf/gf/v2/util/grand" ) // SortedStrArray is a golang sorted string array with rich features. @@ -25,10 +21,18 @@ import ( // It contains a concurrent-safe/unsafe switch, which should be set // when its initialization and cannot be changed then. type SortedStrArray struct { - mu rwmutex.RWMutex - array []string - unique bool // Whether enable unique feature(false) - comparator func(a, b string) int // Comparison function(it returns -1: a < b; 0: a == b; 1: a > b) + *SortedTArray[string] + once sync.Once +} + +// lazyInit lazily initializes the array. +func (a *SortedStrArray) lazyInit() { + a.once.Do(func() { + if a.SortedTArray == nil { + a.SortedTArray = NewSortedTArraySize(0, defaultComparatorStr, false) + a.SetSorter(quickSortStr) + } + }) } // NewSortedStrArray creates and returns an empty sorted array. @@ -50,10 +54,10 @@ func NewSortedStrArrayComparator(comparator func(a, b string) int, safe ...bool) // The parameter `safe` is used to specify whether using array in concurrent-safety, // which is false in default. func NewSortedStrArraySize(cap int, safe ...bool) *SortedStrArray { + a := NewSortedTArraySize(cap, defaultComparatorStr, safe...) + a.SetSorter(quickSortStr) return &SortedStrArray{ - mu: rwmutex.Create(safe...), - array: make([]string, 0, cap), - comparator: defaultComparatorStr, + SortedTArray: a, } } @@ -78,218 +82,112 @@ func NewSortedStrArrayFromCopy(array []string, safe ...bool) *SortedStrArray { // SetArray sets the underlying slice array with the given `array`. func (a *SortedStrArray) SetArray(array []string) *SortedStrArray { - a.mu.Lock() - defer a.mu.Unlock() - a.array = array - quickSortStr(a.array, a.getComparator()) + a.lazyInit() + a.SortedTArray.SetArray(array) return a } // At returns the value by the specified index. // If the given `index` is out of range of the array, it returns an empty string. func (a *SortedStrArray) At(index int) (value string) { - value, _ = a.Get(index) - return + a.lazyInit() + return a.SortedTArray.At(index) } // Sort sorts the array in increasing order. // The parameter `reverse` controls whether sort // in increasing order(default) or decreasing order. func (a *SortedStrArray) Sort() *SortedStrArray { - a.mu.Lock() - defer a.mu.Unlock() - quickSortStr(a.array, a.getComparator()) + a.lazyInit() + a.SortedTArray.Sort() return a } // Add adds one or multiple values to sorted array, the array always keeps sorted. // It's alias of function Append, see Append. func (a *SortedStrArray) Add(values ...string) *SortedStrArray { - return a.Append(values...) + a.lazyInit() + a.SortedTArray.Add(values...) + return a } // Append adds one or multiple values to sorted array, the array always keeps sorted. func (a *SortedStrArray) Append(values ...string) *SortedStrArray { - if len(values) == 0 { - return a - } - a.mu.Lock() - defer a.mu.Unlock() - for _, value := range values { - index, cmp := a.binSearch(value, false) - if a.unique && cmp == 0 { - continue - } - if index < 0 { - a.array = append(a.array, value) - continue - } - if cmp > 0 { - index++ - } - rear := append([]string{}, a.array[index:]...) - a.array = append(a.array[0:index], value) - a.array = append(a.array, rear...) - } + a.lazyInit() + a.SortedTArray.Append(values...) return a } // Get returns the value by the specified index. // If the given `index` is out of range of the array, the `found` is false. func (a *SortedStrArray) Get(index int) (value string, found bool) { - a.mu.RLock() - defer a.mu.RUnlock() - if index < 0 || index >= len(a.array) { - return "", false - } - return a.array[index], true + a.lazyInit() + return a.SortedTArray.Get(index) } // Remove removes an item by index. // If the given `index` is out of range of the array, the `found` is false. func (a *SortedStrArray) Remove(index int) (value string, found bool) { - a.mu.Lock() - defer a.mu.Unlock() - return a.doRemoveWithoutLock(index) -} - -// doRemoveWithoutLock removes an item by index without lock. -func (a *SortedStrArray) doRemoveWithoutLock(index int) (value string, found bool) { - if index < 0 || index >= len(a.array) { - return "", false - } - // Determine array boundaries when deleting to improve deletion efficiency. - if index == 0 { - value := a.array[0] - a.array = a.array[1:] - return value, true - } else if index == len(a.array)-1 { - value := a.array[index] - a.array = a.array[:index] - return value, true - } - // If it is a non-boundary delete, - // it will involve the creation of an array, - // then the deletion is less efficient. - value = a.array[index] - a.array = append(a.array[:index], a.array[index+1:]...) - return value, true + a.lazyInit() + return a.SortedTArray.Remove(index) } // RemoveValue removes an item by value. // It returns true if value is found in the array, or else false if not found. func (a *SortedStrArray) RemoveValue(value string) bool { - a.mu.Lock() - defer a.mu.Unlock() - if i, r := a.binSearch(value, false); r == 0 { - _, res := a.doRemoveWithoutLock(i) - return res - } - return false + a.lazyInit() + return a.SortedTArray.RemoveValue(value) } // RemoveValues removes an item by `values`. func (a *SortedStrArray) RemoveValues(values ...string) { - a.mu.Lock() - defer a.mu.Unlock() - for _, value := range values { - if i, r := a.binSearch(value, false); r == 0 { - a.doRemoveWithoutLock(i) - } - } + a.lazyInit() + a.SortedTArray.RemoveValues(values...) } // PopLeft pops and returns an item from the beginning of array. // Note that if the array is empty, the `found` is false. func (a *SortedStrArray) PopLeft() (value string, found bool) { - a.mu.Lock() - defer a.mu.Unlock() - if len(a.array) == 0 { - return "", false - } - value = a.array[0] - a.array = a.array[1:] - return value, true + a.lazyInit() + return a.SortedTArray.PopLeft() } // PopRight pops and returns an item from the end of array. // Note that if the array is empty, the `found` is false. func (a *SortedStrArray) PopRight() (value string, found bool) { - a.mu.Lock() - defer a.mu.Unlock() - index := len(a.array) - 1 - if index < 0 { - return "", false - } - value = a.array[index] - a.array = a.array[:index] - return value, true + a.lazyInit() + return a.SortedTArray.PopRight() } // PopRand randomly pops and return an item out of array. // Note that if the array is empty, the `found` is false. func (a *SortedStrArray) PopRand() (value string, found bool) { - a.mu.Lock() - defer a.mu.Unlock() - return a.doRemoveWithoutLock(grand.Intn(len(a.array))) + a.lazyInit() + return a.SortedTArray.PopRand() } // PopRands randomly pops and returns `size` items out of array. // If the given `size` is greater than size of the array, it returns all elements of the array. // Note that if given `size` <= 0 or the array is empty, it returns nil. func (a *SortedStrArray) PopRands(size int) []string { - a.mu.Lock() - defer a.mu.Unlock() - if size <= 0 || len(a.array) == 0 { - return nil - } - if size >= len(a.array) { - size = len(a.array) - } - array := make([]string, size) - for i := 0; i < size; i++ { - array[i], _ = a.doRemoveWithoutLock(grand.Intn(len(a.array))) - } - return array + a.lazyInit() + return a.SortedTArray.PopRands(size) } // PopLefts pops and returns `size` items from the beginning of array. // If the given `size` is greater than size of the array, it returns all elements of the array. // Note that if given `size` <= 0 or the array is empty, it returns nil. func (a *SortedStrArray) PopLefts(size int) []string { - a.mu.Lock() - defer a.mu.Unlock() - if size <= 0 || len(a.array) == 0 { - return nil - } - if size >= len(a.array) { - array := a.array - a.array = a.array[:0] - return array - } - value := a.array[0:size] - a.array = a.array[size:] - return value + a.lazyInit() + return a.SortedTArray.PopLefts(size) } // PopRights pops and returns `size` items from the end of array. // If the given `size` is greater than size of the array, it returns all elements of the array. // Note that if given `size` <= 0 or the array is empty, it returns nil. func (a *SortedStrArray) PopRights(size int) []string { - a.mu.Lock() - defer a.mu.Unlock() - if size <= 0 || len(a.array) == 0 { - return nil - } - index := len(a.array) - size - if index <= 0 { - array := a.array - a.array = a.array[:0] - return array - } - value := a.array[index:] - a.array = a.array[:index] - return value + a.lazyInit() + return a.SortedTArray.PopRights(size) } // Range picks and returns items by range, like array[start:end]. @@ -300,26 +198,8 @@ func (a *SortedStrArray) PopRights(size int) []string { // If `end` is omitted, then the sequence will have everything from start up // until the end of the array. func (a *SortedStrArray) Range(start int, end ...int) []string { - a.mu.RLock() - defer a.mu.RUnlock() - offsetEnd := len(a.array) - if len(end) > 0 && end[0] < offsetEnd { - offsetEnd = end[0] - } - if start > offsetEnd { - return nil - } - if start < 0 { - start = 0 - } - array := ([]string)(nil) - if a.mu.IsSafe() { - array = make([]string, offsetEnd-start) - copy(array, a.array[start:offsetEnd]) - } else { - array = a.array[start:offsetEnd] - } - return array + a.lazyInit() + return a.SortedTArray.Range(start, end...) } // SubSlice returns a slice of elements from the array as specified @@ -336,95 +216,46 @@ func (a *SortedStrArray) Range(start int, end ...int) []string { // // Any possibility crossing the left border of array, it will fail. func (a *SortedStrArray) SubSlice(offset int, length ...int) []string { - a.mu.RLock() - defer a.mu.RUnlock() - size := len(a.array) - if len(length) > 0 { - size = length[0] - } - if offset > len(a.array) { - return nil - } - if offset < 0 { - offset = len(a.array) + offset - if offset < 0 { - return nil - } - } - if size < 0 { - offset += size - size = -size - if offset < 0 { - return nil - } - } - end := offset + size - if end > len(a.array) { - end = len(a.array) - size = len(a.array) - offset - } - if a.mu.IsSafe() { - s := make([]string, size) - copy(s, a.array[offset:]) - return s - } else { - return a.array[offset:end] - } + a.lazyInit() + return a.SortedTArray.SubSlice(offset, length...) } // Sum returns the sum of values in an array. func (a *SortedStrArray) Sum() (sum int) { - a.mu.RLock() - defer a.mu.RUnlock() - for _, v := range a.array { - sum += gconv.Int(v) - } - return + a.lazyInit() + return a.SortedTArray.Sum() } // Len returns the length of array. func (a *SortedStrArray) Len() int { - a.mu.RLock() - length := len(a.array) - a.mu.RUnlock() - return length + a.lazyInit() + return a.SortedTArray.Len() } // Slice returns the underlying data of array. // Note that, if it's in concurrent-safe usage, it returns a copy of underlying data, // or else a pointer to the underlying data. func (a *SortedStrArray) Slice() []string { - array := ([]string)(nil) - if a.mu.IsSafe() { - a.mu.RLock() - defer a.mu.RUnlock() - array = make([]string, len(a.array)) - copy(array, a.array) - } else { - array = a.array - } - return array + a.lazyInit() + return a.SortedTArray.Slice() } // Interfaces returns current array as []any. func (a *SortedStrArray) Interfaces() []any { - a.mu.RLock() - defer a.mu.RUnlock() - array := make([]any, len(a.array)) - for k, v := range a.array { - array[k] = v - } - return array + a.lazyInit() + return a.SortedTArray.Interfaces() } // Contains checks whether a value exists in the array. func (a *SortedStrArray) Contains(value string) bool { - return a.Search(value) != -1 + a.lazyInit() + return a.SortedTArray.Contains(value) } // ContainsI checks whether a value exists in the array with case-insensitively. // Note that it internally iterates the whole array to do the comparison with case-insensitively. func (a *SortedStrArray) ContainsI(value string) bool { + a.lazyInit() a.mu.RLock() defer a.mu.RUnlock() if len(a.array) == 0 { @@ -441,105 +272,52 @@ func (a *SortedStrArray) ContainsI(value string) bool { // Search searches array by `value`, returns the index of `value`, // or returns -1 if not exists. func (a *SortedStrArray) Search(value string) (index int) { - if i, r := a.binSearch(value, true); r == 0 { - return i - } - return -1 -} - -// Binary search. -// It returns the last compared index and the result. -// If `result` equals to 0, it means the value at `index` is equals to `value`. -// If `result` lesser than 0, it means the value at `index` is lesser than `value`. -// If `result` greater than 0, it means the value at `index` is greater than `value`. -func (a *SortedStrArray) binSearch(value string, lock bool) (index int, result int) { - if lock { - a.mu.RLock() - defer a.mu.RUnlock() - } - if len(a.array) == 0 { - return -1, -2 - } - min := 0 - max := len(a.array) - 1 - mid := 0 - cmp := -2 - for min <= max { - mid = min + int((max-min)/2) - cmp = a.getComparator()(value, a.array[mid]) - switch { - case cmp < 0: - max = mid - 1 - case cmp > 0: - min = mid + 1 - default: - return mid, cmp - } - } - return mid, cmp + a.lazyInit() + return a.SortedTArray.Search(value) } // SetUnique sets unique mark to the array, // which means it does not contain any repeated items. // It also do unique check, remove all repeated items. func (a *SortedStrArray) SetUnique(unique bool) *SortedStrArray { - oldUnique := a.unique - a.unique = unique - if unique && oldUnique != unique { - a.Unique() - } + a.lazyInit() + a.SortedTArray.SetUnique(unique) return a } // Unique uniques the array, clear repeated items. func (a *SortedStrArray) Unique() *SortedStrArray { - a.mu.Lock() - defer a.mu.Unlock() - if len(a.array) == 0 { - return a - } - for i := 0; i < len(a.array)-1; { - if a.getComparator()(a.array[i], a.array[i+1]) == 0 { - a.array = append(a.array[:i+1], a.array[i+2:]...) - } else { - i++ - } - } + a.lazyInit() + a.SortedTArray.Unique() return a } // Clone returns a new array, which is a copy of current array. func (a *SortedStrArray) Clone() (newArray *SortedStrArray) { - a.mu.RLock() - array := make([]string, len(a.array)) - copy(array, a.array) - a.mu.RUnlock() - return NewSortedStrArrayFrom(array, a.mu.IsSafe()) + a.lazyInit() + return &SortedStrArray{ + SortedTArray: a.SortedTArray.Clone(), + } } // Clear deletes all items of current array. func (a *SortedStrArray) Clear() *SortedStrArray { - a.mu.Lock() - if len(a.array) > 0 { - a.array = make([]string, 0) - } - a.mu.Unlock() + a.lazyInit() + a.SortedTArray.Clear() return a } // LockFunc locks writing by callback function `f`. func (a *SortedStrArray) LockFunc(f func(array []string)) *SortedStrArray { - a.mu.Lock() - defer a.mu.Unlock() - f(a.array) + a.lazyInit() + a.SortedTArray.LockFunc(f) return a } // RLockFunc locks reading by callback function `f`. func (a *SortedStrArray) RLockFunc(f func(array []string)) *SortedStrArray { - a.mu.RLock() - defer a.mu.RUnlock() - f(a.array) + a.lazyInit() + a.SortedTArray.RLockFunc(f) return a } @@ -548,6 +326,7 @@ func (a *SortedStrArray) RLockFunc(f func(array []string)) *SortedStrArray { // The difference between Merge and Append is Append supports only specified slice type, // but Merge supports more parameter types. func (a *SortedStrArray) Merge(array any) *SortedStrArray { + a.lazyInit() return a.Add(gconv.Strings(array)...) } @@ -555,104 +334,52 @@ func (a *SortedStrArray) Merge(array any) *SortedStrArray { // the size of each array is determined by `size`. // The last chunk may contain less than size elements. func (a *SortedStrArray) Chunk(size int) [][]string { - if size < 1 { - return nil - } - a.mu.RLock() - defer a.mu.RUnlock() - length := len(a.array) - chunks := int(math.Ceil(float64(length) / float64(size))) - var n [][]string - for i, end := 0, 0; chunks > 0; chunks-- { - end = (i + 1) * size - if end > length { - end = length - } - n = append(n, a.array[i*size:end]) - i++ - } - return n + a.lazyInit() + return a.SortedTArray.Chunk(size) } // Rand randomly returns one item from array(no deleting). func (a *SortedStrArray) Rand() (value string, found bool) { - a.mu.RLock() - defer a.mu.RUnlock() - if len(a.array) == 0 { - return "", false - } - return a.array[grand.Intn(len(a.array))], true + a.lazyInit() + return a.SortedTArray.Rand() } // Rands randomly returns `size` items from array(no deleting). func (a *SortedStrArray) Rands(size int) []string { - a.mu.RLock() - defer a.mu.RUnlock() - if size <= 0 || len(a.array) == 0 { - return nil - } - array := make([]string, size) - for i := 0; i < size; i++ { - array[i] = a.array[grand.Intn(len(a.array))] - } - return array + a.lazyInit() + return a.SortedTArray.Rands(size) } // Join joins array elements with a string `glue`. func (a *SortedStrArray) Join(glue string) string { - a.mu.RLock() - defer a.mu.RUnlock() - if len(a.array) == 0 { - return "" - } - buffer := bytes.NewBuffer(nil) - for k, v := range a.array { - buffer.WriteString(v) - if k != len(a.array)-1 { - buffer.WriteString(glue) - } - } - return buffer.String() + a.lazyInit() + return a.SortedTArray.Join(glue) } // CountValues counts the number of occurrences of all values in the array. func (a *SortedStrArray) CountValues() map[string]int { - m := make(map[string]int) - a.mu.RLock() - defer a.mu.RUnlock() - for _, v := range a.array { - m[v]++ - } - return m + a.lazyInit() + return a.SortedTArray.CountValues() } // Iterator is alias of IteratorAsc. func (a *SortedStrArray) Iterator(f func(k int, v string) bool) { - a.IteratorAsc(f) + a.lazyInit() + a.SortedTArray.Iterator(f) } // IteratorAsc iterates the array readonly in ascending order with given callback function `f`. // If `f` returns true, then it continues iterating; or false to stop. func (a *SortedStrArray) IteratorAsc(f func(k int, v string) bool) { - a.mu.RLock() - defer a.mu.RUnlock() - for k, v := range a.array { - if !f(k, v) { - break - } - } + a.lazyInit() + a.SortedTArray.IteratorAsc(f) } // IteratorDesc iterates the array readonly in descending order with given callback function `f`. // If `f` returns true, then it continues iterating; or false to stop. func (a *SortedStrArray) IteratorDesc(f func(k int, v string) bool) { - a.mu.RLock() - defer a.mu.RUnlock() - for i := len(a.array) - 1; i >= 0; i-- { - if !f(i, a.array[i]) { - break - } - } + a.lazyInit() + a.SortedTArray.IteratorDesc(f) } // String returns current array as a string, which implements like json.Marshal does. @@ -660,6 +387,7 @@ func (a *SortedStrArray) String() string { if a == nil { return "" } + a.lazyInit() a.mu.RLock() defer a.mu.RUnlock() buffer := bytes.NewBuffer(nil) @@ -677,67 +405,56 @@ func (a *SortedStrArray) String() string { // MarshalJSON implements the interface MarshalJSON for json.Marshal. // Note that do not use pointer as its receiver here. func (a SortedStrArray) MarshalJSON() ([]byte, error) { - a.mu.RLock() - defer a.mu.RUnlock() - return json.Marshal(a.array) + a.lazyInit() + return a.SortedTArray.MarshalJSON() } // UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal. func (a *SortedStrArray) UnmarshalJSON(b []byte) error { - if a.comparator == nil { - a.array = make([]string, 0) + a.lazyInit() + if a.comparator == nil || a.sorter == nil { a.comparator = defaultComparatorStr + a.sorter = quickSortStr + a.array = make([]string, 0) } - a.mu.Lock() - defer a.mu.Unlock() - if err := json.UnmarshalUseNumber(b, &a.array); err != nil { - return err - } - if a.array != nil { - sort.Strings(a.array) - } - return nil + return a.SortedTArray.UnmarshalJSON(b) } // UnmarshalValue is an interface implement which sets any type of value for array. func (a *SortedStrArray) UnmarshalValue(value any) (err error) { - if a.comparator == nil { + a.lazyInit() + if a.comparator == nil || a.sorter == nil { a.comparator = defaultComparatorStr + a.sorter = quickSortStr } - a.mu.Lock() - defer a.mu.Unlock() - switch value.(type) { - case string, []byte: - err = json.UnmarshalUseNumber(gconv.Bytes(value), &a.array) - default: - a.array = gconv.SliceStr(value) - } - if a.array != nil { - sort.Strings(a.array) - } - return err + + return a.SortedTArray.UnmarshalValue(value) } // Filter iterates array and filters elements using custom callback function. // It removes the element from array if callback function `filter` returns true, // it or else does nothing and continues iterating. func (a *SortedStrArray) Filter(filter func(index int, value string) bool) *SortedStrArray { - a.mu.Lock() - defer a.mu.Unlock() - for i := 0; i < len(a.array); { - if filter(i, a.array[i]) { - a.array = append(a.array[:i], a.array[i+1:]...) - } else { - i++ - } - } + a.lazyInit() + a.SortedTArray.Filter(filter) return a } // FilterEmpty removes all empty string value of the array. func (a *SortedStrArray) FilterEmpty() *SortedStrArray { + a.lazyInit() a.mu.Lock() defer a.mu.Unlock() + + if len(a.array) == 0 { + return a + } + + if a.array[0] != "" && a.array[len(a.array)-1] != "" { + a.SortedTArray.FilterEmpty() + return a + } + for i := 0; i < len(a.array); { if a.array[i] == "" { a.array = append(a.array[:i], a.array[i+1:]...) @@ -748,6 +465,7 @@ func (a *SortedStrArray) FilterEmpty() *SortedStrArray { for i := len(a.array) - 1; i >= 0; { if a.array[i] == "" { a.array = append(a.array[:i], a.array[i+1:]...) + i-- } else { break } @@ -757,40 +475,21 @@ func (a *SortedStrArray) FilterEmpty() *SortedStrArray { // Walk applies a user supplied function `f` to every item of array. func (a *SortedStrArray) Walk(f func(value string) string) *SortedStrArray { - a.mu.Lock() - defer a.mu.Unlock() - - // Keep the array always sorted. - defer quickSortStr(a.array, a.getComparator()) - - for i, v := range a.array { - a.array[i] = f(v) - } + a.lazyInit() + a.SortedTArray.Walk(f) return a } // IsEmpty checks whether the array is empty. func (a *SortedStrArray) IsEmpty() bool { - return a.Len() == 0 -} - -// getComparator returns the comparator if it's previously set, -// or else it returns a default comparator. -func (a *SortedStrArray) getComparator() func(a, b string) int { - if a.comparator == nil { - return defaultComparatorStr - } - return a.comparator + a.lazyInit() + return a.SortedTArray.IsEmpty() } // DeepCopy implements interface for deep copy of current type. func (a *SortedStrArray) DeepCopy() any { - if a == nil { - return nil + a.lazyInit() + return &SortedStrArray{ + SortedTArray: a.SortedTArray.DeepCopy().(*SortedTArray[string]), } - a.mu.RLock() - defer a.mu.RUnlock() - newSlice := make([]string, len(a.array)) - copy(newSlice, a.array) - return NewSortedStrArrayFrom(newSlice, a.mu.IsSafe()) } diff --git a/container/garray/garray_sorted_t.go b/container/garray/garray_sorted_t.go new file mode 100644 index 000000000..25d62f2ff --- /dev/null +++ b/container/garray/garray_sorted_t.go @@ -0,0 +1,852 @@ +// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://github.com/gogf/gf. + +package garray + +import ( + "bytes" + "math" + + "github.com/gogf/gf/v2/internal/deepcopy" + "github.com/gogf/gf/v2/internal/empty" + "github.com/gogf/gf/v2/internal/json" + "github.com/gogf/gf/v2/internal/rwmutex" + "github.com/gogf/gf/v2/text/gstr" + "github.com/gogf/gf/v2/util/gconv" + "github.com/gogf/gf/v2/util/grand" + "github.com/gogf/gf/v2/util/gutil" +) + +// SortedTArray is a golang sorted array with rich features. +// It is using increasing order in default, which can be changed by +// setting it a custom comparator. +// It contains a concurrent-safe/unsafe switch, which should be set +// when its initialization and cannot be changed then. +type SortedTArray[T comparable] struct { + mu rwmutex.RWMutex + array []T + unique bool // Whether enable unique feature(false) + comparator func(a, b T) int // Comparison function(it returns -1: a < b; 0: a == b; 1: a > b) + sorter func(values []T, comparator func(a, b T) int) +} + +// NewSortedTArray creates and returns an empty sorted array. +// The parameter `safe` is used to specify whether using array in concurrent-safety, which is false in default. +// The parameter `comparator` used to compare values to sort in array, +// if it returns value < 0, means `a` < `b`; the `a` will be inserted before `b`; +// if it returns value = 0, means `a` = `b`; the `a` will be replaced by `b`; +// if it returns value > 0, means `a` > `b`; the `a` will be inserted after `b`; +func NewSortedTArray[T comparable](comparator func(a, b T) int, safe ...bool) *SortedTArray[T] { + if comparator == nil { + comparator = gutil.ComparatorTStr + } + return NewSortedTArraySize(0, comparator, safe...) +} + +// NewSortedTArraySize create and returns an sorted array with given size and cap. +// The parameter `safe` is used to specify whether using array in concurrent-safety, +// which is false in default. +func NewSortedTArraySize[T comparable](cap int, comparator func(a, b T) int, safe ...bool) *SortedTArray[T] { + if comparator == nil { + comparator = gutil.ComparatorTStr + } + return &SortedTArray[T]{ + mu: rwmutex.Create(safe...), + array: make([]T, 0, cap), + comparator: comparator, + sorter: nil, + } +} + +// NewSortedTArrayFrom creates and returns an sorted array with given slice `array`. +// The parameter `safe` is used to specify whether using array in concurrent-safety, +// which is false in default. +func NewSortedTArrayFrom[T comparable](array []T, comparator func(a, b T) int, safe ...bool) *SortedTArray[T] { + if comparator == nil { + comparator = gutil.ComparatorTStr + } + a := NewSortedTArraySize(0, comparator, safe...) + a.array = array + a.getSorter()(a.array, a.getComparator()) + return a +} + +// NewSortedTArrayFromCopy creates and returns an sorted array from a copy of given slice `array`. +// The parameter `safe` is used to specify whether using array in concurrent-safety, +// which is false in default. +func NewSortedTArrayFromCopy[T comparable](array []T, comparator func(a, b T) int, safe ...bool) *SortedTArray[T] { + if comparator == nil { + comparator = gutil.ComparatorTStr + } + newArray := make([]T, len(array)) + copy(newArray, array) + return NewSortedTArrayFrom(newArray, comparator, safe...) +} + +func (a *SortedTArray[T]) getSorter() func(values []T, comparator func(a, b T) int) { + if a.sorter == nil { + return defaultSorter + } else { + return a.sorter + } +} + +// At returns the value by the specified index. +// If the given `index` is out of range of the array, it returns the zero value of type `T` +func (a *SortedTArray[T]) At(index int) (value T) { + value, _ = a.Get(index) + return +} + +// SetArray sets the underlying slice array with the given `array`. +func (a *SortedTArray[T]) SetArray(array []T) *SortedTArray[T] { + a.mu.Lock() + defer a.mu.Unlock() + a.array = array + a.getSorter()(a.array, a.getComparator()) + + return a +} + +// SetSorter sets/changes the sorter for sorting. +func (a *SortedTArray[T]) SetSorter(sorter func(values []T, comparator func(a, b T) int)) { + if sorter == nil { + a.sorter = defaultSorter + } else { + a.sorter = sorter + } + a.sorter(a.array, a.getComparator()) +} + +// SetComparator sets/changes the comparator for sorting. +// It resorts the array as the comparator is changed. +func (a *SortedTArray[T]) SetComparator(comparator func(a, b T) int) { + a.mu.Lock() + defer a.mu.Unlock() + if comparator == nil { + comparator = gutil.ComparatorTStr + } + a.comparator = comparator + a.getSorter()(a.array, comparator) +} + +// Sort sorts the array in increasing order. +// The parameter `reverse` controls whether sort +// in increasing order(default) or decreasing order +func (a *SortedTArray[T]) Sort() *SortedTArray[T] { + a.mu.Lock() + defer a.mu.Unlock() + + a.getSorter()(a.array, a.getComparator()) + + return a +} + +// Add adds one or multiple values to sorted array, the array always keeps sorted. +// It's alias of function Append, see Append. +func (a *SortedTArray[T]) Add(values ...T) *SortedTArray[T] { + return a.Append(values...) +} + +// Append adds one or multiple values to sorted array, the array always keeps sorted. +func (a *SortedTArray[T]) Append(values ...T) *SortedTArray[T] { + if len(values) == 0 { + return a + } + a.mu.Lock() + defer a.mu.Unlock() + for _, value := range values { + index, cmp := a.binSearch(value, false) + if a.unique && cmp == 0 { + continue + } + if index < 0 { + a.array = append(a.array, value) + continue + } + if cmp > 0 { + index++ + } + a.array = append(a.array[:index], append([]T{value}, a.array[index:]...)...) + } + return a +} + +// Get returns the value by the specified index. +// If the given `index` is out of range of the array, the `found` is false. +func (a *SortedTArray[T]) Get(index int) (value T, found bool) { + a.mu.RLock() + defer a.mu.RUnlock() + if index < 0 || index >= len(a.array) { + found = false + return + } + return a.array[index], true +} + +// Remove removes an item by index. +// If the given `index` is out of range of the array, the `found` is false. +func (a *SortedTArray[T]) Remove(index int) (value T, found bool) { + a.mu.Lock() + defer a.mu.Unlock() + return a.doRemoveWithoutLock(index) +} + +// doRemoveWithoutLock removes an item by index without lock. +func (a *SortedTArray[T]) doRemoveWithoutLock(index int) (value T, found bool) { + if index < 0 || index >= len(a.array) { + found = false + return + } + // Determine array boundaries when deleting to improve deletion efficiency. + if index == 0 { + value := a.array[0] + a.array = a.array[1:] + return value, true + } else if index == len(a.array)-1 { + value := a.array[index] + a.array = a.array[:index] + return value, true + } + // If it is a non-boundary delete, + // it will involve the creation of an array, + // then the deletion is less efficient. + value = a.array[index] + a.array = append(a.array[:index], a.array[index+1:]...) + return value, true +} + +// RemoveValue removes an item by value. +// It returns true if value is found in the array, or else false if not found. +func (a *SortedTArray[T]) RemoveValue(value T) bool { + a.mu.Lock() + defer a.mu.Unlock() + if i, r := a.binSearch(value, false); r == 0 { + _, res := a.doRemoveWithoutLock(i) + return res + } + return false +} + +// RemoveValues removes an item by `values`. +func (a *SortedTArray[T]) RemoveValues(values ...T) { + a.mu.Lock() + defer a.mu.Unlock() + for _, value := range values { + if i, r := a.binSearch(value, false); r == 0 { + a.doRemoveWithoutLock(i) + } + } +} + +// PopLeft pops and returns an item from the beginning of array. +// Note that if the array is empty, the `found` is false. +func (a *SortedTArray[T]) PopLeft() (value T, found bool) { + a.mu.Lock() + defer a.mu.Unlock() + if len(a.array) == 0 { + found = false + return + } + value = a.array[0] + a.array = a.array[1:] + return value, true +} + +// PopRight pops and returns an item from the end of array. +// Note that if the array is empty, the `found` is false. +func (a *SortedTArray[T]) PopRight() (value T, found bool) { + a.mu.Lock() + defer a.mu.Unlock() + index := len(a.array) - 1 + if index < 0 { + found = false + return + } + value = a.array[index] + a.array = a.array[:index] + return value, true +} + +// PopRand randomly pops and return an item out of array. +// Note that if the array is empty, the `found` is false. +func (a *SortedTArray[T]) PopRand() (value T, found bool) { + a.mu.Lock() + defer a.mu.Unlock() + return a.doRemoveWithoutLock(grand.Intn(len(a.array))) +} + +// PopRands randomly pops and returns `size` items out of array. +func (a *SortedTArray[T]) PopRands(size int) []T { + a.mu.Lock() + defer a.mu.Unlock() + if size <= 0 || len(a.array) == 0 { + return nil + } + if size >= len(a.array) { + size = len(a.array) + } + array := make([]T, size) + for i := 0; i < size; i++ { + array[i], _ = a.doRemoveWithoutLock(grand.Intn(len(a.array))) + } + return array +} + +// PopLefts pops and returns `size` items from the beginning of array. +func (a *SortedTArray[T]) PopLefts(size int) []T { + a.mu.Lock() + defer a.mu.Unlock() + if size <= 0 || len(a.array) == 0 { + return nil + } + if size >= len(a.array) { + array := a.array + a.array = a.array[:0] + return array + } + value := a.array[0:size] + a.array = a.array[size:] + return value +} + +// PopRights pops and returns `size` items from the end of array. +func (a *SortedTArray[T]) PopRights(size int) []T { + a.mu.Lock() + defer a.mu.Unlock() + if size <= 0 || len(a.array) == 0 { + return nil + } + index := len(a.array) - size + if index <= 0 { + array := a.array + a.array = a.array[:0] + return array + } + value := a.array[index:] + a.array = a.array[:index] + return value +} + +// Range picks and returns items by range, like array[start:end]. +// Notice, if in concurrent-safe usage, it returns a copy of slice; +// else a pointer to the underlying data. +// +// If `end` is negative, then the offset will start from the end of array. +// If `end` is omitted, then the sequence will have everything from start up +// until the end of the array. +func (a *SortedTArray[T]) Range(start int, end ...int) []T { + a.mu.RLock() + defer a.mu.RUnlock() + offsetEnd := len(a.array) + if len(end) > 0 && end[0] < offsetEnd { + offsetEnd = end[0] + } + if start > offsetEnd { + return nil + } + if start < 0 { + start = 0 + } + array := ([]T)(nil) + if a.mu.IsSafe() { + array = make([]T, offsetEnd-start) + copy(array, a.array[start:offsetEnd]) + } else { + array = a.array[start:offsetEnd] + } + return array +} + +// SubSlice returns a slice of elements from the array as specified +// by the `offset` and `size` parameters. +// If in concurrent safe usage, it returns a copy of the slice; else a pointer. +// +// If offset is non-negative, the sequence will start at that offset in the array. +// If offset is negative, the sequence will start that far from the end of the array. +// +// If length is given and is positive, then the sequence will have up to that many elements in it. +// If the array is shorter than the length, then only the available array elements will be present. +// If length is given and is negative then the sequence will stop that many elements from the end of the array. +// If it is omitted, then the sequence will have everything from offset up until the end of the array. +// +// Any possibility crossing the left border of array, it will fail. +func (a *SortedTArray[T]) SubSlice(offset int, length ...int) []T { + a.mu.RLock() + defer a.mu.RUnlock() + size := len(a.array) + if len(length) > 0 { + size = length[0] + } + if offset > len(a.array) { + return nil + } + if offset < 0 { + offset = len(a.array) + offset + if offset < 0 { + return nil + } + } + if size < 0 { + offset += size + size = -size + if offset < 0 { + return nil + } + } + end := offset + size + if end > len(a.array) { + end = len(a.array) + size = len(a.array) - offset + } + if a.mu.IsSafe() { + s := make([]T, size) + copy(s, a.array[offset:]) + return s + } else { + return a.array[offset:end] + } +} + +// Sum returns the sum of values in an array. +func (a *SortedTArray[T]) Sum() (sum int) { + a.mu.RLock() + defer a.mu.RUnlock() + for _, v := range a.array { + sum += gconv.Int(v) + } + return +} + +// Len returns the length of array. +func (a *SortedTArray[T]) Len() int { + a.mu.RLock() + length := len(a.array) + a.mu.RUnlock() + return length +} + +// Slice returns the underlying data of array. +// Note that, if it's in concurrent-safe usage, it returns a copy of underlying data, +// or else a pointer to the underlying data. +func (a *SortedTArray[T]) Slice() []T { + var array []T + if a.mu.IsSafe() { + a.mu.RLock() + defer a.mu.RUnlock() + array = make([]T, len(a.array)) + copy(array, a.array) + } else { + array = a.array + } + return array +} + +// Interfaces returns current array as []any. +func (a *SortedTArray[T]) Interfaces() []any { + return tToAnySlice(a.Slice()) +} + +// Contains checks whether a value exists in the array. +func (a *SortedTArray[T]) Contains(value T) bool { + return a.Search(value) != -1 +} + +// Search searches array by `value`, returns the index of `value`, +// or returns -1 if not exists. +func (a *SortedTArray[T]) Search(value T) (index int) { + if i, r := a.binSearch(value, true); r == 0 { + return i + } + return -1 +} + +// Binary search. +// It returns the last compared index and the result. +// If `result` equals to 0, it means the value at `index` is equals to `value`. +// If `result` lesser than 0, it means the value at `index` is lesser than `value`. +// If `result` greater than 0, it means the value at `index` is greater than `value`. +func (a *SortedTArray[T]) binSearch(value T, lock bool) (index int, result int) { + if lock { + a.mu.RLock() + defer a.mu.RUnlock() + } + if len(a.array) == 0 { + return -1, -2 + } + min := 0 + max := len(a.array) - 1 + mid := 0 + cmp := -2 + for min <= max { + mid = min + (max-min)/2 + cmp = a.getComparator()(value, a.array[mid]) + switch { + case cmp < 0: + max = mid - 1 + case cmp > 0: + min = mid + 1 + default: + return mid, cmp + } + } + return mid, cmp +} + +// SetUnique sets unique mark to the array, +// which means it does not contain any repeated items. +// It also does unique check, remove all repeated items. +func (a *SortedTArray[T]) SetUnique(unique bool) *SortedTArray[T] { + oldUnique := a.unique + a.unique = unique + if unique && oldUnique != unique { + a.Unique() + } + return a +} + +// Unique uniques the array, clear repeated items. +func (a *SortedTArray[T]) Unique() *SortedTArray[T] { + a.mu.Lock() + defer a.mu.Unlock() + if len(a.array) == 0 { + return a + } + for i := 0; i < len(a.array)-1; { + if a.getComparator()(a.array[i], a.array[i+1]) == 0 { + a.array = append(a.array[:i+1], a.array[i+2:]...) + } else { + i++ + } + } + return a +} + +// Clone returns a new array, which is a copy of current array. +func (a *SortedTArray[T]) Clone() (newArray *SortedTArray[T]) { + a.mu.RLock() + array := make([]T, len(a.array)) + copy(array, a.array) + a.mu.RUnlock() + return NewSortedTArrayFrom[T](array, a.comparator, a.mu.IsSafe()) +} + +// Clear deletes all items of current array. +func (a *SortedTArray[T]) Clear() *SortedTArray[T] { + a.mu.Lock() + if len(a.array) > 0 { + a.array = make([]T, 0) + } + a.mu.Unlock() + return a +} + +// LockFunc locks writing by callback function `f`. +func (a *SortedTArray[T]) LockFunc(f func(array []T)) *SortedTArray[T] { + a.mu.Lock() + defer a.mu.Unlock() + + // Keep the array always sorted. + defer a.getSorter()(a.array, a.getComparator()) + + f(a.array) + return a +} + +// RLockFunc locks reading by callback function `f`. +func (a *SortedTArray[T]) RLockFunc(f func(array []T)) *SortedTArray[T] { + a.mu.RLock() + defer a.mu.RUnlock() + f(a.array) + return a +} + +// Merge merges `array` into current array. +// The parameter `array` can be any garray or slice type. +// The difference between Merge and Append is Append supports only specified slice type, +// but Merge supports more parameter types. +func (a *SortedTArray[T]) Merge(array any) *SortedTArray[T] { + var vals []T + switch v := array.(type) { + case *SortedTArray[T]: + vals = v.Slice() + case *TArray[T]: + vals = v.Slice() + case []T: + vals = v + default: + interfaces := gconv.Interfaces(v) + if err := gconv.Scan(interfaces, &vals); err != nil { + panic(err) + } + } + + return a.Add(vals...) +} + +// Chunk splits an array into multiple arrays, +// the size of each array is determined by `size`. +// The last chunk may contain less than size elements. +func (a *SortedTArray[T]) Chunk(size int) [][]T { + if size < 1 { + return nil + } + a.mu.RLock() + defer a.mu.RUnlock() + length := len(a.array) + chunks := int(math.Ceil(float64(length) / float64(size))) + var n [][]T + for i, end := 0, 0; chunks > 0; chunks-- { + end = (i + 1) * size + if end > length { + end = length + } + n = append(n, a.array[i*size:end]) + i++ + } + return n +} + +// Rand randomly returns one item from array(no deleting). +func (a *SortedTArray[T]) Rand() (value T, found bool) { + a.mu.RLock() + defer a.mu.RUnlock() + if len(a.array) == 0 { + found = false + return + } + return a.array[grand.Intn(len(a.array))], true +} + +// Rands randomly returns `size` items from array(no deleting). +func (a *SortedTArray[T]) Rands(size int) []T { + a.mu.RLock() + defer a.mu.RUnlock() + if size <= 0 || len(a.array) == 0 { + return nil + } + array := make([]T, size) + for i := 0; i < size; i++ { + array[i] = a.array[grand.Intn(len(a.array))] + } + return array +} + +// Join joins array elements with a string `glue`. +func (a *SortedTArray[T]) Join(glue string) string { + a.mu.RLock() + defer a.mu.RUnlock() + if len(a.array) == 0 { + return "" + } + buffer := bytes.NewBuffer(nil) + for k, v := range a.array { + buffer.WriteString(gconv.String(v)) + if k != len(a.array)-1 { + buffer.WriteString(glue) + } + } + return buffer.String() +} + +// CountValues counts the number of occurrences of all values in the array. +func (a *SortedTArray[T]) CountValues() map[T]int { + m := make(map[T]int) + a.mu.RLock() + defer a.mu.RUnlock() + for _, v := range a.array { + m[v]++ + } + return m +} + +// Iterator is alias of IteratorAsc. +func (a *SortedTArray[T]) Iterator(f func(k int, v T) bool) { + a.IteratorAsc(f) +} + +// IteratorAsc iterates the array readonly in ascending order with given callback function `f`. +// If `f` returns true, then it continues iterating; or false to stop. +func (a *SortedTArray[T]) IteratorAsc(f func(k int, v T) bool) { + a.mu.RLock() + defer a.mu.RUnlock() + for k, v := range a.array { + if !f(k, v) { + break + } + } +} + +// IteratorDesc iterates the array readonly in descending order with given callback function `f`. +// If `f` returns true, then it continues iterating; or false to stop. +func (a *SortedTArray[T]) IteratorDesc(f func(k int, v T) bool) { + a.mu.RLock() + defer a.mu.RUnlock() + for i := len(a.array) - 1; i >= 0; i-- { + if !f(i, a.array[i]) { + break + } + } +} + +// String returns current array as a string, which implements like json.Marshal does. +func (a *SortedTArray[T]) String() string { + if a == nil { + return "" + } + a.mu.RLock() + defer a.mu.RUnlock() + buffer := bytes.NewBuffer(nil) + buffer.WriteByte('[') + s := "" + for k, v := range a.array { + s = gconv.String(v) + if gstr.IsNumeric(s) { + buffer.WriteString(s) + } else { + buffer.WriteString(`"` + gstr.QuoteMeta(s, `"\`) + `"`) + } + if k != len(a.array)-1 { + buffer.WriteByte(',') + } + } + buffer.WriteByte(']') + return buffer.String() +} + +// MarshalJSON implements the interface MarshalJSON for json.Marshal. +// Note that do not use pointer as its receiver here. +func (a SortedTArray[T]) MarshalJSON() ([]byte, error) { + a.mu.RLock() + defer a.mu.RUnlock() + return json.Marshal(a.array) +} + +// UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal. +// Note that the comparator is set as string comparator in default. +func (a *SortedTArray[T]) UnmarshalJSON(b []byte) error { + if a.comparator == nil { + a.array = make([]T, 0) + a.comparator = gutil.ComparatorTStr + } + a.mu.Lock() + defer a.mu.Unlock() + if err := json.UnmarshalUseNumber(b, &a.array); err != nil { + return err + } + if a.comparator != nil && a.array != nil { + a.getSorter()(a.array, a.comparator) + } + return nil +} + +// UnmarshalValue is an interface implement which sets any type of value for array. +// Note that the comparator is set as string comparator in default. +func (a *SortedTArray[T]) UnmarshalValue(value any) (err error) { + if a.comparator == nil { + a.comparator = gutil.ComparatorTStr + } + a.mu.Lock() + defer a.mu.Unlock() + switch value.(type) { + case string, []byte: + err = json.UnmarshalUseNumber(gconv.Bytes(value), &a.array) + default: + if err = gconv.Scan(value, &a.array); err != nil { + return + } + } + if a.comparator != nil && a.array != nil { + a.getSorter()(a.array, a.comparator) + } + return err +} + +// FilterNil removes all nil value of the array. +func (a *SortedTArray[T]) FilterNil() *SortedTArray[T] { + a.mu.Lock() + defer a.mu.Unlock() + for i := 0; i < len(a.array); { + if empty.IsNil(a.array[i]) { + a.array = append(a.array[:i], a.array[i+1:]...) + } else { + i++ + } + } + return a +} + +// Filter iterates array and filters elements using custom callback function. +// It removes the element from array if callback function `filter` returns true, +// it or else does nothing and continues iterating. +func (a *SortedTArray[T]) Filter(filter func(index int, value T) bool) *SortedTArray[T] { + a.mu.Lock() + defer a.mu.Unlock() + for i := 0; i < len(a.array); { + if filter(i, a.array[i]) { + a.array = append(a.array[:i], a.array[i+1:]...) + } else { + i++ + } + } + return a +} + +// FilterEmpty removes all empty value of the array. +// Values like: 0, nil, false, "", len(slice/map/chan) == 0 are considered empty. +func (a *SortedTArray[T]) FilterEmpty() *SortedTArray[T] { + a.mu.Lock() + defer a.mu.Unlock() + for i := 0; i < len(a.array); { + if empty.IsEmpty(a.array[i]) { + a.array = append(a.array[:i], a.array[i+1:]...) + } else { + i++ + } + } + return a +} + +// Walk applies a user supplied function `f` to every item of array. +func (a *SortedTArray[T]) Walk(f func(value T) T) *SortedTArray[T] { + a.mu.Lock() + defer a.mu.Unlock() + // Keep the array always sorted. + defer a.getSorter()(a.array, a.getComparator()) + + for i, v := range a.array { + a.array[i] = f(v) + } + return a +} + +// IsEmpty checks whether the array is empty. +func (a *SortedTArray[T]) IsEmpty() bool { + return a.Len() == 0 +} + +// getComparator returns the comparator if it's previously set, +// or else it panics. +func (a *SortedTArray[T]) getComparator() func(a, b T) int { + if a.comparator == nil { + a.comparator = gutil.ComparatorTStr + } + return a.comparator +} + +// DeepCopy implements interface for deep copy of current type. +func (a *SortedTArray[T]) DeepCopy() any { + if a == nil { + return nil + } + a.mu.RLock() + defer a.mu.RUnlock() + newSlice := make([]T, len(a.array)) + for i, v := range a.array { + newSlice[i], _ = deepcopy.Copy(v).(T) + } + return NewSortedTArrayFrom[T](newSlice, a.comparator, a.mu.IsSafe()) +} diff --git a/container/garray/garray_z_example_normal_t_test.go b/container/garray/garray_z_example_normal_t_test.go new file mode 100644 index 000000000..152935fe0 --- /dev/null +++ b/container/garray/garray_z_example_normal_t_test.go @@ -0,0 +1,1281 @@ +// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://github.com/gogf/gf. + +package garray_test + +import ( + "fmt" + "strings" + + "github.com/gogf/gf/v2/container/garray" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/internal/empty" + "github.com/gogf/gf/v2/internal/json" + "github.com/gogf/gf/v2/text/gstr" + "github.com/gogf/gf/v2/util/gconv" +) + +func ExampleTArray_Walk() { + { + var intArray garray.TArray[int] + intTables := g.SliceInt{10, 20} + intPrefix := 99 + intArray.Append(intTables...) + // Add prefix for given table names. + intArray.Walk(func(value int) int { + return intPrefix + value + }) + fmt.Println(intArray.Slice()) + } + + { + var strArray garray.TArray[string] + strTables := g.SliceStr{"user", "user_detail"} + strPrefix := "gf_" + strArray.Append(strTables...) + // Add prefix for given table names. + strArray.Walk(func(value string) string { + return strPrefix + value + }) + fmt.Println(strArray.Slice()) + } + + // Output: + // [109 119] + // [gf_user gf_user_detail] +} + +func ExampleNewTArray() { + { + intArr := garray.NewTArray[int]() + intArr.Append(10) + intArr.Append(20) + intArr.Append(15) + intArr.Append(30) + fmt.Println(intArr.Slice()) + } + + { + strArr := garray.NewTArray[string]() + strArr.Append("We") + strArr.Append("are") + strArr.Append("GF") + strArr.Append("fans") + fmt.Println(strArr.Slice()) + } + + // Output: + // [10 20 15 30] + // [We are GF fans] +} + +func ExampleNewTArraySize() { + { + intArr := garray.NewTArraySize[int](3, 5) + intArr.Set(0, 10) + intArr.Set(1, 20) + intArr.Set(2, 15) + intArr.Set(3, 30) + fmt.Println(intArr.Slice(), intArr.Len(), cap(intArr.Slice())) + } + + { + strArr := garray.NewTArraySize[string](3, 5) + strArr.Set(0, "We") + strArr.Set(1, "are") + strArr.Set(2, "GF") + strArr.Set(3, "fans") + fmt.Println(strArr.Slice(), strArr.Len(), cap(strArr.Slice())) + } + + // Output: + // [10 20 15] 3 5 + // [We are GF] 3 5 +} + +func ExampleNewTArrayFrom() { + { + intArr := garray.NewTArrayFrom[int](g.SliceInt{10, 20, 15, 30}) + fmt.Println(intArr.Slice(), intArr.Len(), cap(intArr.Slice())) + } + + { + strArr := garray.NewTArrayFrom[string](g.SliceStr{"We", "are", "GF", "fans", "!"}) + fmt.Println(strArr.Slice(), strArr.Len(), cap(strArr.Slice())) + } + + // Output: + // [10 20 15 30] 4 4 + // [We are GF fans !] 5 5 +} + +func ExampleNewTArrayFromCopy() { + { + intArr := garray.NewTArrayFromCopy(g.SliceInt{10, 20, 15, 30}) + fmt.Println(intArr.Slice(), intArr.Len(), cap(intArr.Slice())) + } + + { + strArr := garray.NewTArrayFromCopy(g.SliceStr{"a", "b", "c", "d", "e"}) + fmt.Println(strArr.Slice(), strArr.Len(), cap(strArr.Slice())) + } + + // Output: + // [10 20 15 30] 4 4 + // [a b c d e] 5 5 +} + +func ExampleTArray_At() { + { + intArr := garray.NewTArrayFrom[int](g.SliceInt{10, 20, 15, 30}) + isAt := intArr.At(2) + fmt.Println(isAt) + } + + { + strArr := garray.NewTArrayFrom[string](g.SliceStr{"We", "are", "GF", "fans", "!"}) + ssAt := strArr.At(2) + fmt.Println(ssAt) + } + + // Output: + // 15 + // GF +} + +func ExampleTArray_Get() { + { + s := garray.NewTArrayFrom[int](g.SliceInt{10, 20, 15, 30}) + sGet, sBool := s.Get(3) + fmt.Println(sGet, sBool) + sGet, sBool = s.Get(99) + fmt.Println(sGet, sBool) + } + { + s := garray.NewTArrayFrom[string](g.SliceStr{"We", "are", "GF", "fans", "!"}) + sGet, sBool := s.Get(3) + fmt.Println(sGet, sBool) + } + + // Output: + // 30 true + // 0 false + // fans true +} + +func ExampleTArray_Set() { + { + s := garray.NewTArraySize[int](3, 5) + s.Set(0, 10) + s.Set(1, 20) + s.Set(2, 15) + s.Set(3, 30) + fmt.Println(s.Slice()) + } + { + s := garray.NewTArraySize[string](3, 5) + s.Set(0, "We") + s.Set(1, "are") + s.Set(2, "GF") + s.Set(3, "fans") + fmt.Println(s.Slice()) + } + + // Output: + // [10 20 15] + // [We are GF] +} + +func ExampleTArray_SetArray() { + { + s := garray.NewTArray[int]() + s.SetArray(g.SliceInt{10, 20, 15, 30}) + fmt.Println(s.Slice()) + } + { + s := garray.NewTArray[string]() + s.SetArray(g.SliceStr{"We", "are", "GF", "fans", "!"}) + fmt.Println(s.Slice()) + } + + // Output: + // [10 20 15 30] + // [We are GF fans !] +} + +func ExampleTArray_Replace() { + { + s := garray.NewTArray[int]() + s.SetArray(g.SliceInt{10, 20, 15, 30}) + fmt.Println(s.Slice()) + s.Replace(g.SliceInt{12, 13}) + fmt.Println(s.Slice()) + } + { + s := garray.NewTArray[string]() + s.SetArray(g.SliceStr{"We", "are", "GF", "fans", "!"}) + fmt.Println(s.Slice()) + s.Replace(g.SliceStr{"Happy", "coding"}) + fmt.Println(s.Slice()) + } + + // Output: + // [10 20 15 30] + // [12 13 15 30] + // [We are GF fans !] + // [Happy coding GF fans !] +} + +func ExampleTArray_Sum() { + { + s := garray.NewTArray[int]() + s.SetArray(g.SliceInt{10, 20, 15, 30}) + a := s.Sum() + fmt.Println(a) + } + { + s := garray.NewTArray[string]() + s.SetArray(g.SliceStr{"3", "5", "10"}) + a := s.Sum() + fmt.Println(a) + } + // Output: + // 75 + // 18 +} + +func ExampleTArray_SortFunc() { + { + s := garray.NewTArrayFrom[int](g.SliceInt{10, 20, 15, 30}) + fmt.Println(s) + s.SortFunc(func(v1, v2 int) bool { + // fmt.Println(v1,v2) + return v1 > v2 + }) + fmt.Println(s) + s.SortFunc(func(v1, v2 int) bool { + return v1 < v2 + }) + fmt.Println(s) + } + + { + s := garray.NewTArrayFrom[string](g.SliceStr{"b", "c", "a"}) + fmt.Println(s) + s.SortFunc(func(v1, v2 string) bool { + return gstr.Compare(v1, v2) > 0 + }) + fmt.Println(s) + s.SortFunc(func(v1, v2 string) bool { + return gstr.Compare(v1, v2) < 0 + }) + fmt.Println(s) + } + + // Output: + // [10,20,15,30] + // [30,20,15,10] + // [10,15,20,30] + // ["b","c","a"] + // ["c","b","a"] + // ["a","b","c"] +} + +func ExampleTArray_InsertBefore() { + { + s := garray.NewTArray[int]() + s.SetArray(g.SliceInt{10, 20, 15, 30}) + s.InsertBefore(1, 99) + fmt.Println(s.Slice()) + } + { + s := garray.NewTArray[string]() + s.SetArray(g.SliceStr{"a", "b", "c", "d"}) + s.InsertBefore(1, "here") + fmt.Println(s.Slice()) + } + + // Output: + // [10 99 20 15 30] + // [a here b c d] +} + +func ExampleTArray_InsertAfter() { + { + s := garray.NewTArray[int]() + s.SetArray(g.SliceInt{10, 20, 15, 30}) + s.InsertAfter(1, 99) + fmt.Println(s.Slice()) + } + { + s := garray.NewTArray[string]() + s.SetArray(g.SliceStr{"a", "b", "c", "d"}) + s.InsertAfter(1, "here") + fmt.Println(s.Slice()) + } + // Output: + // [10 20 99 15 30] + // [a b here c d] +} + +func ExampleTArray_Remove() { + { + s := garray.NewTArray[int]() + s.SetArray(g.SliceInt{10, 20, 15, 30}) + fmt.Println(s) + s.Remove(1) + fmt.Println(s.Slice()) + } + { + s := garray.NewTArray[string]() + s.SetArray(g.SliceStr{"a", "b", "c", "d"}) + s.Remove(1) + fmt.Println(s.Slice()) + } + // Output: + // [10,20,15,30] + // [10 15 30] + // [a c d] +} + +func ExampleTArray_RemoveValue() { + { + s := garray.NewTArray[int]() + s.SetArray(g.SliceInt{10, 20, 15, 30}) + fmt.Println(s) + s.RemoveValue(20) + fmt.Println(s.Slice()) + } + + { + s := garray.NewTArray[string]() + s.SetArray(g.SliceStr{"a", "b", "c", "d"}) + s.RemoveValue("b") + fmt.Println(s.Slice()) + } + + // Output: + // [10,20,15,30] + // [10 15 30] + // [a c d] +} + +func ExampleTArray_PushLeft() { + { + s := garray.NewTArray[int]() + s.SetArray(g.SliceInt{10, 20, 15, 30}) + fmt.Println(s) + s.PushLeft(96, 97, 98, 99) + fmt.Println(s.Slice()) + } + { + s := garray.NewTArray[string]() + s.SetArray(g.SliceStr{"a", "b", "c", "d"}) + s.PushLeft("We", "are", "GF", "fans") + fmt.Println(s.Slice()) + } + + // Output: + // [10,20,15,30] + // [96 97 98 99 10 20 15 30] + // [We are GF fans a b c d] +} + +func ExampleTArray_PushRight() { + { + s := garray.NewTArray[int]() + s.SetArray(g.SliceInt{10, 20, 15, 30}) + fmt.Println(s) + s.PushRight(96, 97, 98, 99) + fmt.Println(s.Slice()) + } + { + s := garray.NewTArray[string]() + s.SetArray(g.SliceStr{"a", "b", "c", "d"}) + s.PushRight("We", "are", "GF", "fans") + fmt.Println(s.Slice()) + } + // Output: + // [10,20,15,30] + // [10 20 15 30 96 97 98 99] + // [a b c d We are GF fans] +} + +func ExampleTArray_PopLeft() { + { + s := garray.NewTArray[int]() + s.SetArray(g.SliceInt{10, 20, 15, 30}) + fmt.Println(s) + s.PopLeft() + fmt.Println(s.Slice()) + } + { + s := garray.NewTArray[string]() + s.SetArray(g.SliceStr{"a", "b", "c", "d"}) + s.PopLeft() + fmt.Println(s.Slice()) + } + // Output: + // [10,20,15,30] + // [20 15 30] + // [b c d] +} + +func ExampleTArray_PopRight() { + { + s := garray.NewTArray[int]() + s.SetArray(g.SliceInt{10, 20, 15, 30}) + fmt.Println(s) + s.PopRight() + fmt.Println(s.Slice()) + } + { + s := garray.NewTArray[string]() + s.SetArray(g.SliceStr{"a", "b", "c", "d"}) + s.PopRight() + fmt.Println(s.Slice()) + } + // Output: + // [10,20,15,30] + // [10 20 15] + // [a b c] +} + +func ExampleTArray_PopRand() { + { + s := garray.NewTArray[int]() + s.SetArray(g.SliceInt{10, 20, 15, 30, 40, 50, 60, 70}) + fmt.Println(s) + r, _ := s.PopRand() + fmt.Println(s) + fmt.Println(r) + } + { + s := garray.NewTArray[string]() + s.SetArray(g.SliceStr{"a", "b", "c", "d", "e", "f", "g", "h"}) + r, _ := s.PopRand() + fmt.Println(r) + } + + // May Output: + // [10,20,15,30,40,50,60,70] + // [10,20,15,30,40,60,70] + // 50 + // e +} + +func ExampleTArray_PopRands() { + { + s := garray.NewTArray[int]() + s.SetArray(g.SliceInt{10, 20, 15, 30, 40, 50, 60}) + fmt.Println(s) + r := s.PopRands(2) + fmt.Println(s) + fmt.Println(r) + } + { + s := garray.NewTArray[string]() + s.SetArray(g.SliceStr{"a", "b", "c", "d", "e", "f", "g", "h"}) + r := s.PopRands(2) + fmt.Println(r) + } + // May Output: + // [10,20,15,30,40,50,60] + // [10,20,15,30,40] + // [50 60] + // [e c] +} + +func ExampleTArray_PopLefts() { + { + s := garray.NewTArray[int]() + s.SetArray(g.SliceInt{10, 20, 15, 30, 40, 50, 60}) + fmt.Println(s) + r := s.PopLefts(2) + fmt.Println(s) + fmt.Println(r) + } + { + s := garray.NewTArray[string]() + s.SetArray(g.SliceStr{"a", "b", "c", "d", "e", "f", "g", "h"}) + r := s.PopLefts(2) + fmt.Println(r) + fmt.Println(s) + } + // Output: + // [10,20,15,30,40,50,60] + // [15,30,40,50,60] + // [10 20] + // [a b] + // ["c","d","e","f","g","h"] +} + +func ExampleTArray_PopRights() { + { + s := garray.NewTArray[int]() + s.SetArray(g.SliceInt{10, 20, 15, 30, 40, 50, 60}) + fmt.Println(s) + r := s.PopRights(2) + fmt.Println(s) + fmt.Println(r) + } + { + s := garray.NewTArray[string]() + s.SetArray(g.SliceStr{"a", "b", "c", "d", "e", "f", "g", "h"}) + r := s.PopRights(2) + fmt.Println(r) + fmt.Println(s) + } + + // Output: + // [10,20,15,30,40,50,60] + // [10,20,15,30,40] + // [50 60] + // [g h] + // ["a","b","c","d","e","f"] +} + +func ExampleTArray_Range() { + { + s := garray.NewTArray[int]() + s.SetArray(g.SliceInt{10, 20, 15, 30, 40, 50, 60}) + fmt.Println(s) + r := s.Range(2, 5) + fmt.Println(r) + } + { + s := garray.NewTArray[string]() + s.SetArray(g.SliceStr{"a", "b", "c", "d", "e", "f", "g", "h"}) + r := s.Range(2, 5) + fmt.Println(r) + } + // Output: + // [10,20,15,30,40,50,60] + // [15 30 40] + // [c d e] +} + +func ExampleTArray_SubSlice() { + { + s := garray.NewTArray[int]() + s.SetArray(g.SliceInt{10, 20, 15, 30, 40, 50, 60}) + fmt.Println(s) + r := s.SubSlice(3, 4) + fmt.Println(r) + } + { + s := garray.NewTArray[string]() + s.SetArray(g.SliceStr{"a", "b", "c", "d", "e", "f", "g", "h"}) + r := s.SubSlice(3, 4) + fmt.Println(r) + } + // Output: + // [10,20,15,30,40,50,60] + // [30 40 50 60] + // [d e f g] +} + +func ExampleTArray_Append() { + { + s := garray.NewTArray[int]() + s.SetArray(g.SliceInt{10, 20, 15, 30, 40, 50, 60}) + fmt.Println(s) + s.Append(96, 97, 98) + fmt.Println(s) + } + { + s := garray.NewTArray[string]() + s.SetArray(g.SliceStr{"We", "are", "GF", "fans"}) + s.Append("a", "b", "c") + fmt.Println(s) + } + // Output: + // [10,20,15,30,40,50,60] + // [10,20,15,30,40,50,60,96,97,98] + // ["We","are","GF","fans","a","b","c"] +} + +func ExampleTArray_Len() { + { + s := garray.NewTArray[int]() + s.SetArray(g.SliceInt{10, 20, 15, 30, 40, 50, 60}) + fmt.Println(s) + fmt.Println(s.Len()) + } + { + s := garray.NewTArray[string]() + s.SetArray(g.SliceStr{"a", "b", "c", "d", "e", "f", "g", "h"}) + fmt.Println(s.Len()) + } + // Output: + // [10,20,15,30,40,50,60] + // 7 + // 8 +} + +func ExampleTArray_Slice() { + { + s := garray.NewTArray[int]() + s.SetArray(g.SliceInt{10, 20, 15, 30, 40, 50, 60}) + fmt.Println(s.Slice()) + } + { + s := garray.NewTArray[string]() + s.SetArray(g.SliceStr{"a", "b", "c", "d", "e", "f", "g", "h"}) + fmt.Println(s.Slice()) + } + // Output: + // [10 20 15 30 40 50 60] + // [a b c d e f g h] +} + +func ExampleTArray_Interfaces() { + { + s := garray.NewTArray[int]() + s.SetArray(g.SliceInt{10, 20, 15, 30, 40, 50, 60}) + r := s.Interfaces() + fmt.Println(r) + } + { + s := garray.NewTArray[string]() + s.SetArray(g.SliceStr{"a", "b", "c", "d", "e", "f", "g", "h"}) + r := s.Interfaces() + fmt.Println(r) + } + // Output: + // [10 20 15 30 40 50 60] + // [a b c d e f g h] +} + +func ExampleTArray_Clone() { + { + s := garray.NewTArray[int]() + s.SetArray(g.SliceInt{10, 20, 15, 30, 40, 50, 60}) + fmt.Println(s) + r := s.Clone() + fmt.Println(r) + } + { + s := garray.NewTArray[string]() + s.SetArray(g.SliceStr{"a", "b", "c", "d", "e", "f", "g", "h"}) + r := s.Clone() + fmt.Println(r) + fmt.Println(s) + } + // Output: + // [10,20,15,30,40,50,60] + // [10,20,15,30,40,50,60] + // ["a","b","c","d","e","f","g","h"] + // ["a","b","c","d","e","f","g","h"] +} + +func ExampleTArray_Clear() { + { + s := garray.NewTArray[int]() + s.SetArray(g.SliceInt{10, 20, 15, 30, 40, 50, 60}) + fmt.Println(s) + fmt.Println(s.Clear()) + fmt.Println(s) + } + { + s := garray.NewTArray[string]() + s.SetArray(g.SliceStr{"a", "b", "c", "d", "e", "f", "g", "h"}) + fmt.Println(s) + fmt.Println(s.Clear()) + fmt.Println(s) + } + // Output: + // [10,20,15,30,40,50,60] + // [] + // [] + // ["a","b","c","d","e","f","g","h"] + // [] + // [] +} + +func ExampleTArray_Contains() { + { + s := garray.NewTArray[int]() + s.SetArray(g.SliceInt{10, 20, 15, 30, 40, 50, 60}) + fmt.Println(s.Contains(20)) + fmt.Println(s.Contains(21)) + } + { + s := garray.NewTArray[string]() + s.SetArray(g.SliceStr{"a", "b", "c", "d", "e", "f", "g", "h"}) + fmt.Println(s.Contains("e")) + fmt.Println(s.Contains("z")) + } + // Output: + // true + // false + // true + // false +} + +func ExampleTArray_Search() { + { + s := garray.NewTArray[int]() + s.SetArray(g.SliceInt{10, 20, 15, 30, 40, 50, 60}) + fmt.Println(s.Search(20)) + fmt.Println(s.Search(21)) + } + { + s := garray.NewTArray[string]() + s.SetArray(g.SliceStr{"a", "b", "c", "d", "e", "f", "g", "h"}) + fmt.Println(s.Search("e")) + fmt.Println(s.Search("z")) + } + // Output: + // 1 + // -1 + // 4 + // -1 +} + +func ExampleTArray_Unique() { + { + s := garray.NewTArray[int]() + s.SetArray(g.SliceInt{10, 20, 15, 15, 20, 50, 60}) + fmt.Println(s) + fmt.Println(s.Unique()) + } + { + s := garray.NewTArray[string]() + s.SetArray(g.SliceStr{"a", "b", "c", "c", "c", "d", "d"}) + fmt.Println(s.Unique()) + } + // Output: + // [10,20,15,15,20,50,60] + // [10,20,15,50,60] + // ["a","b","c","d"] +} + +func ExampleTArray_LockFunc() { + { + s := garray.NewTArrayFrom(g.SliceInt{10, 20, 15, 30, 40, 50, 60}) + s.LockFunc(func(array []int) { + for i := 0; i < len(array)-1; i++ { + fmt.Println(array[i]) + } + }) + } + { + s := garray.NewTArrayFrom[string](g.SliceStr{"a", "b", "c"}) + s.LockFunc(func(array []string) { + array[len(array)-1] = "GF fans" + }) + fmt.Println(s) + } + // Output: + // 10 + // 20 + // 15 + // 30 + // 40 + // 50 + // ["a","b","GF fans"] +} + +func ExampleTArray_RLockFunc() { + { + s := garray.NewTArrayFrom(g.SliceInt{10, 20, 15, 30, 40, 50, 60}) + s.RLockFunc(func(array []int) { + for i := 0; i < len(array); i++ { + fmt.Println(array[i]) + } + }) + } + { + s := garray.NewTArrayFrom[string](g.SliceStr{"a", "b", "c", "d", "e"}) + s.RLockFunc(func(array []string) { + for i := 0; i < len(array); i++ { + fmt.Println(array[i]) + } + }) + } + // Output: + // 10 + // 20 + // 15 + // 30 + // 40 + // 50 + // 60 + // a + // b + // c + // d + // e +} + +func ExampleTArray_Merge() { + { + s1 := garray.NewTArray[int]() + s2 := garray.NewTArray[int]() + s1.SetArray(g.SliceInt{10, 20, 15}) + s2.SetArray(g.SliceInt{40, 50, 60}) + fmt.Println(s1) + fmt.Println(s2) + s1.Merge(s2) + fmt.Println(s1) + } + { + s1 := garray.NewTArray[string]() + s2 := garray.NewTArray[string]() + s1.SetArray(g.SliceStr{"a", "b", "c"}) + s2.SetArray(g.SliceStr{"d", "e", "f"}) + s1.Merge(s2) + fmt.Println(s1) + } + // Output: + // [10,20,15] + // [40,50,60] + // [10,20,15,40,50,60] + // ["a","b","c","d","e","f"] +} + +func ExampleTArray_Fill() { + { + s := garray.NewTArrayFrom(g.SliceInt{10, 20, 15, 30, 40, 50, 60}) + fmt.Println(s) + s.Fill(2, 3, 99) + fmt.Println(s) + } + { + s := garray.NewTArrayFrom[string](g.SliceStr{"a", "b", "c", "d", "e", "f", "g", "h"}) + s.Fill(2, 3, "here") + fmt.Println(s) + } + // Output: + // [10,20,15,30,40,50,60] + // [10,20,99,99,99,50,60] + // ["a","b","here","here","here","f","g","h"] +} + +func ExampleTArray_Chunk() { + { + s := garray.NewTArrayFrom(g.SliceInt{10, 20, 15, 30, 40, 50, 60}) + fmt.Println(s) + r := s.Chunk(3) + fmt.Println(r) + } + { + s := garray.NewTArrayFrom[string](g.SliceStr{"a", "b", "c", "d", "e", "f", "g", "h"}) + r := s.Chunk(3) + fmt.Println(r) + } + + // Output: + // [10,20,15,30,40,50,60] + // [[10 20 15] [30 40 50] [60]] + // [[a b c] [d e f] [g h]] +} + +func ExampleTArray_Pad() { + { + s := garray.NewTArrayFrom(g.SliceInt{10, 20, 15, 30, 40, 50, 60}) + s.Pad(8, 99) + fmt.Println(s) + s.Pad(-10, 89) + fmt.Println(s) + } + { + s := garray.NewTArrayFrom[string](g.SliceStr{"a", "b", "c"}) + s.Pad(7, "here") + fmt.Println(s) + s.Pad(-10, "there") + fmt.Println(s) + } + + // Output: + // [10,20,15,30,40,50,60,99] + // [89,89,10,20,15,30,40,50,60,99] + // ["a","b","c","here","here","here","here"] + // ["there","there","there","a","b","c","here","here","here","here"] +} + +func ExampleTArray_Rand() { + { + s := garray.NewTArrayFrom(g.SliceInt{10, 20, 15, 30, 40, 50, 60}) + fmt.Println(s) + fmt.Println(s.Rand()) + } + { + s := garray.NewTArrayFrom[string](g.SliceStr{"a", "b", "c", "d", "e", "f", "g", "h"}) + fmt.Println(s.Rand()) + } + + // May Output: + // [10,20,15,30,40,50,60] + // 10 true + // c true +} + +func ExampleTArray_Rands() { + { + s := garray.NewTArrayFrom(g.SliceInt{10, 20, 15, 30, 40, 50, 60}) + fmt.Println(s) + fmt.Println(s.Rands(3)) + } + { + s := garray.NewTArrayFrom[string](g.SliceStr{"a", "b", "c", "d", "e", "f", "g", "h"}) + fmt.Println(s.Rands(3)) + } + + // May Output: + // [10,20,15,30,40,50,60] + // [20 50 20] + // [e h e] +} + +func ExampleTArray_Shuffle() { + { + s := garray.NewTArrayFrom(g.SliceInt{10, 20, 15, 30, 40, 50, 60}) + fmt.Println(s) + fmt.Println(s.Shuffle()) + } + { + s := garray.NewTArrayFrom[string](g.SliceStr{"a", "b", "c", "d", "e", "f", "g", "h"}) + fmt.Println(s.Shuffle()) + } + + // May Output: + // [10,20,15,30,40,50,60] + // [10,40,15,50,20,60,30] + // ["a","c","e","d","b","g","f","h"] +} + +func ExampleTArray_Reverse() { + { + s := garray.NewTArrayFrom(g.SliceInt{10, 20, 15, 30, 40, 50, 60}) + fmt.Println(s) + fmt.Println(s.Reverse()) + } + { + s := garray.NewTArrayFrom[string](g.SliceStr{"a", "b", "c", "d", "e", "f", "g", "h"}) + fmt.Println(s.Reverse()) + } + + // Output: + // [10,20,15,30,40,50,60] + // [60,50,40,30,15,20,10] + // ["h","g","f","e","d","c","b","a"] +} + +func ExampleTArray_Join() { + { + s := garray.NewTArrayFrom(g.SliceInt{10, 20, 15, 30, 40, 50, 60}) + fmt.Println(s) + fmt.Println(s.Join(",")) + } + { + s := garray.NewTArrayFrom[string](g.SliceStr{"a", "b", "c"}) + fmt.Println(s.Join(",")) + } + + // Output: + // [10,20,15,30,40,50,60] + // 10,20,15,30,40,50,60 + // a,b,c +} + +func ExampleTArray_CountValues() { + { + s := garray.NewTArrayFrom(g.SliceInt{10, 20, 15, 15, 40, 40, 40}) + fmt.Println(s.CountValues()) + } + { + s := garray.NewTArrayFrom[string](g.SliceStr{"a", "b", "c", "c", "c", "d", "d"}) + fmt.Println(s.CountValues()) + } + + // Output: + // map[10:1 15:2 20:1 40:3] + // map[a:1 b:1 c:3 d:2] +} + +func ExampleTArray_Iterator() { + { + s := garray.NewTArrayFrom(g.SliceInt{10, 20, 15, 30, 40, 50, 60}) + s.Iterator(func(k int, v int) bool { + fmt.Println(k, v) + return true + }) + } + { + s := garray.NewTArrayFrom[string](g.SliceStr{"a", "b", "c"}) + s.Iterator(func(k int, v string) bool { + fmt.Println(k, v) + return true + }) + } + + // Output: + // 0 10 + // 1 20 + // 2 15 + // 3 30 + // 4 40 + // 5 50 + // 6 60 + // 0 a + // 1 b + // 2 c +} + +func ExampleTArray_IteratorAsc() { + { + s := garray.NewTArrayFrom(g.SliceInt{10, 20, 15, 30, 40, 50, 60}) + s.IteratorAsc(func(k int, v int) bool { + fmt.Println(k, v) + return true + }) + } + { + s := garray.NewTArrayFrom[string](g.SliceStr{"a", "b", "c"}) + s.IteratorAsc(func(k int, v string) bool { + fmt.Println(k, v) + return true + }) + } + + // Output: + // 0 10 + // 1 20 + // 2 15 + // 3 30 + // 4 40 + // 5 50 + // 6 60 + // 0 a + // 1 b + // 2 c +} + +func ExampleTArray_IteratorDesc() { + { + s := garray.NewTArrayFrom(g.SliceInt{10, 20, 15, 30, 40, 50, 60}) + s.IteratorDesc(func(k int, v int) bool { + fmt.Println(k, v) + return true + }) + } + { + s := garray.NewTArrayFrom[string](g.SliceStr{"a", "b", "c"}) + s.IteratorDesc(func(k int, v string) bool { + fmt.Println(k, v) + return true + }) + } + + // Output: + // 6 60 + // 5 50 + // 4 40 + // 3 30 + // 2 15 + // 1 20 + // 0 10 + // 2 c + // 1 b + // 0 a +} + +func ExampleTArray_String() { + { + s := garray.NewTArrayFrom(g.SliceInt{10, 20, 15, 30, 40, 50, 60}) + fmt.Println(s) + fmt.Println(s.String()) + } + { + s := garray.NewTArrayFrom[string](g.SliceStr{"a", "b", "c"}) + fmt.Println(s.String()) + } + + // Output: + // [10,20,15,30,40,50,60] + // [10,20,15,30,40,50,60] + // ["a","b","c"] +} + +func ExampleTArray_MarshalJSON() { + { + type Student struct { + Id int + Name string + Scores garray.TArray[int] + } + var array garray.TArray[int] + array.SetArray(g.SliceInt{98, 97, 96}) + s := Student{ + Id: 1, + Name: "john", + Scores: array, + } + b, _ := json.Marshal(s) + fmt.Println(string(b)) + } + { + type Student struct { + Id int + Name string + Lessons []string + } + s := Student{ + Id: 1, + Name: "john", + Lessons: []string{"Math", "English", "Music"}, + } + b, _ := json.Marshal(s) + fmt.Println(string(b)) + } + + // Output: + // {"Id":1,"Name":"john","Scores":[98,97,96]} + // {"Id":1,"Name":"john","Lessons":["Math","English","Music"]} +} + +func ExampleTArray_UnmarshalJSON() { + { + b := []byte(`{"Id":1,"Name":"john","Scores":[98,96,97]}`) + type Student struct { + Id int + Name string + Scores *garray.TArray[int] + } + s := Student{} + json.Unmarshal(b, &s) + fmt.Println(s) + } + { + b := []byte(`{"Id":1,"Name":"john","Lessons":["Math","English","Sport"]}`) + type Student struct { + Id int + Name string + Lessons *garray.TArray[string] + } + s := Student{} + json.Unmarshal(b, &s) + fmt.Println(s) + } + + // Output: + // {1 john [98,96,97]} + // {1 john ["Math","English","Sport"]} +} + +func ExampleTArray_UnmarshalValue() { + { + type Student struct { + Name string + Scores *garray.TArray[int] + } + + var s *Student + gconv.Struct(g.Map{ + "name": "john", + "scores": g.SliceInt{96, 98, 97}, + }, &s) + fmt.Println(s) + } + { + type Student struct { + Name string + Lessons *garray.TArray[string] + } + var s *Student + gconv.Struct(g.Map{ + "name": "john", + "lessons": []byte(`["Math","English","Sport"]`), + }, &s) + fmt.Println(s) + + var s1 *Student + gconv.Struct(g.Map{ + "name": "john", + "lessons": g.SliceStr{"Math", "English", "Sport"}, + }, &s1) + fmt.Println(s1) + } + + // Output: + // &{john [96,98,97]} + // &{john ["Math","English","Sport"]} + // &{john ["Math","English","Sport"]} +} + +func ExampleTArray_Filter() { + { + array1 := garray.NewTArrayFrom(g.SliceInt{10, 40, 50, 0, 0, 0, 60}) + array2 := garray.NewTArrayFrom(g.SliceInt{10, 4, 51, 5, 45, 50, 56}) + fmt.Println(array1.Filter(func(index int, value int) bool { + return empty.IsEmpty(value) + })) + fmt.Println(array2.Filter(func(index int, value int) bool { + return value%2 == 0 + })) + fmt.Println(array2.Filter(func(index int, value int) bool { + return value%2 == 1 + })) + } + { + s := garray.NewTArrayFrom[string](g.SliceStr{"Math", "English", "Sport"}) + s1 := garray.NewTArrayFrom[string](g.SliceStr{"a", "b", "", "c", "", "", "d"}) + fmt.Println(s1.Filter(func(index int, value string) bool { + return empty.IsEmpty(value) + })) + + fmt.Println(s.Filter(func(index int, value string) bool { + return strings.Contains(value, "h") + })) + } + + // Output: + // [10,40,50,60] + // [51,5,45] + // [] + // ["a","b","c","d"] + // ["Sport"] +} + +func ExampleTArray_FilterEmpty() { + { + s := garray.NewTArrayFrom(g.SliceInt{10, 40, 50, 0, 0, 0, 60}) + fmt.Println(s) + fmt.Println(s.FilterEmpty()) + } + { + s := garray.NewTArrayFrom[string](g.SliceStr{"a", "b", "", "c", "", "", "d"}) + fmt.Println(s.FilterEmpty()) + } + + // Output: + // [10,40,50,0,0,0,60] + // [10,40,50,60] + // ["a","b","c","d"] +} + +func ExampleTArray_IsEmpty() { + { + s := garray.NewTArrayFrom(g.SliceInt{10, 20, 15, 30, 40, 50, 60}) + fmt.Println(s.IsEmpty()) + s1 := garray.NewTArray[int]() + fmt.Println(s1.IsEmpty()) + } + { + s := garray.NewTArrayFrom[string](g.SliceStr{"a", "b", "", "c", "", "", "d"}) + fmt.Println(s.IsEmpty()) + s1 := garray.NewTArray[string]() + fmt.Println(s1.IsEmpty()) + } + + // Output: + // false + // true + // false + // true +} diff --git a/container/garray/garray_z_example_sorted_str_test.go b/container/garray/garray_z_example_sorted_str_test.go index bbd3a1aee..bc9424afd 100644 --- a/container/garray/garray_z_example_sorted_str_test.go +++ b/container/garray/garray_z_example_sorted_str_test.go @@ -381,7 +381,7 @@ func ExampleSortedStrArray_LockFunc() { fmt.Println(s) // Output: - // ["a","b","GF fans"] + // ["GF fans","a","b"] } func ExampleSortedStrArray_RLockFunc() { diff --git a/container/garray/garray_z_example_sorted_t_test.go b/container/garray/garray_z_example_sorted_t_test.go new file mode 100644 index 000000000..86bb694e4 --- /dev/null +++ b/container/garray/garray_z_example_sorted_t_test.go @@ -0,0 +1,576 @@ +// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://github.com/gogf/gf. + +package garray_test + +import ( + "fmt" + + "github.com/gogf/gf/v2/container/garray" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/internal/empty" + "github.com/gogf/gf/v2/internal/json" + "github.com/gogf/gf/v2/util/gconv" + "github.com/gogf/gf/v2/util/gutil" +) + +func ExampleSortedTArray_Walk() { + var array garray.SortedTArray[string] + array.SetComparator(gutil.ComparatorT) + tables := g.SliceStr{"user", "user_detail"} + prefix := "gf_" + array.Append(tables...) + // Add prefix for given table names. + array.Walk(func(value string) string { + return prefix + value + }) + fmt.Println(array.Slice()) + + // Output: + // [gf_user gf_user_detail] +} + +func ExampleNewSortedTArray() { + s := garray.NewSortedTArray[string](gutil.ComparatorT) + s.Append("b") + s.Append("d") + s.Append("c") + s.Append("a") + fmt.Println(s.Slice()) + + // Output: + // [a b c d] +} + +func ExampleNewSortedTArraySize() { + s := garray.NewSortedTArraySize[string](3, gutil.ComparatorT) + s.SetArray([]string{"b", "d", "a", "c"}) + fmt.Println(s.Slice(), s.Len(), cap(s.Slice())) + + // Output: + // [a b c d] 4 4 +} + +func ExampleNewSortedTArrayFromCopy() { + s := garray.NewSortedTArrayFromCopy(g.SliceStr{"b", "d", "c", "a"}, gutil.ComparatorT) + fmt.Println(s.Slice()) + + // Output: + // [a b c d] +} + +func ExampleSortedTArray_At() { + s := garray.NewSortedTArrayFrom(g.SliceStr{"b", "d", "c", "a"}, gutil.ComparatorT) + sAt := s.At(2) + fmt.Println(s) + fmt.Println(sAt) + + // Output: + // ["a","b","c","d"] + // c + +} + +func ExampleSortedTArray_Get() { + s := garray.NewSortedTArrayFrom(g.SliceStr{"b", "d", "c", "a", "e"}, gutil.ComparatorT) + sGet, sBool := s.Get(3) + fmt.Println(s) + fmt.Println(sGet, sBool) + + // Output: + // ["a","b","c","d","e"] + // d true +} + +func ExampleSortedTArray_SetArray() { + s := garray.NewSortedTArray[string](gutil.ComparatorT) + s.SetArray([]string{"b", "d", "a", "c"}) + fmt.Println(s.Slice()) + + // Output: + // [a b c d] +} + +func ExampleSortedTArray_SetUnique() { + s := garray.NewSortedTArray[string](gutil.ComparatorT) + s.SetArray([]string{"b", "d", "a", "c", "c", "a"}) + fmt.Println(s.SetUnique(true)) + + // Output: + // ["a","b","c","d"] +} + +func ExampleSortedTArray_Sum() { + s := garray.NewSortedTArray[string](gutil.ComparatorT) + s.SetArray([]string{"5", "3", "2"}) + fmt.Println(s) + a := s.Sum() + fmt.Println(a) + + // Output: + // [2,3,5] + // 10 +} + +func ExampleSortedTArray_Sort() { + s := garray.NewSortedTArray[string](gutil.ComparatorT) + s.SetArray(g.SliceStr{"b", "d", "a", "c"}) + fmt.Println(s) + a := s.Sort() + fmt.Println(a) + + // Output: + // ["a","b","c","d"] + // ["a","b","c","d"] +} + +func ExampleSortedTArray_Remove() { + s := garray.NewSortedTArray[string](gutil.ComparatorT) + s.SetArray(g.SliceStr{"b", "d", "c", "a"}) + fmt.Println(s.Slice()) + s.Remove(1) + fmt.Println(s.Slice()) + + // Output: + // [a b c d] + // [a c d] +} + +func ExampleSortedTArray_RemoveValue() { + s := garray.NewSortedTArray[string](gutil.ComparatorT) + s.SetArray(g.SliceStr{"b", "d", "c", "a"}) + fmt.Println(s.Slice()) + s.RemoveValue("b") + fmt.Println(s.Slice()) + + // Output: + // [a b c d] + // [a c d] +} + +func ExampleSortedTArray_PopLeft() { + s := garray.NewSortedTArray[string](gutil.ComparatorT) + s.SetArray(g.SliceStr{"b", "d", "c", "a"}) + r, _ := s.PopLeft() + fmt.Println(r) + fmt.Println(s.Slice()) + + // Output: + // a + // [b c d] +} + +func ExampleSortedTArray_PopRight() { + s := garray.NewSortedTArray[string](gutil.ComparatorT) + s.SetArray(g.SliceStr{"b", "d", "c", "a"}) + fmt.Println(s.Slice()) + r, _ := s.PopRight() + fmt.Println(r) + fmt.Println(s.Slice()) + + // Output: + // [a b c d] + // d + // [a b c] +} + +func ExampleSortedTArray_PopRights() { + s := garray.NewSortedTArray[string](gutil.ComparatorT) + s.SetArray(g.SliceStr{"c", "b", "a", "d", "f", "e", "h", "g"}) + r := s.PopRights(2) + fmt.Println(r) + fmt.Println(s) + + // Output: + // [g h] + // ["a","b","c","d","e","f"] +} + +func ExampleSortedTArray_Rand() { + s := garray.NewSortedTArray[string](gutil.ComparatorT) + s.SetArray(g.SliceStr{"c", "b", "a", "d", "f", "e", "h", "g"}) + r, _ := s.PopRand() + fmt.Println(r) + fmt.Println(s) + + // May Output: + // b + // ["a","c","d","e","f","g","h"] +} + +func ExampleSortedTArray_PopRands() { + s := garray.NewSortedTArray[string](gutil.ComparatorT) + s.SetArray(g.SliceStr{"c", "b", "a", "d", "f", "e", "h", "g"}) + r := s.PopRands(2) + fmt.Println(r) + fmt.Println(s) + + // May Output: + // [d a] + // ["b","c","e","f","g","h"] +} + +func ExampleSortedTArray_PopLefts() { + s := garray.NewSortedTArray[string](gutil.ComparatorT) + s.SetArray(g.SliceStr{"c", "b", "a", "d", "f", "e", "h", "g"}) + r := s.PopLefts(2) + fmt.Println(r) + fmt.Println(s) + + // Output: + // [a b] + // ["c","d","e","f","g","h"] +} + +func ExampleSortedTArray_Range() { + s := garray.NewSortedTArray[string](gutil.ComparatorT) + s.SetArray(g.SliceStr{"c", "b", "a", "d", "f", "e", "h", "g"}) + r := s.Range(2, 5) + fmt.Println(r) + + // Output: + // [c d e] +} + +func ExampleSortedTArray_SubSlice() { + s := garray.NewSortedTArray[string](gutil.ComparatorT) + s.SetArray(g.SliceStr{"c", "b", "a", "d", "f", "e", "h", "g"}) + r := s.SubSlice(3, 4) + fmt.Println(s.Slice()) + fmt.Println(r) + + // Output: + // [a b c d e f g h] + // [d e f g] +} + +func ExampleSortedTArray_Add() { + s := garray.NewSortedTArray[string](gutil.ComparatorT) + s.Add("b", "d", "c", "a") + fmt.Println(s) + + // Output: + // ["a","b","c","d"] +} + +func ExampleSortedTArray_Append() { + s := garray.NewSortedTArray[string](gutil.ComparatorT) + s.SetArray(g.SliceStr{"b", "d", "c", "a"}) + fmt.Println(s) + s.Append("f", "e", "g") + fmt.Println(s) + + // Output: + // ["a","b","c","d"] + // ["a","b","c","d","e","f","g"] +} + +func ExampleSortedTArray_Len() { + s := garray.NewSortedTArray[string](gutil.ComparatorT) + s.SetArray(g.SliceStr{"c", "b", "a", "d", "f", "e", "h", "g"}) + fmt.Println(s) + fmt.Println(s.Len()) + + // Output: + // ["a","b","c","d","e","f","g","h"] + // 8 +} + +func ExampleSortedTArray_Slice() { + s := garray.NewSortedTArray[string](gutil.ComparatorT) + s.SetArray(g.SliceStr{"c", "b", "a", "d", "f", "e", "h", "g"}) + fmt.Println(s.Slice()) + + // Output: + // [a b c d e f g h] +} + +func ExampleSortedTArray_Interfaces() { + s := garray.NewSortedTArray[string](gutil.ComparatorT) + s.SetArray(g.SliceStr{"c", "b", "a", "d", "f", "e", "h", "g"}) + r := s.Interfaces() + fmt.Println(r) + + // Output: + // [a b c d e f g h] +} + +func ExampleSortedTArray_Clone() { + s := garray.NewSortedTArray[string](gutil.ComparatorT) + s.SetArray(g.SliceStr{"c", "b", "a", "d", "f", "e", "h", "g"}) + r := s.Clone() + fmt.Println(r) + fmt.Println(s) + + // Output: + // ["a","b","c","d","e","f","g","h"] + // ["a","b","c","d","e","f","g","h"] +} + +func ExampleSortedTArray_Clear() { + s := garray.NewSortedTArray[string](gutil.ComparatorT) + s.SetArray(g.SliceStr{"c", "b", "a", "d", "f", "e", "h", "g"}) + fmt.Println(s) + fmt.Println(s.Clear()) + fmt.Println(s) + + // Output: + // ["a","b","c","d","e","f","g","h"] + // [] + // [] +} + +func ExampleSortedTArray_Contains() { + s := garray.NewSortedTArray[string](gutil.ComparatorT) + s.SetArray(g.SliceStr{"c", "b", "a", "d", "f", "e", "h", "g"}) + fmt.Println(s.Contains("e")) + fmt.Println(s.Contains("E")) + fmt.Println(s.Contains("z")) + + // Output: + // true + // false + // false +} + +func ExampleSortedTArray_Search() { + s := garray.NewSortedTArray[string](gutil.ComparatorT) + s.SetArray(g.SliceStr{"c", "b", "a", "d", "f", "e", "h", "g"}) + fmt.Println(s) + fmt.Println(s.Search("e")) + fmt.Println(s.Search("E")) + fmt.Println(s.Search("z")) + + // Output: + // ["a","b","c","d","e","f","g","h"] + // 4 + // -1 + // -1 +} + +func ExampleSortedTArray_Unique() { + s := garray.NewSortedTArray[string](gutil.ComparatorT) + s.SetArray(g.SliceStr{"a", "b", "c", "c", "c", "d", "d"}) + fmt.Println(s) + fmt.Println(s.Unique()) + + // Output: + // ["a","b","c","c","c","d","d"] + // ["a","b","c","d"] +} + +func ExampleSortedTArray_LockFunc() { + s := garray.NewSortedTArrayFrom(g.SliceStr{"b", "c", "a"}, gutil.ComparatorT) + s.LockFunc(func(array []string) { + array[len(array)-1] = "GF fans" + }) + fmt.Println(s) + + // Output: + // ["GF fans","a","b"] +} + +func ExampleSortedTArray_RLockFunc() { + s := garray.NewSortedTArrayFrom(g.SliceStr{"b", "c", "a"}, gutil.ComparatorT) + s.RLockFunc(func(array []string) { + array[len(array)-1] = "GF fans" + fmt.Println(array[len(array)-1]) + }) + fmt.Println(s) + + // Output: + // GF fans + // ["a","b","GF fans"] +} + +func ExampleSortedTArray_Merge() { + s1 := garray.NewSortedTArray[string](gutil.ComparatorT) + s2 := garray.NewSortedTArray[string](gutil.ComparatorT) + s1.SetArray(g.SliceStr{"b", "c", "a"}) + s2.SetArray(g.SliceStr{"e", "d", "f"}) + fmt.Println(s1) + fmt.Println(s2) + s1.Merge(s2) + fmt.Println(s1) + + // Output: + // ["a","b","c"] + // ["d","e","f"] + // ["a","b","c","d","e","f"] +} + +func ExampleSortedTArray_Chunk() { + s := garray.NewSortedTArrayFrom(g.SliceStr{"c", "b", "a", "d", "f", "e", "h", "g"}, gutil.ComparatorT) + r := s.Chunk(3) + fmt.Println(r) + + // Output: + // [[a b c] [d e f] [g h]] +} + +func ExampleSortedTArray_Rands() { + s := garray.NewSortedTArrayFrom(g.SliceStr{"c", "b", "a", "d", "f", "e", "h", "g"}, gutil.ComparatorT) + fmt.Println(s) + fmt.Println(s.Rands(3)) + + // May Output: + // ["a","b","c","d","e","f","g","h"] + // [h g c] +} + +func ExampleSortedTArray_Join() { + s := garray.NewSortedTArrayFrom(g.SliceStr{"c", "b", "a", "d", "f", "e", "h", "g"}, gutil.ComparatorT) + fmt.Println(s.Join(",")) + + // Output: + // a,b,c,d,e,f,g,h +} + +func ExampleSortedTArray_CountValues() { + s := garray.NewSortedTArrayFrom(g.SliceStr{"a", "b", "c", "c", "c", "d", "d"}, gutil.ComparatorT) + fmt.Println(s.CountValues()) + + // Output: + // map[a:1 b:1 c:3 d:2] +} + +func ExampleSortedTArray_Iterator() { + s := garray.NewSortedTArrayFrom(g.SliceStr{"b", "c", "a"}, gutil.ComparatorT) + s.Iterator(func(k int, v string) bool { + fmt.Println(k, v) + return true + }) + + // Output: + // 0 a + // 1 b + // 2 c +} + +func ExampleSortedTArray_IteratorAsc() { + s := garray.NewSortedTArrayFrom(g.SliceStr{"b", "c", "a"}, gutil.ComparatorT) + s.IteratorAsc(func(k int, v string) bool { + fmt.Println(k, v) + return true + }) + + // Output: + // 0 a + // 1 b + // 2 c +} + +func ExampleSortedTArray_IteratorDesc() { + s := garray.NewSortedTArrayFrom(g.SliceStr{"b", "c", "a"}, gutil.ComparatorT) + s.IteratorDesc(func(k int, v string) bool { + fmt.Println(k, v) + return true + }) + + // Output: + // 2 c + // 1 b + // 0 a +} + +func ExampleSortedTArray_String() { + s := garray.NewSortedTArrayFrom(g.SliceStr{"b", "c", "a"}, gutil.ComparatorT) + fmt.Println(s.String()) + + // Output: + // ["a","b","c"] +} + +func ExampleSortedTArray_MarshalJSON() { + type Student struct { + ID int + Name string + Levels garray.SortedTArray[string] + } + r := garray.NewSortedTArrayFrom(g.SliceStr{"b", "c", "a"}, gutil.ComparatorT) + s := Student{ + ID: 1, + Name: "john", + Levels: *r, + } + b, _ := json.Marshal(s) + fmt.Println(string(b)) + + // Output: + // {"ID":1,"Name":"john","Levels":["a","b","c"]} +} + +func ExampleSortedTArray_UnmarshalJSON() { + b := []byte(`{"Id":1,"Name":"john","Lessons":["Math","English","Sport"]}`) + type Student struct { + Id int + Name string + Lessons *garray.StrArray + } + s := Student{} + json.Unmarshal(b, &s) + fmt.Println(s) + + // Output: + // {1 john ["Math","English","Sport"]} +} + +func ExampleSortedTArray_UnmarshalValue() { + type Student struct { + Name string + Lessons *garray.StrArray + } + var s *Student + gconv.Struct(g.Map{ + "name": "john", + "lessons": []byte(`["Math","English","Sport"]`), + }, &s) + fmt.Println(s) + + var s1 *Student + gconv.Struct(g.Map{ + "name": "john", + "lessons": g.SliceStr{"Math", "English", "Sport"}, + }, &s1) + fmt.Println(s1) + + // Output: + // &{john ["Math","English","Sport"]} + // &{john ["Math","English","Sport"]} +} + +func ExampleSortedTArray_Filter() { + s := garray.NewSortedTArrayFrom(g.SliceStr{"b", "a", "", "c", "", "", "d"}, gutil.ComparatorT) + fmt.Println(s) + fmt.Println(s.Filter(func(index int, value string) bool { + return empty.IsEmpty(value) + })) + + // Output: + // ["","","","a","b","c","d"] + // ["a","b","c","d"] +} + +func ExampleSortedTArray_FilterEmpty() { + s := garray.NewSortedTArrayFrom(g.SliceStr{"b", "a", "", "c", "", "", "d"}, gutil.ComparatorT) + fmt.Println(s) + fmt.Println(s.FilterEmpty()) + + // Output: + // ["","","","a","b","c","d"] + // ["a","b","c","d"] +} + +func ExampleSortedTArray_IsEmpty() { + s := garray.NewSortedTArrayFrom(g.SliceStr{"b", "a", "", "c", "", "", "d"}, gutil.ComparatorT) + fmt.Println(s.IsEmpty()) + s1 := garray.NewSortedTArray[string](gutil.ComparatorT) + fmt.Println(s1.IsEmpty()) + + // Output: + // false + // true +} diff --git a/container/garray/garray_z_unit_normal_t_test.go b/container/garray/garray_z_unit_normal_t_test.go new file mode 100644 index 000000000..4b2032dfb --- /dev/null +++ b/container/garray/garray_z_unit_normal_t_test.go @@ -0,0 +1,856 @@ +// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://github.com/gogf/gf. + +// go test *.go + +package garray_test + +import ( + "testing" + "time" + + "github.com/gogf/gf/v2/container/garray" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/internal/empty" + "github.com/gogf/gf/v2/internal/json" + "github.com/gogf/gf/v2/test/gtest" + "github.com/gogf/gf/v2/util/gconv" +) + +func Test_TArray_Basic(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + expect := []int{0, 1, 2, 3} + array := garray.NewTArrayFrom(expect) + array2 := garray.NewTArrayFrom(expect) + array3 := garray.NewTArrayFrom([]int{}) + + t.Assert(array.Slice(), expect) + t.Assert(array.Interfaces(), expect) + err := array.Set(0, 100) // 100, 1, 2, 3 + t.AssertNil(err) + + err = array.Set(100, 100) + t.AssertNE(err, nil) + + t.Assert(array.IsEmpty(), false) + + copyArray := array.DeepCopy() + ca := copyArray.(*garray.TArray[int]) + ca.Set(0, 1) + cval, _ := ca.Get(0) + val, _ := array.Get(0) + t.AssertNE(cval, val) + + v, ok := array.Get(0) + t.Assert(v, 100) + t.Assert(ok, true) + + v, ok = array.Get(1) + t.Assert(v, 1) + t.Assert(ok, true) + + v, ok = array.Get(4) + t.Assert(v, 0) + t.Assert(ok, false) + + t.Assert(array.Search(100), 0) + t.Assert(array3.Search(100), -1) + t.Assert(array.Contains(100), true) + + v, ok = array.Remove(0) // 1, 2, 3 + t.Assert(v, 100) + t.Assert(ok, true) + t.Assert(array.Slice(), []int{1, 2, 3}) + + v, ok = array.Remove(-1) + t.Assert(v, 0) + t.Assert(ok, false) + t.Assert(array.Slice(), []int{1, 2, 3}) + + v, ok = array.Remove(100000) + t.Assert(v, 0) + t.Assert(ok, false) + t.Assert(array.Slice(), []int{1, 2, 3}) + + v, ok = array2.Remove(3) // 0 1 2 + t.Assert(v, 3) + t.Assert(ok, true) + + v, ok = array2.Remove(1) // 0 2 + t.Assert(v, 1) + t.Assert(ok, true) + + t.Assert(array.Contains(100), false) + array.Append(4) // 2, 2, 3, 4 + t.Assert(array.Slice(), []int{2, 2, 3, 4}) + t.Assert(array.Len(), 4) + array.InsertBefore(0, 100) // 100, 2, 2, 3, 4 + t.Assert(array.Slice(), []int{100, 2, 2, 3, 4}) + array.InsertAfter(0, 200) // 100, 200, 2, 2, 3, 4 + t.Assert(array.Slice(), []int{100, 200, 2, 2, 3, 4}) + array.InsertBefore(5, 300) + array.InsertAfter(6, 400) + t.Assert(array.Slice(), []int{100, 200, 2, 2, 3, 300, 4, 400}) + t.Assert(array.Clear().Len(), 0) + err = array.InsertBefore(99, 9900) + t.AssertNE(err, nil) + err = array.InsertAfter(99, 9900) + t.AssertNE(err, nil) + + t.Assert(array.String(), "[]") + }) +} + +func TestTArray_Sort(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + expect1 := []any{0, 1, 2, 3} + expect2 := []any{3, 2, 1, 0} + array := garray.NewTArray[int]() + for i := 3; i >= 0; i-- { + array.Append(i) + } + array.SortFunc(func(v1, v2 int) bool { + return v1 < v2 + }) + t.Assert(array.Slice(), expect1) + array.SortFunc(func(v1, v2 int) bool { + return v1 > v2 + }) + t.Assert(array.Slice(), expect2) + }) +} + +func TestTArray_Unique(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + expect := []int{1, 2, 3, 4, 5, 3, 2, 2, 3, 5, 5} + array := garray.NewTArrayFrom(expect) + t.Assert(array.Unique().Slice(), []int{1, 2, 3, 4, 5}) + }) + gtest.C(t, func(t *gtest.T) { + expect := []int{} + array := garray.NewTArrayFrom(expect) + t.Assert(array.Unique().Slice(), []int{}) + }) +} + +func TestTArray_PushAndPop(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + expect := []any{0, 1, 2, 3} + array := garray.NewTArrayFrom(expect) + t.Assert(array.Slice(), expect) + + v, ok := array.PopLeft() + t.Assert(v, 0) + t.Assert(ok, true) + + v, ok = array.PopRight() + t.Assert(v, 3) + t.Assert(ok, true) + + v, ok = array.PopRand() + t.AssertIN(v, []any{1, 2}) + t.Assert(ok, true) + + v, ok = array.PopRand() + t.AssertIN(v, []any{1, 2}) + t.Assert(ok, true) + + t.Assert(array.Len(), 0) + array.PushLeft(1).PushRight(2) + t.Assert(array.Slice(), []any{1, 2}) + }) +} + +func TestTArray_PopRands(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []any{100, 200, 300, 400, 500, 600} + array := garray.NewFromCopy(a1) + t.AssertIN(array.PopRands(2), []any{100, 200, 300, 400, 500, 600}) + }) +} + +func TestTArray_PopLeft(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + array := garray.NewFrom(g.Slice{1, 2, 3}) + v, ok := array.PopLeft() + t.Assert(v, 1) + t.Assert(ok, true) + t.Assert(array.Len(), 2) + v, ok = array.PopLeft() + t.Assert(v, 2) + t.Assert(ok, true) + t.Assert(array.Len(), 1) + v, ok = array.PopLeft() + t.Assert(v, 3) + t.Assert(ok, true) + t.Assert(array.Len(), 0) + }) +} + +func TestTArray_PopRight(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + array := garray.NewFrom(g.Slice{1, 2, 3}) + + v, ok := array.PopRight() + t.Assert(v, 3) + t.Assert(ok, true) + t.Assert(array.Len(), 2) + + v, ok = array.PopRight() + t.Assert(v, 2) + t.Assert(ok, true) + t.Assert(array.Len(), 1) + + v, ok = array.PopRight() + t.Assert(v, 1) + t.Assert(ok, true) + t.Assert(array.Len(), 0) + }) +} + +func TestTArray_PopLefts(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + array := garray.NewFrom(g.Slice{1, 2, 3}) + t.Assert(array.PopLefts(2), g.Slice{1, 2}) + t.Assert(array.Len(), 1) + t.Assert(array.PopLefts(2), g.Slice{3}) + t.Assert(array.Len(), 0) + }) +} + +func TestTArray_PopRights(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + array := garray.NewFrom(g.Slice{1, 2, 3}) + t.Assert(array.PopRights(2), g.Slice{2, 3}) + t.Assert(array.Len(), 1) + t.Assert(array.PopLefts(2), g.Slice{1}) + t.Assert(array.Len(), 0) + }) +} + +func TestTArray_PopLeftsAndPopRights(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + array := garray.New() + v, ok := array.PopLeft() + t.Assert(v, nil) + t.Assert(ok, false) + t.Assert(array.PopLefts(10), nil) + + v, ok = array.PopRight() + t.Assert(v, nil) + t.Assert(ok, false) + t.Assert(array.PopRights(10), nil) + + v, ok = array.PopRand() + t.Assert(v, nil) + t.Assert(ok, false) + t.Assert(array.PopRands(10), nil) + }) + + gtest.C(t, func(t *gtest.T) { + value1 := []any{0, 1, 2, 3, 4, 5, 6} + value2 := []any{0, 1, 2, 3, 4, 5, 6} + array1 := garray.NewTArrayFrom(value1) + array2 := garray.NewTArrayFrom(value2) + t.Assert(array1.PopLefts(2), []any{0, 1}) + t.Assert(array1.Slice(), []any{2, 3, 4, 5, 6}) + t.Assert(array1.PopRights(2), []any{5, 6}) + t.Assert(array1.Slice(), []any{2, 3, 4}) + t.Assert(array1.PopRights(20), []any{2, 3, 4}) + t.Assert(array1.Slice(), []any{}) + t.Assert(array2.PopLefts(20), []any{0, 1, 2, 3, 4, 5, 6}) + t.Assert(array2.Slice(), []any{}) + }) +} + +func TestTArray_Range(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + value1 := []any{0, 1, 2, 3, 4, 5, 6} + array1 := garray.NewTArrayFrom(value1) + array2 := garray.NewTArrayFrom(value1, true) + t.Assert(array1.Range(0, 1), []any{0}) + t.Assert(array1.Range(1, 2), []any{1}) + t.Assert(array1.Range(0, 2), []any{0, 1}) + t.Assert(array1.Range(-1, 10), value1) + t.Assert(array1.Range(10, 2), nil) + t.Assert(array2.Range(1, 3), []any{1, 2}) + }) +} + +func TestTArray_Merge(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + func1 := func(v1, v2 any) int { + if gconv.Int(v1) < gconv.Int(v2) { + return 0 + } + return 1 + } + + i1 := []any{0, 1, 2, 3} + i2 := []any{4, 5, 6, 7} + array1 := garray.NewTArrayFrom(i1) + array2 := garray.NewTArrayFrom(i2) + t.Assert(array1.Merge(array2).Slice(), []any{0, 1, 2, 3, 4, 5, 6, 7}) + + // s1 := []string{"a", "b", "c", "d"} + s2 := []string{"e", "f"} + i3 := garray.NewIntArrayFrom([]int{1, 2, 3}) + i4 := garray.NewTArrayFrom([]any{3}) + s3 := garray.NewStrArrayFrom([]string{"g", "h"}) + s4 := garray.NewSortedArrayFrom([]any{4, 5}, func1) + s5 := garray.NewSortedStrArrayFrom(s2) + s6 := garray.NewSortedIntArrayFrom([]int{1, 2, 3}) + a1 := garray.NewTArrayFrom(i1) + + t.Assert(a1.Merge(s2).Len(), 6) + t.Assert(a1.Merge(i3).Len(), 9) + t.Assert(a1.Merge(i4).Len(), 10) + t.Assert(a1.Merge(s3).Len(), 12) + t.Assert(a1.Merge(s4).Len(), 14) + t.Assert(a1.Merge(s5).Len(), 16) + t.Assert(a1.Merge(s6).Len(), 19) + }) +} + +func TestTArray_Fill(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []any{0} + a2 := []any{0} + array1 := garray.NewTArrayFrom(a1) + array2 := garray.NewTArrayFrom(a2, true) + + t.Assert(array1.Fill(1, 2, 100), nil) + t.Assert(array1.Slice(), []any{0, 100, 100}) + + t.Assert(array2.Fill(0, 2, 100), nil) + t.Assert(array2.Slice(), []any{100, 100}) + + t.AssertNE(array2.Fill(-1, 2, 100), nil) + t.Assert(array2.Slice(), []any{100, 100}) + }) +} + +func TestTArray_Chunk(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []any{1, 2, 3, 4, 5} + array1 := garray.NewTArrayFrom(a1) + chunks := array1.Chunk(2) + t.Assert(len(chunks), 3) + t.Assert(chunks[0], []any{1, 2}) + t.Assert(chunks[1], []any{3, 4}) + t.Assert(chunks[2], []any{5}) + t.Assert(array1.Chunk(0), nil) + }) + gtest.C(t, func(t *gtest.T) { + a1 := []any{1, 2, 3, 4, 5} + array1 := garray.NewTArrayFrom(a1) + chunks := array1.Chunk(3) + t.Assert(len(chunks), 2) + t.Assert(chunks[0], []any{1, 2, 3}) + t.Assert(chunks[1], []any{4, 5}) + t.Assert(array1.Chunk(0), nil) + }) + gtest.C(t, func(t *gtest.T) { + a1 := []any{1, 2, 3, 4, 5, 6} + array1 := garray.NewTArrayFrom(a1) + chunks := array1.Chunk(2) + t.Assert(len(chunks), 3) + t.Assert(chunks[0], []any{1, 2}) + t.Assert(chunks[1], []any{3, 4}) + t.Assert(chunks[2], []any{5, 6}) + t.Assert(array1.Chunk(0), nil) + }) + gtest.C(t, func(t *gtest.T) { + a1 := []any{1, 2, 3, 4, 5, 6} + array1 := garray.NewTArrayFrom(a1) + chunks := array1.Chunk(3) + t.Assert(len(chunks), 2) + t.Assert(chunks[0], []any{1, 2, 3}) + t.Assert(chunks[1], []any{4, 5, 6}) + t.Assert(array1.Chunk(0), nil) + }) +} + +func TestTArray_Pad(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []any{0} + array1 := garray.NewTArrayFrom(a1) + t.Assert(array1.Pad(3, 1).Slice(), []any{0, 1, 1}) + t.Assert(array1.Pad(-4, 1).Slice(), []any{1, 0, 1, 1}) + t.Assert(array1.Pad(3, 1).Slice(), []any{1, 0, 1, 1}) + }) +} + +func TestTArray_SubSlice(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []any{0, 1, 2, 3, 4, 5, 6} + array1 := garray.NewTArrayFrom(a1) + array2 := garray.NewTArrayFrom(a1, true) + t.Assert(array1.SubSlice(0, 2), []any{0, 1}) + t.Assert(array1.SubSlice(2, 2), []any{2, 3}) + t.Assert(array1.SubSlice(5, 8), []any{5, 6}) + t.Assert(array1.SubSlice(9, 1), nil) + t.Assert(array1.SubSlice(-2, 2), []any{5, 6}) + t.Assert(array1.SubSlice(-9, 2), nil) + t.Assert(array1.SubSlice(1, -2), nil) + t.Assert(array2.SubSlice(0, 2), []any{0, 1}) + }) +} + +func TestTArray_Rand(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []any{0, 1, 2, 3, 4, 5, 6} + array1 := garray.NewTArrayFrom(a1) + t.Assert(len(array1.Rands(2)), 2) + t.Assert(len(array1.Rands(10)), 10) + t.AssertIN(array1.Rands(1)[0], a1) + }) + + gtest.C(t, func(t *gtest.T) { + s1 := []any{"a", "b", "c", "d"} + a1 := garray.NewTArrayFrom(s1) + i1, ok := a1.Rand() + t.Assert(ok, true) + t.Assert(a1.Contains(i1), true) + t.Assert(a1.Len(), 4) + }) + + gtest.C(t, func(t *gtest.T) { + a1 := []any{} + array1 := garray.NewTArrayFrom(a1) + rand, found := array1.Rand() + t.AssertNil(rand) + t.Assert(found, false) + }) + + gtest.C(t, func(t *gtest.T) { + a1 := []any{} + array1 := garray.NewTArrayFrom(a1) + rand := array1.Rands(1) + t.AssertNil(rand) + }) +} + +func TestTArray_Shuffle(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []any{0, 1, 2, 3, 4, 5, 6} + array1 := garray.NewTArrayFrom(a1) + t.Assert(array1.Shuffle().Len(), 7) + }) +} + +func TestTArray_Reverse(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []any{0, 1, 2, 3, 4, 5, 6} + array1 := garray.NewTArrayFrom(a1) + t.Assert(array1.Reverse().Slice(), []any{6, 5, 4, 3, 2, 1, 0}) + }) +} + +func TestTArray_Join(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []any{0, 1, 2, 3, 4, 5, 6} + array1 := garray.NewTArrayFrom(a1) + t.Assert(array1.Join("."), `0.1.2.3.4.5.6`) + }) + + gtest.C(t, func(t *gtest.T) { + a1 := []any{0, 1, `"a"`, `\a`} + array1 := garray.NewTArrayFrom(a1) + t.Assert(array1.Join("."), `0.1."a".\a`) + }) + + gtest.C(t, func(t *gtest.T) { + a1 := []any{} + array1 := garray.NewTArrayFrom(a1) + t.Assert(len(array1.Join(".")), 0) + }) +} + +func TestTArray_String(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []any{0, 1, 2, 3, 4, 5, 6} + array1 := garray.NewTArrayFrom(a1) + t.Assert(array1.String(), `[0,1,2,3,4,5,6]`) + array1 = nil + t.Assert(array1.String(), "") + }) +} + +func TestTArray_Replace(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []any{0, 1, 2, 3, 4, 5, 6} + a2 := []any{"a", "b", "c"} + a3 := []any{"m", "n", "p", "z", "x", "y", "d", "u"} + array1 := garray.NewTArrayFrom(a1) + array2 := array1.Replace(a2) + t.Assert(array2.Len(), 7) + t.Assert(array2.Contains("b"), true) + t.Assert(array2.Contains(4), true) + t.Assert(array2.Contains("v"), false) + array3 := array1.Replace(a3) + t.Assert(array3.Len(), 7) + t.Assert(array3.Contains(4), false) + t.Assert(array3.Contains("p"), true) + t.Assert(array3.Contains("u"), false) + }) +} + +func TestTArray_SetArray(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []any{0, 1, 2, 3, 4, 5, 6} + a2 := []any{"a", "b", "c"} + + array1 := garray.NewTArrayFrom(a1) + array1 = array1.SetArray(a2) + t.Assert(array1.Len(), 3) + t.Assert(array1.Contains("b"), true) + t.Assert(array1.Contains("5"), false) + }) +} + +func TestTArray_Sum(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []any{0, 1, 2, 3} + a2 := []any{"a", "b", "c"} + a3 := []any{"a", "1", "2"} + + array1 := garray.NewTArrayFrom(a1) + array2 := garray.NewTArrayFrom(a2) + array3 := garray.NewTArrayFrom(a3) + + t.Assert(array1.Sum(), 6) + t.Assert(array2.Sum(), 0) + t.Assert(array3.Sum(), 3) + + }) +} + +func TestTArray_Clone(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []any{0, 1, 2, 3} + array1 := garray.NewTArrayFrom(a1) + array2 := array1.Clone() + + t.Assert(array1.Len(), 4) + t.Assert(array2.Sum(), 6) + t.AssertEQ(array1, array2) + + }) +} + +func TestTArray_CountValues(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []any{"a", "b", "c", "d", "e", "d"} + array1 := garray.NewTArrayFrom(a1) + array2 := array1.CountValues() + t.Assert(len(array2), 5) + t.Assert(array2["b"], 1) + t.Assert(array2["d"], 2) + }) +} + +func TestTArray_LockFunc(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + s1 := []any{"a", "b", "c", "d"} + a1 := garray.NewTArrayFrom(s1, true) + + ch1 := make(chan int64, 3) + ch2 := make(chan int64, 3) + // go1 + go a1.LockFunc(func(n1 []any) { // 读写锁 + time.Sleep(2 * time.Second) // 暂停2秒 + n1[2] = "g" + ch2 <- gconv.Int64(time.Now().UnixNano() / 1000 / 1000) + }) + + // go2 + go func() { + time.Sleep(100 * time.Millisecond) // 故意暂停0.01秒,等go1执行锁后,再开始执行. + ch1 <- gconv.Int64(time.Now().UnixNano() / 1000 / 1000) + a1.Len() + ch1 <- gconv.Int64(time.Now().UnixNano() / 1000 / 1000) + }() + + t1 := <-ch1 + t2 := <-ch1 + <-ch2 // 等待go1完成 + + // 防止ci抖动,以豪秒为单位 + t.AssertGT(t2-t1, 20) // go1加的读写互斥锁,所go2读的时候被阻塞。 + t.Assert(a1.Contains("g"), true) + }) +} + +func TestTArray_RLockFunc(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + s1 := []any{"a", "b", "c", "d"} + a1 := garray.NewTArrayFrom(s1, true) + + ch1 := make(chan int64, 3) + ch2 := make(chan int64, 1) + // go1 + go a1.RLockFunc(func(n1 []any) { // read lock + time.Sleep(2 * time.Second) // sleep 2 s + n1[2] = "g" + ch2 <- gconv.Int64(time.Now().UnixNano() / 1000 / 1000) + }) + + // go2 + go func() { + time.Sleep(100 * time.Millisecond) // wait go1 do line lock for 0.01s. Then do. + ch1 <- gconv.Int64(time.Now().UnixNano() / 1000 / 1000) + a1.Len() + ch1 <- gconv.Int64(time.Now().UnixNano() / 1000 / 1000) + }() + + t1 := <-ch1 + t2 := <-ch1 + <-ch2 // wait for go1 done. + + // Prevent CI jitter, in milliseconds. + t.AssertLT(t2-t1, 20) // Go1 acquired a read lock, so when Go2 reads, it is not blocked. + t.Assert(a1.Contains("g"), true) + }) +} + +func TestTArray_Json(t *testing.T) { + // pointer + gtest.C(t, func(t *gtest.T) { + s1 := []any{"a", "b", "d", "c"} + a1 := garray.NewTArrayFrom(s1) + b1, err1 := json.Marshal(a1) + b2, err2 := json.Marshal(s1) + t.Assert(b1, b2) + t.Assert(err1, err2) + + a2 := garray.New() + err2 = json.UnmarshalUseNumber(b2, &a2) + t.Assert(err2, nil) + t.Assert(a2.Slice(), s1) + + var a3 garray.Array + err := json.UnmarshalUseNumber(b2, &a3) + t.AssertNil(err) + t.Assert(a3.Slice(), s1) + }) + // value. + gtest.C(t, func(t *gtest.T) { + s1 := []any{"a", "b", "d", "c"} + a1 := *garray.NewTArrayFrom(s1) + b1, err1 := json.Marshal(a1) + b2, err2 := json.Marshal(s1) + t.Assert(b1, b2) + t.Assert(err1, err2) + + a2 := garray.New() + err2 = json.UnmarshalUseNumber(b2, &a2) + t.Assert(err2, nil) + t.Assert(a2.Slice(), s1) + + var a3 garray.Array + err := json.UnmarshalUseNumber(b2, &a3) + t.AssertNil(err) + t.Assert(a3.Slice(), s1) + }) + // pointer + gtest.C(t, func(t *gtest.T) { + type User struct { + Name string + Scores *garray.Array + } + data := g.Map{ + "Name": "john", + "Scores": []int{99, 100, 98}, + } + b, err := json.Marshal(data) + t.AssertNil(err) + + user := new(User) + err = json.UnmarshalUseNumber(b, user) + t.AssertNil(err) + t.Assert(user.Name, data["Name"]) + t.Assert(user.Scores, data["Scores"]) + }) + // value + gtest.C(t, func(t *gtest.T) { + type User struct { + Name string + Scores garray.Array + } + data := g.Map{ + "Name": "john", + "Scores": []int{99, 100, 98}, + } + b, err := json.Marshal(data) + t.AssertNil(err) + + user := new(User) + err = json.UnmarshalUseNumber(b, user) + t.AssertNil(err) + t.Assert(user.Name, data["Name"]) + t.Assert(user.Scores, data["Scores"]) + }) +} + +func TestTArray_Iterator(t *testing.T) { + slice := g.Slice{"a", "b", "d", "c"} + array := garray.NewTArrayFrom(slice) + gtest.C(t, func(t *gtest.T) { + array.Iterator(func(k int, v any) bool { + t.Assert(v, slice[k]) + return true + }) + }) + gtest.C(t, func(t *gtest.T) { + array.IteratorAsc(func(k int, v any) bool { + t.Assert(v, slice[k]) + return true + }) + }) + gtest.C(t, func(t *gtest.T) { + array.IteratorDesc(func(k int, v any) bool { + t.Assert(v, slice[k]) + return true + }) + }) + gtest.C(t, func(t *gtest.T) { + index := 0 + array.Iterator(func(k int, v any) bool { + index++ + return false + }) + t.Assert(index, 1) + }) + gtest.C(t, func(t *gtest.T) { + index := 0 + array.IteratorAsc(func(k int, v any) bool { + index++ + return false + }) + t.Assert(index, 1) + }) + gtest.C(t, func(t *gtest.T) { + index := 0 + array.IteratorDesc(func(k int, v any) bool { + index++ + return false + }) + t.Assert(index, 1) + }) +} + +func TestTArray_RemoveValue(t *testing.T) { + slice := g.Slice{"a", "b", "d", "c"} + array := garray.NewTArrayFrom(slice) + gtest.C(t, func(t *gtest.T) { + t.Assert(array.RemoveValue("e"), false) + t.Assert(array.RemoveValue("b"), true) + t.Assert(array.RemoveValue("a"), true) + t.Assert(array.RemoveValue("c"), true) + t.Assert(array.RemoveValue("f"), false) + }) +} + +func TestTArray_RemoveValues(t *testing.T) { + slice := g.SliceStr{"a", "b", "d", "c"} + array := garray.NewTArrayFrom(slice) + gtest.C(t, func(t *gtest.T) { + array.RemoveValues("a", "b", "c") + t.Assert(array.Slice(), g.Slice{"d"}) + }) +} + +func TestTArray_UnmarshalValue(t *testing.T) { + type V struct { + Name string + Array *garray.Array + } + // JSON + gtest.C(t, func(t *gtest.T) { + var v *V + err := gconv.Struct(g.Map{ + "name": "john", + "array": []byte(`[1,2,3]`), + }, &v) + t.AssertNil(err) + t.Assert(v.Name, "john") + t.Assert(v.Array.Slice(), g.Slice{1, 2, 3}) + }) + // Map + gtest.C(t, func(t *gtest.T) { + var v *V + err := gconv.Struct(g.Map{ + "name": "john", + "array": g.Slice{1, 2, 3}, + }, &v) + t.AssertNil(err) + t.Assert(v.Name, "john") + t.Assert(v.Array.Slice(), g.Slice{1, 2, 3}) + }) +} + +func TestTArray_FilterNil(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + values := g.Slice{0, 1, 2, 3, 4, "", g.Slice{}} + array := garray.NewTArrayFromCopy(values) + t.Assert(array.FilterNil().Slice(), values) + }) + gtest.C(t, func(t *gtest.T) { + array := garray.NewTArrayFromCopy(g.Slice{nil, 1, 2, 3, 4, nil}) + t.Assert(array.FilterNil(), g.Slice{1, 2, 3, 4}) + }) +} + +func TestTArray_Filter(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + values := g.Slice{0, 1, 2, 3, 4, "", g.Slice{}} + array := garray.NewTArrayFromCopy(values) + t.Assert(array.Filter(func(index int, value any) bool { + return empty.IsNil(value) + }).Slice(), values) + }) + gtest.C(t, func(t *gtest.T) { + array := garray.NewTArrayFromCopy(g.Slice{nil, 1, 2, 3, 4, nil}) + t.Assert(array.Filter(func(index int, value any) bool { + return empty.IsNil(value) + }), g.Slice{1, 2, 3, 4}) + }) + gtest.C(t, func(t *gtest.T) { + array := garray.NewTArrayFrom(g.Slice{0, 1, 2, 3, 4, "", g.Slice{}}) + + t.Assert(array.Filter(func(index int, value any) bool { + return empty.IsEmpty(value) + }), g.Slice{1, 2, 3, 4}) + }) + gtest.C(t, func(t *gtest.T) { + array := garray.NewTArrayFrom(g.Slice{1, 2, 3, 4}) + + t.Assert(array.Filter(func(index int, value any) bool { + return empty.IsEmpty(value) + }), g.Slice{1, 2, 3, 4}) + }) +} + +func TestTArray_FilterEmpty(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + array := garray.NewTArrayFrom(g.Slice{0, 1, 2, 3, 4, "", g.Slice{}}) + t.Assert(array.FilterEmpty(), g.Slice{1, 2, 3, 4}) + }) + gtest.C(t, func(t *gtest.T) { + array := garray.NewTArrayFrom(g.Slice{1, 2, 3, 4}) + t.Assert(array.FilterEmpty(), g.Slice{1, 2, 3, 4}) + }) +} + +func TestTArray_Walk(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + array := garray.NewTArrayFrom(g.Slice{"1", "2"}) + t.Assert(array.Walk(func(value any) any { + return "key-" + gconv.String(value) + }), g.Slice{"key-1", "key-2"}) + }) +} diff --git a/container/garray/garray_z_unit_sorted_any_test.go b/container/garray/garray_z_unit_sorted_any_test.go index 9d6a80e24..28e7413b4 100644 --- a/container/garray/garray_z_unit_sorted_any_test.go +++ b/container/garray/garray_z_unit_sorted_any_test.go @@ -939,25 +939,30 @@ func TestSortedArray_Filter(t *testing.T) { func TestSortedArray_FilterNil(t *testing.T) { gtest.C(t, func(t *gtest.T) { - values := g.Slice{0, 1, 2, 3, 4, "", g.Slice{}} + values := g.Slice{0, 1, 2, 3, 4, "", nil, g.Slice{}} array := garray.NewSortedArrayFromCopy(values, gutil.ComparatorInt) t.Assert(array.FilterNil().Slice(), g.Slice{0, "", g.Slice{}, 1, 2, 3, 4}) }) gtest.C(t, func(t *gtest.T) { - array := garray.NewSortedArrayFromCopy(g.Slice{nil, 1, 2, 3, 4, nil}, gutil.ComparatorInt) + array := garray.NewSortedArrayFromCopy(g.Slice{nil, 1, 2, nil, 3, 4, nil}, gutil.ComparatorInt) t.Assert(array.FilterNil(), g.Slice{1, 2, 3, 4}) }) } func TestSortedArray_FilterEmpty(t *testing.T) { gtest.C(t, func(t *gtest.T) { - array := garray.NewSortedArrayFrom(g.Slice{0, 1, 2, 3, 4, "", g.Slice{}}, gutil.ComparatorInt) - t.Assert(array.FilterEmpty(), g.Slice{1, 2, 3, 4}) + array := garray.NewSortedArrayFrom(g.Slice{0, 1, 2, 0, -1, 3, 4, "", g.Slice{}}, gutil.ComparatorInt) + t.Assert(array.FilterEmpty(), g.Slice{-1, 1, 2, 3, 4}) }) gtest.C(t, func(t *gtest.T) { array := garray.NewSortedArrayFrom(g.Slice{1, 2, 3, 4}, gutil.ComparatorInt) t.Assert(array.FilterEmpty(), g.Slice{1, 2, 3, 4}) }) + gtest.C(t, func(t *gtest.T) { + values := g.Slice{0, 1, 2, 3, 4, -1, -2, nil, []any{}, ""} + array := garray.NewSortedArrayFrom(values, gutil.ComparatorString) + t.Assert(array.FilterEmpty().Slice(), g.Slice{-1, -2, 1, 2, 3, 4}) + }) } func TestSortedArray_Walk(t *testing.T) { diff --git a/container/garray/garray_z_unit_sorted_int_test.go b/container/garray/garray_z_unit_sorted_int_test.go index b218ada96..f599e2924 100644 --- a/container/garray/garray_z_unit_sorted_int_test.go +++ b/container/garray/garray_z_unit_sorted_int_test.go @@ -794,8 +794,22 @@ func TestSortedIntArray_Filter(t *testing.T) { func TestSortedIntArray_FilterEmpty(t *testing.T) { gtest.C(t, func(t *gtest.T) { - array := garray.NewSortedIntArrayFrom(g.SliceInt{0, 1, 2, 3, 4, 0}) - t.Assert(array.FilterEmpty(), g.SliceInt{1, 2, 3, 4}) + array := garray.NewSortedIntArrayFrom(g.SliceInt{0, 1, -1, 2, 3, 4, 0}) + t.Assert(array.FilterEmpty(), g.SliceInt{-1, 1, 2, 3, 4}) + }) + gtest.C(t, func(t *gtest.T) { + array := garray.NewSortedIntArrayFrom(g.SliceInt{0, 0, 0, 0, 0, 0, 1}) + array.SetComparator(func(a, b int) int { + if a == b { + return 0 + } + if a < b { + return 1 + } else { + return -1 + } + }) + t.Assert(array.FilterEmpty(), g.SliceInt{1}) }) gtest.C(t, func(t *gtest.T) { array := garray.NewSortedIntArrayFrom(g.SliceInt{1, 2, 3, 4}) diff --git a/container/garray/garray_z_unit_sorted_str_test.go b/container/garray/garray_z_unit_sorted_str_test.go index b67d2fe90..0a0cfafd5 100644 --- a/container/garray/garray_z_unit_sorted_str_test.go +++ b/container/garray/garray_z_unit_sorted_str_test.go @@ -806,9 +806,23 @@ func TestSortedStrArray_Filter(t *testing.T) { func TestSortedStrArray_FilterEmpty(t *testing.T) { gtest.C(t, func(t *gtest.T) { - array := garray.NewSortedStrArrayFrom(g.SliceStr{"", "1", "2", "0"}) + array := garray.NewSortedStrArrayFrom(g.SliceStr{"", "1", "", "2", "0", ""}) t.Assert(array.FilterEmpty(), g.SliceStr{"0", "1", "2"}) }) + gtest.C(t, func(t *gtest.T) { + array := garray.NewSortedStrArrayFrom(g.SliceStr{"", "", "", "2", "0", "a", "b"}) + array.SetComparator(func(a, b string) int { + if a == b { + return 0 + } + if a < b { + return 1 + } else { + return -1 + } + }) + t.Assert(array.FilterEmpty(), g.SliceStr{"b", "a", "2", "0"}) + }) gtest.C(t, func(t *gtest.T) { array := garray.NewSortedStrArrayFrom(g.SliceStr{"1", "2"}) t.Assert(array.FilterEmpty(), g.SliceStr{"1", "2"}) diff --git a/container/garray/garray_z_unit_sorted_t_test.go b/container/garray/garray_z_unit_sorted_t_test.go new file mode 100644 index 000000000..a366ba77d --- /dev/null +++ b/container/garray/garray_z_unit_sorted_t_test.go @@ -0,0 +1,924 @@ +// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://github.com/gogf/gf. + +// go test *.go + +package garray_test + +import ( + "strings" + "testing" + "time" + + "github.com/gogf/gf/v2/container/garray" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/internal/empty" + "github.com/gogf/gf/v2/internal/json" + "github.com/gogf/gf/v2/test/gtest" + "github.com/gogf/gf/v2/util/gconv" + "github.com/gogf/gf/v2/util/gutil" +) + +func TestSortedTArray_NewSortedTArrayFrom(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []string{"a", "f", "c"} + a2 := []string{"h", "j", "i", "k"} + func1 := func(v1, v2 string) int { + return strings.Compare(v1, v2) + } + func2 := func(v1, v2 string) int { + return -1 + } + array1 := garray.NewSortedTArrayFrom(a1, func1) + array2 := garray.NewSortedTArrayFrom(a2, func2) + + t.Assert(array1.Len(), 3) + t.Assert(array1, []string{"a", "c", "f"}) + + t.Assert(array2.Len(), 4) + t.Assert(array2, []string{"k", "i", "j", "h"}) + }) +} + +func TestNewSortedTArrayFromCopy(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []string{"a", "f", "c"} + + func1 := func(v1, v2 string) int { + return strings.Compare(gconv.String(v1), gconv.String(v2)) + } + func2 := func(v1, v2 string) int { + return -1 + } + array1 := garray.NewSortedTArrayFromCopy(a1, func1) + array2 := garray.NewSortedTArrayFromCopy(a1, func2) + t.Assert(array1.Len(), 3) + t.Assert(array1, []string{"a", "c", "f"}) + t.Assert(array1.Len(), 3) + t.Assert(array2, []string{"c", "f", "a"}) + }) +} + +func TestSortedTArray_SetArray(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []string{"a", "f", "c"} + a2 := []string{"e", "h", "g", "k"} + + func1 := func(v1, v2 string) int { + return strings.Compare(v1, v2) + } + + array1 := garray.NewSortedTArrayFrom(a1, func1) + array1.SetArray(a2) + t.Assert(array1.Len(), 4) + t.Assert(array1, []string{"e", "g", "h", "k"}) + }) + +} + +func TestSortedTArray_Sort(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []string{"a", "f", "c"} + array1 := garray.NewSortedTArrayFrom(a1, gutil.ComparatorT) + array1.Sort() + t.Assert(array1.Len(), 3) + t.Assert(array1, []string{"a", "c", "f"}) + }) + +} + +func TestSortedTArray_Get(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []string{"a", "f", "c"} + array1 := garray.NewSortedTArrayFrom(a1, gutil.ComparatorT) + v, ok := array1.Get(2) + t.Assert(v, "f") + t.Assert(ok, true) + + v, ok = array1.Get(1) + t.Assert(v, "c") + t.Assert(ok, true) + + v, ok = array1.Get(99) + t.Assert(v, nil) + t.Assert(ok, false) + }) + +} + +func TestSortedTArray_At(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []string{"a", "f", "c"} + array1 := garray.NewSortedTArrayFrom(a1, gutil.ComparatorT) + v := array1.At(2) + t.Assert(v, "f") + }) +} + +func TestSortedTArray_Remove(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []string{"a", "d", "c", "b"} + array1 := garray.NewSortedTArrayFrom(a1, gutil.ComparatorT) + i1, ok := array1.Remove(1) + t.Assert(ok, true) + t.Assert(gconv.String(i1), "b") + t.Assert(array1.Len(), 3) + t.Assert(array1.Contains("b"), false) + + v, ok := array1.Remove(-1) + t.Assert(v, nil) + t.Assert(ok, false) + + v, ok = array1.Remove(100000) + t.Assert(v, nil) + t.Assert(ok, false) + + i2, ok := array1.Remove(0) + t.Assert(ok, true) + t.Assert(gconv.String(i2), "a") + t.Assert(array1.Len(), 2) + t.Assert(array1.Contains("a"), false) + + i3, ok := array1.Remove(1) + t.Assert(ok, true) + t.Assert(gconv.String(i3), "d") + t.Assert(array1.Len(), 1) + t.Assert(array1.Contains("d"), false) + }) + +} + +func TestSortedTArray_PopLeft(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + array1 := garray.NewSortedTArrayFrom( + []string{"a", "d", "c", "b"}, + gutil.ComparatorT, + ) + i1, ok := array1.PopLeft() + t.Assert(ok, true) + t.Assert(gconv.String(i1), "a") + t.Assert(array1.Len(), 3) + t.Assert(array1, []any{"b", "c", "d"}) + }) + gtest.C(t, func(t *gtest.T) { + array := garray.NewSortedTArrayFrom(g.SliceInt{1, 2, 3}, gutil.ComparatorT) + v, ok := array.PopLeft() + t.Assert(v, 1) + t.Assert(ok, true) + t.Assert(array.Len(), 2) + v, ok = array.PopLeft() + t.Assert(v, 2) + t.Assert(ok, true) + t.Assert(array.Len(), 1) + v, ok = array.PopLeft() + t.Assert(v, 3) + t.Assert(ok, true) + t.Assert(array.Len(), 0) + }) +} + +func TestSortedTArray_PopRight(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + array1 := garray.NewSortedTArrayFrom( + []string{"a", "d", "c", "b"}, + gutil.ComparatorT, + ) + i1, ok := array1.PopRight() + t.Assert(ok, true) + t.Assert(gconv.String(i1), "d") + t.Assert(array1.Len(), 3) + t.Assert(array1, []any{"a", "b", "c"}) + }) + gtest.C(t, func(t *gtest.T) { + array := garray.NewSortedTArrayFrom(g.SliceInt{1, 2, 3}, gutil.ComparatorT) + v, ok := array.PopRight() + t.Assert(v, 3) + t.Assert(ok, true) + t.Assert(array.Len(), 2) + + v, ok = array.PopRight() + t.Assert(v, 2) + t.Assert(ok, true) + t.Assert(array.Len(), 1) + + v, ok = array.PopRight() + t.Assert(v, 1) + t.Assert(ok, true) + t.Assert(array.Len(), 0) + }) +} + +func TestSortedTArray_PopRand(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []string{"a", "d", "c", "b"} + array1 := garray.NewSortedTArrayFrom(a1, gutil.ComparatorT) + i1, ok := array1.PopRand() + t.Assert(ok, true) + t.AssertIN(i1, []string{"a", "d", "c", "b"}) + t.Assert(array1.Len(), 3) + + }) +} + +func TestSortedTArray_PopRands(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []string{"a", "d", "c", "b"} + array1 := garray.NewSortedTArrayFrom(a1, gutil.ComparatorT) + i1 := array1.PopRands(2) + t.Assert(len(i1), 2) + t.AssertIN(i1, []string{"a", "d", "c", "b"}) + t.Assert(array1.Len(), 2) + + i2 := array1.PopRands(3) + t.Assert(len(i2), 2) + t.AssertIN(i2, []string{"a", "d", "c", "b"}) + t.Assert(array1.Len(), 0) + + }) +} + +func TestSortedTArray_Empty(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + array := garray.NewSortedTArray[int](gutil.ComparatorT) + v, ok := array.PopLeft() + t.Assert(v, 0) + t.Assert(ok, false) + t.Assert(array.PopLefts(10), nil) + + v, ok = array.PopRight() + t.Assert(v, 0) + t.Assert(ok, false) + t.Assert(array.PopRights(10), nil) + + v, ok = array.PopRand() + t.Assert(v, 0) + t.Assert(ok, false) + t.Assert(array.PopRands(10), nil) + }) +} + +func TestSortedTArray_PopLefts(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []string{"a", "d", "c", "b", "e", "f"} + array1 := garray.NewSortedTArrayFrom(a1, gutil.ComparatorT) + i1 := array1.PopLefts(2) + t.Assert(len(i1), 2) + t.AssertIN(i1, []string{"a", "d", "c", "b", "e", "f"}) + t.Assert(array1.Len(), 4) + + i2 := array1.PopLefts(5) + t.Assert(len(i2), 4) + t.AssertIN(i2, []string{"a", "d", "c", "b", "e", "f"}) + t.Assert(array1.Len(), 0) + }) +} + +func TestSortedTArray_PopRights(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []string{"a", "d", "c", "b", "e", "f"} + array1 := garray.NewSortedTArrayFrom(a1, gutil.ComparatorT) + i1 := array1.PopRights(2) + t.Assert(len(i1), 2) + t.Assert(i1, []string{"e", "f"}) + t.Assert(array1.Len(), 4) + + i2 := array1.PopRights(10) + t.Assert(len(i2), 4) + t.Assert(array1.Len(), 0) + }) +} + +func TestSortedTArray_Range(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []string{"a", "d", "c", "b", "e", "f"} + array1 := garray.NewSortedTArrayFrom(a1, gutil.ComparatorT) + array2 := garray.NewSortedTArrayFrom(a1, gutil.ComparatorT, true) + i1 := array1.Range(2, 5) + t.Assert(i1, []string{"c", "d", "e"}) + t.Assert(array1.Len(), 6) + + i2 := array1.Range(7, 5) + t.Assert(len(i2), 0) + i2 = array1.Range(-1, 2) + t.Assert(i2, []string{"a", "b"}) + + i2 = array1.Range(4, 10) + t.Assert(len(i2), 2) + t.Assert(i2, []string{"e", "f"}) + + t.Assert(array2.Range(1, 3), []string{"b", "c"}) + + }) +} + +func TestSortedTArray_Sum(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []string{"a", "d", "c", "b", "e", "f"} + a2 := []string{"1", "2", "3", "b", "e", "f"} + a3 := []string{"4", "5", "6"} + array1 := garray.NewSortedTArrayFrom(a1, gutil.ComparatorT) + array2 := garray.NewSortedTArrayFrom(a2, gutil.ComparatorT) + array3 := garray.NewSortedTArrayFrom(a3, gutil.ComparatorT) + t.Assert(array1.Sum(), 0) + t.Assert(array2.Sum(), 6) + t.Assert(array3.Sum(), 15) + + }) +} + +func TestSortedTArray_Clone(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []string{"a", "d", "c", "b", "e", "f"} + + array1 := garray.NewSortedTArrayFrom(a1, nil) + array2 := array1.Clone() + t.Assert(array1, array2) + array1.Remove(1) + t.AssertNE(array1, array2) + + }) +} + +func TestSortedTArray_Clear(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []string{"a", "d", "c", "b", "e", "f"} + + array1 := garray.NewSortedTArrayFrom(a1, nil) + t.Assert(array1.Len(), 6) + array1.Clear() + t.Assert(array1.Len(), 0) + + }) +} + +func TestSortedTArray_Chunk(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []string{"a", "d", "c", "b", "e"} + + array1 := garray.NewSortedTArrayFrom(a1, nil) + i1 := array1.Chunk(2) + t.Assert(len(i1), 3) + t.Assert(i1[0], []any{"a", "b"}) + t.Assert(i1[2], []any{"e"}) + + i1 = array1.Chunk(0) + t.Assert(len(i1), 0) + }) + gtest.C(t, func(t *gtest.T) { + a1 := []int32{1, 2, 3, 4, 5} + array1 := garray.NewSortedTArrayFrom(a1, nil) + chunks := array1.Chunk(3) + t.Assert(len(chunks), 2) + t.Assert(chunks[0], []int32{1, 2, 3}) + t.Assert(chunks[1], []int32{4, 5}) + t.Assert(array1.Chunk(0), nil) + }) + gtest.C(t, func(t *gtest.T) { + a1 := []int{1, 2, 3, 4, 5, 6} + array1 := garray.NewSortedTArrayFrom(a1, nil) + chunks := array1.Chunk(2) + t.Assert(len(chunks), 3) + t.Assert(chunks[0], []int{1, 2}) + t.Assert(chunks[1], []int{3, 4}) + t.Assert(chunks[2], []int{5, 6}) + t.Assert(array1.Chunk(0), nil) + }) + gtest.C(t, func(t *gtest.T) { + a1 := []int{1, 2, 3, 4, 5, 6} + array1 := garray.NewSortedTArrayFrom(a1, nil) + chunks := array1.Chunk(3) + t.Assert(len(chunks), 2) + t.Assert(chunks[0], []int{1, 2, 3}) + t.Assert(chunks[1], []int{4, 5, 6}) + t.Assert(array1.Chunk(0), nil) + }) +} + +func TestSortedTArray_SubSlice(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []string{"a", "d", "c", "b", "e"} + + array1 := garray.NewSortedTArrayFrom(a1, nil) + array2 := garray.NewSortedTArrayFrom(a1, nil, true) + i1 := array1.SubSlice(2, 3) + t.Assert(len(i1), 3) + t.Assert(i1, []string{"c", "d", "e"}) + + i1 = array1.SubSlice(2, 6) + t.Assert(len(i1), 3) + t.Assert(i1, []string{"c", "d", "e"}) + + i1 = array1.SubSlice(7, 2) + t.Assert(len(i1), 0) + + s1 := array1.SubSlice(1, -2) + t.Assert(s1, nil) + + s1 = array1.SubSlice(-9, 2) + t.Assert(s1, nil) + t.Assert(array2.SubSlice(1, 3), []string{"b", "c", "d"}) + + }) +} + +func TestSortedTArray_Rand(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []string{"a", "d", "c"} + + array1 := garray.NewSortedTArrayFrom(a1, nil) + i1, ok := array1.Rand() + t.Assert(ok, true) + t.AssertIN(i1, []string{"a", "d", "c"}) + t.Assert(array1.Len(), 3) + + array2 := garray.NewSortedTArrayFrom([]string{}, nil) + v, ok := array2.Rand() + t.Assert(ok, false) + t.Assert(v, nil) + }) +} + +func TestSortedTArray_Rands(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []string{"a", "d", "c"} + + array1 := garray.NewSortedTArrayFrom(a1, nil) + i1 := array1.Rands(2) + t.AssertIN(i1, []string{"a", "d", "c"}) + t.Assert(len(i1), 2) + t.Assert(array1.Len(), 3) + + i1 = array1.Rands(4) + t.Assert(len(i1), 4) + + array2 := garray.NewSortedTArrayFrom([]string{}, nil) + v := array2.Rands(1) + t.Assert(v, nil) + }) +} + +func TestSortedTArray_Join(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []string{"a", "d", "c"} + array1 := garray.NewSortedTArrayFrom(a1, nil) + t.Assert(array1.Join(","), `a,c,d`) + t.Assert(array1.Join("."), `a.c.d`) + }) + + gtest.C(t, func(t *gtest.T) { + a1 := []string{"0", "1", `"a"`, `\a`} + array1 := garray.NewSortedTArrayFrom(a1, nil) + t.Assert(array1.Join("."), `"a".0.1.\a`) + }) + + gtest.C(t, func(t *gtest.T) { + a1 := []string{} + array1 := garray.NewSortedTArrayFrom(a1, nil) + t.Assert(array1.Join("."), "") + }) +} + +func TestSortedTArray_String(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []string{"0", "1", "a", "b"} + array1 := garray.NewSortedTArrayFrom(a1, nil) + t.Assert(array1.String(), `[0,1,"a","b"]`) + + array1 = nil + t.Assert(array1.String(), "") + }) +} + +func TestSortedTArray_CountValues(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []string{"a", "d", "c", "c"} + + array1 := garray.NewSortedTArrayFrom(a1, nil) + m1 := array1.CountValues() + t.Assert(len(m1), 3) + t.Assert(m1["c"], 2) + t.Assert(m1["a"], 1) + + }) +} + +func TestSortedTArray_SetUnique(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []int{1, 2, 3, 4, 5, 3, 2, 2, 3, 5, 5} + array1 := garray.NewSortedTArrayFrom(a1, nil) + array1.SetUnique(true) + t.Assert(array1.Len(), 5) + t.Assert(array1, []int{1, 2, 3, 4, 5}) + }) +} + +func TestSortedTArray_Unique(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + a1 := []int{1, 2, 3, 4, 5, 3, 2, 2, 3, 5, 5} + array1 := garray.NewSortedTArrayFrom(a1, nil) + array1.Unique() + t.Assert(array1.Len(), 5) + t.Assert(array1, []int{1, 2, 3, 4, 5}) + + array2 := garray.NewSortedTArrayFrom([]int{}, nil) + array2.Unique() + t.Assert(array2.Len(), 0) + t.Assert(array2, []int{}) + }) +} + +func TestSortedTArray_LockFunc(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + s1 := []string{"a", "b", "c", "d"} + a1 := garray.NewSortedTArrayFrom(s1, nil, true) + + ch1 := make(chan int64, 3) + ch2 := make(chan int64, 3) + // go1 + go a1.LockFunc(func(n1 []string) { // 读写锁 + time.Sleep(2 * time.Second) // 暂停2秒 + n1[2] = "g" + ch2 <- gconv.Int64(time.Now().UnixNano() / 1000 / 1000) + }) + + // go2 + go func() { + time.Sleep(100 * time.Millisecond) // 故意暂停0.01秒,等go1执行锁后,再开始执行. + ch1 <- gconv.Int64(time.Now().UnixNano() / 1000 / 1000) + a1.Len() + ch1 <- gconv.Int64(time.Now().UnixNano() / 1000 / 1000) + }() + + t1 := <-ch1 + t2 := <-ch1 + <-ch2 // 等待go1完成 + + // 防止ci抖动,以豪秒为单位 + t.AssertGT(t2-t1, 20) // go1加的读写互斥锁,所go2读的时候被阻塞。 + t.Assert(a1.Contains("g"), true) + }) +} + +func TestSortedTArray_RLockFunc(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + s1 := []string{"a", "b", "c", "d"} + a1 := garray.NewSortedTArrayFrom(s1, nil, true) + + ch1 := make(chan int64, 3) + ch2 := make(chan int64, 3) + // go1 + go a1.RLockFunc(func(n1 []string) { // 读写锁 + time.Sleep(2 * time.Second) // 暂停2秒 + n1[2] = "g" + ch2 <- gconv.Int64(time.Now().UnixNano() / 1000 / 1000) + }) + + // go2 + go func() { + time.Sleep(100 * time.Millisecond) // 故意暂停0.01秒,等go1执行锁后,再开始执行. + ch1 <- gconv.Int64(time.Now().UnixNano() / 1000 / 1000) + a1.Len() + ch1 <- gconv.Int64(time.Now().UnixNano() / 1000 / 1000) + }() + + t1 := <-ch1 + t2 := <-ch1 + <-ch2 // 等待go1完成 + + // 防止ci抖动,以豪秒为单位 + t.AssertLT(t2-t1, 20) // go1加的读锁,所go2读的时候不会被阻塞。 + t.Assert(a1.Contains("g"), true) + }) +} + +func TestSortedTArray_Merge(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + + s1 := []string{"a", "b", "c", "d"} + s2 := []string{"e", "f"} + i1 := garray.NewIntArrayFrom([]int{1, 2, 3}) + i2 := garray.NewArrayFrom([]any{3}) + s3 := garray.NewStrArrayFrom([]string{"g", "h"}) + s4 := garray.NewSortedTArrayFrom([]int{4, 5}, nil) + s5 := garray.NewSortedStrArrayFrom(s2) + s6 := garray.NewSortedIntArrayFrom([]int{1, 2, 3}) + + a1 := garray.NewSortedTArrayFrom(s1, nil) + + t.Assert(a1.Merge(s2).Len(), 6) + t.Assert(a1.Merge(i1).Len(), 9) + t.Assert(a1.Merge(i2).Len(), 10) + t.Assert(a1.Merge(s3).Len(), 12) + t.Assert(a1.Merge(s4).Len(), 14) + t.Assert(a1.Merge(s5).Len(), 16) + t.Assert(a1.Merge(s6).Len(), 19) + }) +} + +func TestSortedTArray_Json(t *testing.T) { + // array pointer + gtest.C(t, func(t *gtest.T) { + s1 := []string{"a", "b", "d", "c"} + s2 := []string{"a", "b", "c", "d"} + a1 := garray.NewSortedTArrayFrom(s1, nil) + b1, err1 := json.Marshal(a1) + b2, err2 := json.Marshal(s1) + t.Assert(b1, b2) + t.Assert(err1, err2) + + a2 := garray.NewSortedTArray[string](nil) + err1 = json.UnmarshalUseNumber(b2, &a2) + t.AssertNil(err1) + t.Assert(a2.Slice(), s2) + + var a3 garray.SortedTArray[string] + a3.SetComparator(nil) + err := json.UnmarshalUseNumber(b2, &a3) + t.AssertNil(err) + t.Assert(a3.Slice(), s1) + t.Assert(a3.Interfaces(), s1) + }) + // array value + gtest.C(t, func(t *gtest.T) { + s1 := []string{"a", "b", "d", "c"} + s2 := []string{"a", "b", "c", "d"} + a1 := garray.NewSortedTArrayFrom(s1, nil) + b1, err1 := json.Marshal(a1) + b2, err2 := json.Marshal(s1) + t.Assert(b1, b2) + t.Assert(err1, err2) + + a2 := garray.NewSortedTArray[string](nil) + err1 = json.UnmarshalUseNumber(b2, &a2) + t.AssertNil(err1) + t.Assert(a2.Slice(), s2) + + var a3 garray.SortedTArray[string] + a3.SetComparator(nil) + err := json.UnmarshalUseNumber(b2, &a3) + t.AssertNil(err) + t.Assert(a3.Slice(), s1) + t.Assert(a3.Interfaces(), s1) + }) + // array pointer + gtest.C(t, func(t *gtest.T) { + type User struct { + Name string + Scores *garray.SortedTArray[int] + } + data := g.Map{ + "Name": "john", + "Scores": []int{99, 100, 98}, + } + b, err := json.Marshal(data) + t.AssertNil(err) + + user := new(User) + err = json.UnmarshalUseNumber(b, user) + t.AssertNil(err) + t.Assert(user.Name, data["Name"]) + t.AssertNE(user.Scores, nil) + t.Assert(user.Scores.Len(), 3) + + v, ok := user.Scores.PopLeft() + t.AssertIN(v, data["Scores"]) + t.Assert(ok, true) + + v, ok = user.Scores.PopLeft() + t.AssertIN(v, data["Scores"]) + t.Assert(ok, true) + + v, ok = user.Scores.PopLeft() + t.AssertIN(v, data["Scores"]) + t.Assert(ok, true) + + v, ok = user.Scores.PopLeft() + t.Assert(v, 0) + t.Assert(ok, false) + }) + // array value + gtest.C(t, func(t *gtest.T) { + type User struct { + Name string + Scores *garray.SortedTArray[int] + } + data := g.Map{ + "Name": "john", + "Scores": []int{99, 100, 98}, + } + b, err := json.Marshal(data) + t.AssertNil(err) + + user := new(User) + err = json.UnmarshalUseNumber(b, user) + t.AssertNil(err) + t.Assert(user.Name, data["Name"]) + t.AssertNE(user.Scores, nil) + t.Assert(user.Scores.Len(), 3) + + v, ok := user.Scores.PopLeft() + t.AssertIN(v, data["Scores"]) + t.Assert(ok, true) + + v, ok = user.Scores.PopLeft() + t.AssertIN(v, data["Scores"]) + t.Assert(ok, true) + + v, ok = user.Scores.PopLeft() + t.AssertIN(v, data["Scores"]) + t.Assert(ok, true) + + v, ok = user.Scores.PopLeft() + t.Assert(v, 0) + t.Assert(ok, false) + }) +} + +func TestSortedTArray_Iterator(t *testing.T) { + slice := g.SliceStr{"a", "b", "d", "c"} + array := garray.NewSortedTArrayFrom(slice, nil) + gtest.C(t, func(t *gtest.T) { + array.Iterator(func(k int, v string) bool { + t.Assert(v, slice[k]) + return true + }) + }) + gtest.C(t, func(t *gtest.T) { + array.IteratorAsc(func(k int, v string) bool { + t.Assert(v, slice[k]) + return true + }) + }) + gtest.C(t, func(t *gtest.T) { + array.IteratorDesc(func(k int, v string) bool { + t.Assert(v, slice[k]) + return true + }) + }) + gtest.C(t, func(t *gtest.T) { + index := 0 + array.Iterator(func(k int, v string) bool { + index++ + return false + }) + t.Assert(index, 1) + }) + gtest.C(t, func(t *gtest.T) { + index := 0 + array.IteratorAsc(func(k int, v string) bool { + index++ + return false + }) + t.Assert(index, 1) + }) + gtest.C(t, func(t *gtest.T) { + index := 0 + array.IteratorDesc(func(k int, v string) bool { + index++ + return false + }) + t.Assert(index, 1) + }) +} + +func TestSortedTArray_RemoveValue(t *testing.T) { + slice := g.SliceStr{"a", "b", "d", "c"} + array := garray.NewSortedTArrayFrom(slice, nil) + gtest.C(t, func(t *gtest.T) { + t.Assert(array.RemoveValue("e"), false) + t.Assert(array.RemoveValue("b"), true) + t.Assert(array.RemoveValue("a"), true) + t.Assert(array.RemoveValue("c"), true) + t.Assert(array.RemoveValue("f"), false) + }) +} + +func TestSortedTArray_RemoveValues(t *testing.T) { + slice := g.SliceStr{"a", "b", "d", "c"} + array := garray.NewSortedTArrayFrom(slice, nil) + gtest.C(t, func(t *gtest.T) { + array.RemoveValues("a", "b", "c") + t.Assert(array.Slice(), g.SliceStr{"d"}) + }) +} + +func TestSortedTArray_UnmarshalValue(t *testing.T) { + type V struct { + Name string + Array *garray.SortedTArray[int] + } + // JSON + gtest.C(t, func(t *gtest.T) { + var v *V + err := gconv.Struct(g.Map{ + "name": "john", + "array": []byte(`[2,3,1]`), + }, &v) + t.AssertNil(err) + t.Assert(v.Name, "john") + t.Assert(v.Array.Slice(), g.Slice{1, 2, 3}) + }) + // Map + gtest.C(t, func(t *gtest.T) { + var v *V + err := gconv.Struct(g.Map{ + "name": "john", + "array": g.SliceInt{2, 3, 1}, + }, &v) + t.AssertNil(err) + t.Assert(v.Name, "john") + t.Assert(v.Array.Slice(), g.Slice{1, 2, 3}) + }) +} +func TestSortedTArray_Filter(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + values := g.SliceInt{0, 1, 2, 3, 4, -1, -2} + array := garray.NewSortedTArrayFromCopy(values, nil) + t.Assert(array.Filter(func(index int, value int) bool { + return value < 0 + }).Slice(), g.Slice{0, 1, 2, 3, 4}) + }) + gtest.C(t, func(t *gtest.T) { + array := garray.NewSortedTArrayFromCopy(g.SliceInt{-1, 1, 2, 3, 4, -2}, nil) + t.Assert(array.Filter(func(index int, value int) bool { + return value < 0 + }), g.Slice{1, 2, 3, 4}) + }) + gtest.C(t, func(t *gtest.T) { + array := garray.NewSortedTArrayFrom(g.SliceInt{0, 1, 2, 3, 4, 0, 0}, nil) + t.Assert(array.Filter(func(index int, value int) bool { + return empty.IsEmpty(value) + }), g.Slice{1, 2, 3, 4}) + }) + gtest.C(t, func(t *gtest.T) { + array := garray.NewSortedTArrayFrom(g.SliceInt{1, 2, 3, 4}, nil) + t.Assert(array.Filter(func(index int, value int) bool { + return empty.IsEmpty(value) + }), g.Slice{1, 2, 3, 4}) + }) +} + +func TestSortedTArray_FilterNil(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + values := g.SliceInt{0, 1, 2, 3, 4, -1, -2} + array := garray.NewSortedTArrayFromCopy(values, gutil.ComparatorT) + t.Assert(array.FilterNil().Slice(), g.SliceInt{-2, -1, 0, 1, 2, 3, 4}) + }) + + gtest.C(t, func(t *gtest.T) { + values := g.Slice{0, 1, 2, 3, 4, -1, -2, nil, []any{}, ""} + array := garray.NewSortedTArrayFromCopy(values, nil) + t.Assert(array.FilterNil().Slice(), g.Slice{"", -1, -2, 0, 1, 2, 3, 4, []any{}}) + }) +} + +func TestSortedTArray_FilterEmpty(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + array := garray.NewSortedTArrayFrom(g.SliceInt{0, 1, 2, 3, 4, 0, 0}, nil) + t.Assert(array.FilterEmpty(), g.Slice{1, 2, 3, 4}) + }) + gtest.C(t, func(t *gtest.T) { + array := garray.NewSortedTArrayFrom(g.SliceInt{1, 2, 3, 4}, nil) + t.Assert(array.FilterEmpty(), g.Slice{1, 2, 3, 4}) + }) + gtest.C(t, func(t *gtest.T) { + array := garray.NewSortedTArrayFrom(g.SliceStr{"a", "", "b", "c", ""}, nil) + t.Assert(array.FilterEmpty(), g.Slice{"a", "b", "c"}) + }) + gtest.C(t, func(t *gtest.T) { + values := g.Slice{0, 1, 2, 3, 4, -1, -2, nil, []any{}, ""} + array := garray.NewSortedTArrayFromCopy(values, nil) + t.Assert(array.FilterEmpty().Slice(), g.Slice{-1, -2, 1, 2, 3, 4}) + }) +} + +func TestSortedTArray_Walk(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + array := garray.NewSortedTArrayFrom(g.SliceStr{"1", "2"}, nil) + t.Assert(array.Walk(func(value string) string { + return "key-" + value + }), g.Slice{"key-1", "key-2"}) + }) +} + +func TestSortedTArray_IsEmpty(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + array := garray.NewSortedTArrayFrom([]string{}, nil) + t.Assert(array.IsEmpty(), true) + }) +} + +func TestSortedTArray_DeepCopy(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + array := garray.NewSortedTArrayFrom([]int{1, 2, 3, 4, 5}, nil) + copyArray := array.DeepCopy().(*garray.SortedTArray[int]) + array.Add(6) + copyArray.Add(7) + cval, _ := copyArray.Get(5) + val, _ := array.Get(5) + t.AssertNE(cval, val) + }) +} diff --git a/container/glist/glist_t.go b/container/glist/glist_t.go new file mode 100644 index 000000000..4f23d2b78 --- /dev/null +++ b/container/glist/glist_t.go @@ -0,0 +1,721 @@ +// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://github.com/gogf/gf. +// + +package glist + +import ( + "bytes" + "container/list" + + "github.com/gogf/gf/v2/internal/deepcopy" + "github.com/gogf/gf/v2/internal/json" + "github.com/gogf/gf/v2/internal/rwmutex" + "github.com/gogf/gf/v2/util/gconv" +) + +// TElement is an element of a linked list. +type TElement[T any] struct { + // Next and previous pointers in the doubly-linked list of elements. + // To simplify the implementation, internally a list l is implemented + // as a ring, such that &l.root is both the next element of the last + // list element (l.Back()) and the previous element of the first list + // element (l.Front()). + next, prev *TElement[T] + + // The list to which this element belongs. + list *TList[T] + + // The value stored with this element. + Value T +} + +// Next returns the next list element or nil. +func (e *TElement[T]) Next() *TElement[T] { + if p := e.next; e.list != nil && p != &e.list.root { + return p + } + return nil +} + +// Prev returns the previous list element or nil. +func (e *TElement[T]) Prev() *TElement[T] { + if p := e.prev; e.list != nil && p != &e.list.root { + return p + } + return nil +} + +// TList is a doubly linked list containing a concurrent-safe/unsafe switch. +// The switch should be set when its initialization and cannot be changed then. + +type TList[T any] struct { + mu rwmutex.RWMutex + root TElement[T] // sentinel list element, only &root, root.prev, and root.next are used + len int // current list length excluding (this) sentinel element +} + +// NewT creates and returns a new empty doubly linked list. +func NewT[T any](safe ...bool) *TList[T] { + l := &TList[T]{ + mu: rwmutex.Create(safe...), + } + return l.init() +} + +// NewTFrom creates and returns a list from a copy of given slice `array`. +// The parameter `safe` is used to specify whether using list in concurrent-safety, +// which is false in default. +func NewTFrom[T any](array []T, safe ...bool) *TList[T] { + l := NewT[T](safe...) + for _, v := range array { + l.insertValue(v, l.root.prev) + } + return l +} + +// PushFront inserts a new element `e` with value `v` at the front of list `l` and returns `e`. +func (l *TList[T]) PushFront(v T) (e *TElement[T]) { + l.mu.Lock() + l.lazyInit() + e = l.insertValue(v, &l.root) + l.mu.Unlock() + return +} + +// PushBack inserts a new element `e` with value `v` at the back of list `l` and returns `e`. +func (l *TList[T]) PushBack(v T) (e *TElement[T]) { + l.mu.Lock() + l.lazyInit() + e = l.insertValue(v, l.root.prev) + l.mu.Unlock() + return +} + +// PushFronts inserts multiple new elements with values `values` at the front of list `l`. +func (l *TList[T]) PushFronts(values []T) { + l.mu.Lock() + l.lazyInit() + for _, v := range values { + l.insertValue(v, &l.root) + } + l.mu.Unlock() +} + +// PushBacks inserts multiple new elements with values `values` at the back of list `l`. +func (l *TList[T]) PushBacks(values []T) { + l.mu.Lock() + l.lazyInit() + for _, v := range values { + l.insertValue(v, l.root.prev) + } + l.mu.Unlock() +} + +// PopBack removes the element from back of `l` and returns the value of the element. +func (l *TList[T]) PopBack() (value T) { + l.mu.Lock() + defer l.mu.Unlock() + l.lazyInit() + if l.len == 0 { + return + } + return l.remove(l.root.prev) +} + +// PopFront removes the element from front of `l` and returns the value of the element. +func (l *TList[T]) PopFront() (value T) { + l.mu.Lock() + defer l.mu.Unlock() + l.lazyInit() + if l.len == 0 { + return + } + return l.remove(l.root.next) +} + +// PopBacks removes `max` elements from back of `l` +// and returns values of the removed elements as slice. +func (l *TList[T]) PopBacks(max int) (values []T) { + l.mu.Lock() + defer l.mu.Unlock() + l.lazyInit() + + length := l.len + if length > 0 { + if max > 0 && max < length { + length = max + } + values = make([]T, length) + for i := 0; i < length; i++ { + values[i] = l.remove(l.root.prev) + } + } + return +} + +// PopFronts removes `max` elements from front of `l` +// and returns values of the removed elements as slice. +func (l *TList[T]) PopFronts(max int) (values []T) { + l.mu.Lock() + defer l.mu.Unlock() + l.lazyInit() + + length := l.len + if length > 0 { + if max > 0 && max < length { + length = max + } + values = make([]T, length) + for i := 0; i < length; i++ { + values[i] = l.remove(l.root.next) + } + } + return +} + +// PopBackAll removes all elements from back of `l` +// and returns values of the removed elements as slice. +func (l *TList[T]) PopBackAll() []T { + return l.PopBacks(-1) +} + +// PopFrontAll removes all elements from front of `l` +// and returns values of the removed elements as slice. +func (l *TList[T]) PopFrontAll() []T { + return l.PopFronts(-1) +} + +// FrontAll copies and returns values of all elements from front of `l` as slice. +func (l *TList[T]) FrontAll() (values []T) { + l.mu.RLock() + defer l.mu.RUnlock() + l.lazyInit() + length := l.len + if length > 0 { + values = make([]T, length) + for i, e := 0, l.front(); i < length; i, e = i+1, e.Next() { + values[i] = e.Value + } + } + return +} + +// BackAll copies and returns values of all elements from back of `l` as slice. +func (l *TList[T]) BackAll() (values []T) { + l.mu.RLock() + defer l.mu.RUnlock() + l.lazyInit() + length := l.len + if length > 0 { + values = make([]T, length) + for i, e := 0, l.back(); i < length; i, e = i+1, e.Prev() { + values[i] = e.Value + } + } + return +} + +// FrontValue returns value of the first element of `l` or zero value of T if the list is empty. +func (l *TList[T]) FrontValue() (value T) { + l.mu.RLock() + defer l.mu.RUnlock() + l.lazyInit() + if e := l.front(); e != nil { + value = e.Value + } + return +} + +// BackValue returns value of the last element of `l` or zero value of T if the list is empty. +func (l *TList[T]) BackValue() (value T) { + l.mu.RLock() + defer l.mu.RUnlock() + l.lazyInit() + if e := l.back(); e != nil { + value = e.Value + } + return +} + +// Front returns the first element of list `l` or nil if the list is empty. +func (l *TList[T]) Front() (e *TElement[T]) { + l.mu.RLock() + defer l.mu.RUnlock() + + l.lazyInit() + + e = l.front() + return +} + +// Back returns the last element of list `l` or nil if the list is empty. +func (l *TList[T]) Back() (e *TElement[T]) { + l.mu.RLock() + defer l.mu.RUnlock() + l.lazyInit() + + e = l.back() + return +} + +// Len returns the number of elements of list `l`. +// The complexity is O(1). +func (l *TList[T]) Len() (length int) { + l.mu.RLock() + defer l.mu.RUnlock() + + l.lazyInit() + + length = l.len + return +} + +// Size is alias of Len. +func (l *TList[T]) Size() int { + return l.Len() +} + +// MoveBefore moves element `e` to its new position before `p`. +// If `e` or `p` is not an element of `l`, or `e` == `p`, the list is not modified. +// The element and `p` must not be nil. +func (l *TList[T]) MoveBefore(e, p *TElement[T]) { + l.mu.Lock() + defer l.mu.Unlock() + + l.lazyInit() + + if e.list != l || e == p || p.list != l { + return + } + l.move(e, p.prev) +} + +// MoveAfter moves element `e` to its new position after `p`. +// If `e` or `p` is not an element of `l`, or `e` == `p`, the list is not modified. +// The element and `p` must not be nil. +func (l *TList[T]) MoveAfter(e, p *TElement[T]) { + l.mu.Lock() + defer l.mu.Unlock() + l.lazyInit() + if e.list != l || e == p || p.list != l { + return + } + l.move(e, p) +} + +// MoveToFront moves element `e` to the front of list `l`. +// If `e` is not an element of `l`, the list is not modified. +// The element must not be nil. +func (l *TList[T]) MoveToFront(e *TElement[T]) { + l.mu.Lock() + defer l.mu.Unlock() + l.lazyInit() + + if e.list != l || l.root.next == e { + return + } + // see comment in List.Remove about initialization of l + l.move(e, &l.root) +} + +// MoveToBack moves element `e` to the back of list `l`. +// If `e` is not an element of `l`, the list is not modified. +// The element must not be nil. +func (l *TList[T]) MoveToBack(e *TElement[T]) { + l.mu.Lock() + defer l.mu.Unlock() + l.lazyInit() + + if e.list != l || l.root.prev == e { + return + } + // see comment in List.Remove about initialization of l + l.move(e, l.root.prev) +} + +// PushBackList inserts a copy of an other list at the back of list `l`. +// The lists `l` and `other` may be the same, but they must not be nil. +func (l *TList[T]) PushBackList(other *TList[T]) { + if l != other { + other.mu.RLock() + defer other.mu.RUnlock() + } + l.mu.Lock() + defer l.mu.Unlock() + + l.lazyInit() + + for i, e := other.len, other.front(); i > 0; i, e = i-1, e.Next() { + l.insertValue(e.Value, l.root.prev) + } +} + +// PushFrontList inserts a copy of an other list at the front of list `l`. +// The lists `l` and `other` may be the same, but they must not be nil. +func (l *TList[T]) PushFrontList(other *TList[T]) { + if l != other { + other.mu.RLock() + defer other.mu.RUnlock() + } + l.mu.Lock() + defer l.mu.Unlock() + + l.lazyInit() + + for i, e := other.len, other.back(); i > 0; i, e = i-1, e.Prev() { + l.insertValue(e.Value, &l.root) + } +} + +// InsertAfter inserts a new element `e` with value `v` immediately after `p` and returns `e`. +// If `p` is not an element of `l`, the list is not modified. +// The `p` must not be nil. +func (l *TList[T]) InsertAfter(p *TElement[T], v T) (e *TElement[T]) { + l.mu.Lock() + defer l.mu.Unlock() + + l.lazyInit() + if p.list != l { + return nil + } + e = l.insertValue(v, p) + return +} + +// InsertBefore inserts a new element `e` with value `v` immediately before `p` and returns `e`. +// If `p` is not an element of `l`, the list is not modified. +// The `p` must not be nil. +func (l *TList[T]) InsertBefore(p *TElement[T], v T) (e *TElement[T]) { + l.mu.Lock() + defer l.mu.Unlock() + + l.lazyInit() + if p.list != l { + return nil + } + e = l.insertValue(v, p.prev) + return +} + +// Remove removes `e` from `l` if `e` is an element of list `l`. +// It returns the element value e.Value. +// The element must not be nil. +func (l *TList[T]) Remove(e *TElement[T]) (value T) { + l.mu.Lock() + defer l.mu.Unlock() + l.lazyInit() + return l.remove(e) +} + +// Removes removes multiple elements `es` from `l` if `es` are elements of list `l`. +func (l *TList[T]) Removes(es []*TElement[T]) { + l.mu.Lock() + defer l.mu.Unlock() + l.lazyInit() + for _, e := range es { + l.remove(e) + } +} + +// RemoveAll removes all elements from list `l`. +func (l *TList[T]) RemoveAll() { + l.mu.Lock() + l.init() + l.mu.Unlock() +} + +// Clear is alias of RemoveAll. +func (l *TList[T]) Clear() { + l.RemoveAll() +} + +// ToList converts TList[T] to list.List +func (l *TList[T]) ToList() *list.List { + l.mu.RLock() + defer l.mu.RUnlock() + + return l.toList() +} + +// toList converts TList[T] to list.List +func (l *TList[T]) toList() *list.List { + l.lazyInit() + + nl := list.New() + + for e := l.front(); e != nil; e = e.Next() { + nl.PushBack(e.Value) + } + return nl +} + +// AppendList append list.List to the end +func (l *TList[T]) AppendList(nl *list.List) { + l.mu.Lock() + defer l.mu.Unlock() + + l.appendList(nl) +} + +// appendList append list.List to the end +func (l *TList[T]) appendList(nl *list.List) { + if nl.Len() == 0 { + return + } + + l.lazyInit() + + for e := nl.Front(); e != nil; e = e.Next() { + if v, ok := e.Value.(T); ok { + l.insertValue(v, l.root.prev) + } + } +} + +// AssignList assigns list.List to now TList[T]. +// It will clear TList[T] first, and append the list.List. +// Note: Elements in nl that are not assignable to T are silently skipped. +// Returns the number of skipped (incompatible) elements. +func (l *TList[T]) AssignList(nl *list.List) int { + l.mu.Lock() + defer l.mu.Unlock() + + return l.assignList(nl) +} + +// assignList assigns list.List to now TList[T]. +// It will clear TList[T] first, and append the list.List. +// Returns the number of skipped (incompatible) elements. +func (l *TList[T]) assignList(nl *list.List) int { + l.init() + if nl.Len() == 0 { + return 0 + } + skipped := 0 + for e := nl.Front(); e != nil; e = e.Next() { + if v, ok := e.Value.(T); ok { + l.insertValue(v, l.root.prev) + } else { + skipped++ + } + } + return skipped +} + +// RLockFunc locks reading with given callback function `f` within RWMutex.RLock. +func (l *TList[T]) RLockFunc(f func(list *list.List)) { + l.mu.RLock() + defer l.mu.RUnlock() + + f(l.toList()) +} + +// LockFunc locks writing with given callback function `f` within RWMutex.Lock. +func (l *TList[T]) LockFunc(f func(list *list.List)) { + l.mu.Lock() + defer l.mu.Unlock() + + nl := l.toList() + f(nl) + l.assignList(nl) +} + +// Iterator is alias of IteratorAsc. +func (l *TList[T]) Iterator(f func(e *TElement[T]) bool) { + l.IteratorAsc(f) +} + +// IteratorAsc iterates the list readonly in ascending order with given callback function `f`. +// If `f` returns true, then it continues iterating; or false to stop. +func (l *TList[T]) IteratorAsc(f func(e *TElement[T]) bool) { + l.mu.RLock() + defer l.mu.RUnlock() + l.lazyInit() + length := l.len + if length > 0 { + for i, e := 0, l.front(); i < length; i, e = i+1, e.Next() { + if !f(e) { + break + } + } + } +} + +// IteratorDesc iterates the list readonly in descending order with given callback function `f`. +// If `f` returns true, then it continues iterating; or false to stop. +func (l *TList[T]) IteratorDesc(f func(e *TElement[T]) bool) { + l.mu.RLock() + defer l.mu.RUnlock() + l.lazyInit() + length := l.len + if length > 0 { + for i, e := 0, l.back(); i < length; i, e = i+1, e.Prev() { + if !f(e) { + break + } + } + } +} + +// Join joins list elements with a string `glue`. +func (l *TList[T]) Join(glue string) string { + l.mu.RLock() + defer l.mu.RUnlock() + l.lazyInit() + + buffer := bytes.NewBuffer(nil) + length := l.len + if length > 0 { + for i, e := 0, l.front(); i < length; i, e = i+1, e.Next() { + buffer.WriteString(gconv.String(e.Value)) + if i != length-1 { + buffer.WriteString(glue) + } + } + } + return buffer.String() +} + +// String returns current list as a string. +func (l *TList[T]) String() string { + if l == nil { + return "" + } + return "[" + l.Join(",") + "]" +} + +// MarshalJSON implements the interface MarshalJSON for json.Marshal. +func (l TList[T]) MarshalJSON() ([]byte, error) { + return json.Marshal(l.FrontAll()) +} + +// UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal. +func (l *TList[T]) UnmarshalJSON(b []byte) error { + var array []T + if err := json.UnmarshalUseNumber(b, &array); err != nil { + return err + } + l.init() + l.PushBacks(array) + return nil +} + +// UnmarshalValue is an interface implement which sets any type of value for list. +func (l *TList[T]) UnmarshalValue(value any) (err error) { + var array []T + switch value.(type) { + case string, []byte: + err = json.UnmarshalUseNumber(gconv.Bytes(value), &array) + default: + anyArray := gconv.SliceAny(value) + if err = gconv.Scan(anyArray, &array); err != nil { + return + } + } + l.init() + l.PushBacks(array) + return err +} + +// DeepCopy implements interface for deep copy of current type. +func (l *TList[T]) DeepCopy() any { + if l == nil { + return nil + } + + l.mu.RLock() + defer l.mu.RUnlock() + + l.lazyInit() + + var ( + length = l.len + valuesT = make([]T, length) + ) + if length > 0 { + for i, e := 0, l.front(); i < length; i, e = i+1, e.Next() { + valuesT[i] = deepcopy.Copy(e.Value).(T) + } + } + return NewTFrom(valuesT, l.mu.IsSafe()) +} + +// Init initializes or clears list l. +func (l *TList[T]) init() *TList[T] { + l.root.next = &l.root + l.root.prev = &l.root + l.len = 0 + return l +} + +// lazyInit lazily initializes a zero List value. +func (l *TList[T]) lazyInit() { + if l.root.next == nil { + l.init() + } +} + +// insert inserts e after at, increments l.len, and returns e. +func (l *TList[T]) insert(e, at *TElement[T]) *TElement[T] { + e.prev = at + e.next = at.next + e.prev.next = e + e.next.prev = e + e.list = l + l.len++ + return e +} + +// insertValue is a convenience wrapper for insert(&Element{Value: v}, at). +func (l *TList[T]) insertValue(v T, at *TElement[T]) *TElement[T] { + return l.insert(&TElement[T]{Value: v}, at) +} + +// remove removes e from its list, decrements l.len +func (l *TList[T]) remove(e *TElement[T]) (val T) { + if e.list != l { + return + } + e.prev.next = e.next + e.next.prev = e.prev + e.next = nil // avoid memory leaks + e.prev = nil // avoid memory leaks + e.list = nil + l.len-- + + return e.Value +} + +// move moves e to next to at. +func (l *TList[T]) move(e, at *TElement[T]) { + if e == at { + return + } + e.prev.next = e.next + e.next.prev = e.prev + + e.prev = at + e.next = at.next + e.prev.next = e + e.next.prev = e +} + +// front returns the first element of list l or nil if the list is empty. +func (l *TList[T]) front() *TElement[T] { + if l.len == 0 { + return nil + } + return l.root.next +} + +// back returns the last element of list l or nil if the list is empty. +func (l *TList[T]) back() *TElement[T] { + if l.len == 0 { + return nil + } + return l.root.prev +} diff --git a/container/glist/glist_z_bench_t_test.go b/container/glist/glist_z_bench_t_test.go new file mode 100644 index 000000000..736bd4a0c --- /dev/null +++ b/container/glist/glist_z_bench_t_test.go @@ -0,0 +1,61 @@ +// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://github.com/gogf/gf. + +// go test *.go -bench=".*" -benchmem + +package glist + +import ( + "testing" +) + +var ( + lt = NewT[any](true) +) + +func Benchmark_T_PushBack(b *testing.B) { + b.RunParallel(func(pb *testing.PB) { + i := 0 + for pb.Next() { + lt.PushBack(i) + i++ + } + }) +} + +func Benchmark_T_PushFront(b *testing.B) { + b.RunParallel(func(pb *testing.PB) { + i := 0 + for pb.Next() { + lt.PushFront(i) + i++ + } + }) +} + +func Benchmark_T_Len(b *testing.B) { + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + lt.Len() + } + }) +} + +func Benchmark_T_PopFront(b *testing.B) { + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + lt.PopFront() + } + }) +} + +func Benchmark_T_PopBack(b *testing.B) { + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + lt.PopBack() + } + }) +} diff --git a/container/glist/glist_z_example_t_test.go b/container/glist/glist_z_example_t_test.go new file mode 100644 index 000000000..178819fdb --- /dev/null +++ b/container/glist/glist_z_example_t_test.go @@ -0,0 +1,689 @@ +// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://github.com/gogf/gf. + +package glist_test + +import ( + "container/list" + "fmt" + + "github.com/gogf/gf/v2/container/garray" + "github.com/gogf/gf/v2/container/glist" + "github.com/gogf/gf/v2/frame/g" +) + +func ExampleNewT() { + n := 10 + l := glist.NewT[any]() + for i := 0; i < n; i++ { + l.PushBack(i) + } + + fmt.Println(l.Len()) + fmt.Println(l) + fmt.Println(l.FrontAll()) + fmt.Println(l.BackAll()) + + for i := 0; i < n; i++ { + fmt.Print(l.PopFront()) + } + + fmt.Println() + fmt.Println(l.Len()) + + // Output: + // 10 + // [0,1,2,3,4,5,6,7,8,9] + // [0 1 2 3 4 5 6 7 8 9] + // [9 8 7 6 5 4 3 2 1 0] + // 0123456789 + // 0 +} + +func ExampleNewTFrom() { + n := 10 + l := glist.NewTFrom[any](garray.NewArrayRange(1, 10, 1).Slice()) + + fmt.Println(l.Len()) + fmt.Println(l) + fmt.Println(l.FrontAll()) + fmt.Println(l.BackAll()) + + for i := 0; i < n; i++ { + fmt.Print(l.PopFront()) + } + + fmt.Println() + fmt.Println(l.Len()) + + // Output: + // 10 + // [1,2,3,4,5,6,7,8,9,10] + // [1 2 3 4 5 6 7 8 9 10] + // [10 9 8 7 6 5 4 3 2 1] + // 12345678910 + // 0 +} + +func ExampleTList_PushFront() { + l := glist.NewTFrom[any](garray.NewArrayRange(1, 5, 1).Slice()) + + fmt.Println(l.Len()) + fmt.Println(l) + + l.PushFront(0) + + fmt.Println(l.Len()) + fmt.Println(l) + + // Output: + // 5 + // [1,2,3,4,5] + // 6 + // [0,1,2,3,4,5] +} + +func ExampleTList_PushBack() { + l := glist.NewTFrom[any](garray.NewArrayRange(1, 5, 1).Slice()) + + fmt.Println(l.Len()) + fmt.Println(l) + + l.PushBack(6) + + fmt.Println(l.Len()) + fmt.Println(l) + + // Output: + // 5 + // [1,2,3,4,5] + // 6 + // [1,2,3,4,5,6] +} + +func ExampleTList_PushFronts() { + l := glist.NewTFrom[any](garray.NewArrayRange(1, 5, 1).Slice()) + + fmt.Println(l.Len()) + fmt.Println(l) + + l.PushFronts(g.Slice{0, -1, -2, -3, -4}) + + fmt.Println(l.Len()) + fmt.Println(l) + + // Output: + // 5 + // [1,2,3,4,5] + // 10 + // [-4,-3,-2,-1,0,1,2,3,4,5] +} + +func ExampleTList_PushBacks() { + l := glist.NewTFrom[any](garray.NewArrayRange(1, 5, 1).Slice()) + + fmt.Println(l.Len()) + fmt.Println(l) + + l.PushBacks(g.Slice{6, 7, 8, 9, 10}) + + fmt.Println(l.Len()) + fmt.Println(l) + + // Output: + // 5 + // [1,2,3,4,5] + // 10 + // [1,2,3,4,5,6,7,8,9,10] +} + +func ExampleTList_PopBack() { + l := glist.NewTFrom[any](garray.NewArrayRange(1, 5, 1).Slice()) + + fmt.Println(l.Len()) + fmt.Println(l) + fmt.Println(l.PopBack()) + fmt.Println(l.Len()) + fmt.Println(l) + + // Output: + // 5 + // [1,2,3,4,5] + // 5 + // 4 + // [1,2,3,4] +} + +func ExampleTList_PopFront() { + l := glist.NewTFrom[any](garray.NewArrayRange(1, 5, 1).Slice()) + + fmt.Println(l.Len()) + fmt.Println(l) + fmt.Println(l.PopFront()) + fmt.Println(l.Len()) + fmt.Println(l) + + // Output: + // 5 + // [1,2,3,4,5] + // 1 + // 4 + // [2,3,4,5] +} + +func ExampleTList_PopBacks() { + l := glist.NewTFrom[any](garray.NewArrayRange(1, 5, 1).Slice()) + + fmt.Println(l.Len()) + fmt.Println(l) + fmt.Println(l.PopBacks(2)) + fmt.Println(l.Len()) + fmt.Println(l) + + // Output: + // 5 + // [1,2,3,4,5] + // [5 4] + // 3 + // [1,2,3] +} + +func ExampleTList_PopFronts() { + l := glist.NewTFrom[any](garray.NewArrayRange(1, 5, 1).Slice()) + + fmt.Println(l.Len()) + fmt.Println(l) + fmt.Println(l.PopFronts(2)) + fmt.Println(l.Len()) + fmt.Println(l) + + // Output: + // 5 + // [1,2,3,4,5] + // [1 2] + // 3 + // [3,4,5] +} + +func ExampleTList_PopBackAll() { + l := glist.NewTFrom[any](garray.NewArrayRange(1, 5, 1).Slice()) + + fmt.Println(l.Len()) + fmt.Println(l) + fmt.Println(l.PopBackAll()) + fmt.Println(l.Len()) + + // Output: + // 5 + // [1,2,3,4,5] + // [5 4 3 2 1] + // 0 +} + +func ExampleTList_PopFrontAll() { + l := glist.NewTFrom[any](garray.NewArrayRange(1, 5, 1).Slice()) + + fmt.Println(l.Len()) + fmt.Println(l) + fmt.Println(l.PopFrontAll()) + fmt.Println(l.Len()) + + // Output: + // 5 + // [1,2,3,4,5] + // [1 2 3 4 5] + // 0 +} + +func ExampleTList_FrontAll() { + l := glist.NewTFrom[any](garray.NewArrayRange(1, 5, 1).Slice()) + + fmt.Println(l) + fmt.Println(l.FrontAll()) + + // Output: + // [1,2,3,4,5] + // [1 2 3 4 5] +} + +func ExampleTList_BackAll() { + l := glist.NewTFrom[any](garray.NewArrayRange(1, 5, 1).Slice()) + + fmt.Println(l) + fmt.Println(l.BackAll()) + + // Output: + // [1,2,3,4,5] + // [5 4 3 2 1] +} + +func ExampleTList_FrontValue() { + l := glist.NewTFrom[any](garray.NewArrayRange(1, 5, 1).Slice()) + + fmt.Println(l) + fmt.Println(l.FrontValue()) + + // Output: + // [1,2,3,4,5] + // 1 +} + +func ExampleTList_BackValue() { + l := glist.NewTFrom[any](garray.NewArrayRange(1, 5, 1).Slice()) + + fmt.Println(l) + fmt.Println(l.BackValue()) + + // Output: + // [1,2,3,4,5] + // 5 +} + +func ExampleTList_Front() { + l := glist.NewTFrom[any](garray.NewArrayRange(1, 5, 1).Slice()) + + fmt.Println(l.Front().Value) + fmt.Println(l) + + e := l.Front() + l.InsertBefore(e, 0) + l.InsertAfter(e, "a") + + fmt.Println(l) + + // Output: + // 1 + // [1,2,3,4,5] + // [0,1,a,2,3,4,5] +} + +func ExampleTList_Back() { + l := glist.NewTFrom[any](garray.NewArrayRange(1, 5, 1).Slice()) + + fmt.Println(l.Back().Value) + fmt.Println(l) + + e := l.Back() + l.InsertBefore(e, "a") + l.InsertAfter(e, 6) + + fmt.Println(l) + + // Output: + // 5 + // [1,2,3,4,5] + // [1,2,3,4,a,5,6] +} + +func ExampleTList_Len() { + l := glist.NewTFrom[any](g.Slice{1, 2, 3, 4, 5}) + + fmt.Println(l.Len()) + + // Output: + // 5 +} + +func ExampleTList_Size() { + l := glist.NewTFrom[any](g.Slice{1, 2, 3, 4, 5}) + + fmt.Println(l.Size()) + + // Output: + // 5 +} + +func ExampleTList_MoveBefore() { + l := glist.NewTFrom[any](garray.NewArrayRange(1, 5, 1).Slice()) + + fmt.Println(l.Size()) + fmt.Println(l) + + // element of `l` + e := l.PushBack(6) + fmt.Println(l.Size()) + fmt.Println(l) + + l.MoveBefore(e, l.Front()) + + fmt.Println(l.Size()) + fmt.Println(l) + + // not element of `l` + e = &glist.TElement[any]{Value: 7} + l.MoveBefore(e, l.Front()) + + fmt.Println(l.Size()) + fmt.Println(l) + + // Output: + // 5 + // [1,2,3,4,5] + // 6 + // [1,2,3,4,5,6] + // 6 + // [6,1,2,3,4,5] + // 6 + // [6,1,2,3,4,5] +} + +func ExampleTList_MoveAfter() { + l := glist.NewTFrom[any](garray.NewArrayRange(1, 5, 1).Slice()) + + fmt.Println(l.Size()) + fmt.Println(l) + + // element of `l` + e := l.PushFront(0) + fmt.Println(l.Size()) + fmt.Println(l) + + l.MoveAfter(e, l.Back()) + + fmt.Println(l.Size()) + fmt.Println(l) + + // not element of `l` + e = &glist.TElement[any]{Value: -1} + l.MoveAfter(e, l.Back()) + + fmt.Println(l.Size()) + fmt.Println(l) + + // Output: + // 5 + // [1,2,3,4,5] + // 6 + // [0,1,2,3,4,5] + // 6 + // [1,2,3,4,5,0] + // 6 + // [1,2,3,4,5,0] +} + +func ExampleTList_MoveToFront() { + l := glist.NewTFrom[any](garray.NewArrayRange(1, 5, 1).Slice()) + + fmt.Println(l.Size()) + fmt.Println(l) + + // element of `l` + l.MoveToFront(l.Back()) + + fmt.Println(l.Size()) + fmt.Println(l) + + // not element of `l` + e := &glist.TElement[any]{Value: 6} + l.MoveToFront(e) + + fmt.Println(l.Size()) + fmt.Println(l) + + // Output: + // 5 + // [1,2,3,4,5] + // 5 + // [5,1,2,3,4] + // 5 + // [5,1,2,3,4] +} + +func ExampleTList_MoveToBack() { + l := glist.NewTFrom[any](garray.NewArrayRange(1, 5, 1).Slice()) + + fmt.Println(l.Size()) + fmt.Println(l) + + // element of `l` + l.MoveToBack(l.Front()) + + fmt.Println(l.Size()) + fmt.Println(l) + + // not element of `l` + e := &glist.TElement[any]{Value: 0} + l.MoveToBack(e) + + fmt.Println(l.Size()) + fmt.Println(l) + + // Output: + // 5 + // [1,2,3,4,5] + // 5 + // [2,3,4,5,1] + // 5 + // [2,3,4,5,1] +} + +func ExampleTList_PushBackList() { + l := glist.NewTFrom[any](garray.NewArrayRange(1, 5, 1).Slice()) + + fmt.Println(l.Size()) + fmt.Println(l) + + other := glist.NewTFrom[any](g.Slice{6, 7, 8, 9, 10}) + + fmt.Println(other.Size()) + fmt.Println(other) + + l.PushBackList(other) + + fmt.Println(l.Size()) + fmt.Println(l) + + // Output: + // 5 + // [1,2,3,4,5] + // 5 + // [6,7,8,9,10] + // 10 + // [1,2,3,4,5,6,7,8,9,10] +} + +func ExampleTList_PushFrontList() { + l := glist.NewTFrom[any](garray.NewArrayRange(1, 5, 1).Slice()) + + fmt.Println(l.Size()) + fmt.Println(l) + + other := glist.NewTFrom[any](g.Slice{-4, -3, -2, -1, 0}) + + fmt.Println(other.Size()) + fmt.Println(other) + + l.PushFrontList(other) + + fmt.Println(l.Size()) + fmt.Println(l) + + // Output: + // 5 + // [1,2,3,4,5] + // 5 + // [-4,-3,-2,-1,0] + // 10 + // [-4,-3,-2,-1,0,1,2,3,4,5] +} + +func ExampleTList_InsertAfter() { + l := glist.NewTFrom[any](garray.NewArrayRange(1, 5, 1).Slice()) + + fmt.Println(l.Len()) + fmt.Println(l) + + l.InsertAfter(l.Front(), "a") + l.InsertAfter(l.Back(), "b") + + fmt.Println(l.Len()) + fmt.Println(l) + + // Output: + // 5 + // [1,2,3,4,5] + // 7 + // [1,a,2,3,4,5,b] +} + +func ExampleTList_InsertBefore() { + l := glist.NewTFrom[any](garray.NewArrayRange(1, 5, 1).Slice()) + + fmt.Println(l.Len()) + fmt.Println(l) + + l.InsertBefore(l.Front(), "a") + l.InsertBefore(l.Back(), "b") + + fmt.Println(l.Len()) + fmt.Println(l) + + // Output: + // 5 + // [1,2,3,4,5] + // 7 + // [a,1,2,3,4,b,5] +} + +func ExampleTList_Remove() { + l := glist.NewTFrom[any](garray.NewArrayRange(1, 5, 1).Slice()) + + fmt.Println(l.Len()) + fmt.Println(l) + + fmt.Println(l.Remove(l.Front())) + fmt.Println(l.Remove(l.Back())) + + fmt.Println(l.Len()) + fmt.Println(l) + + // Output: + // 5 + // [1,2,3,4,5] + // 1 + // 5 + // 3 + // [2,3,4] +} + +func ExampleTList_Removes() { + l := glist.NewTFrom[any](garray.NewArrayRange(1, 5, 1).Slice()) + + fmt.Println(l.Len()) + fmt.Println(l) + + l.Removes([]*glist.TElement[any]{l.Front(), l.Back()}) + + fmt.Println(l.Len()) + fmt.Println(l) + + // Output: + // 5 + // [1,2,3,4,5] + // 3 + // [2,3,4] +} + +func ExampleTList_RemoveAll() { + l := glist.NewTFrom[any](garray.NewArrayRange(1, 5, 1).Slice()) + + fmt.Println(l.Len()) + fmt.Println(l) + + l.RemoveAll() + + fmt.Println(l.Len()) + + // Output: + // 5 + // [1,2,3,4,5] + // 0 +} + +func ExampleTList_RLockFunc() { + // concurrent-safe list. + l := glist.NewTFrom[any](garray.NewArrayRange(1, 10, 1).Slice(), true) + // iterate reading from head. + l.RLockFunc(func(list *list.List) { + length := list.Len() + if length > 0 { + for i, e := 0, list.Front(); i < length; i, e = i+1, e.Next() { + fmt.Print(e.Value) + } + } + }) + fmt.Println() + // iterate reading from tail. + l.RLockFunc(func(list *list.List) { + length := list.Len() + if length > 0 { + for i, e := 0, list.Back(); i < length; i, e = i+1, e.Prev() { + fmt.Print(e.Value) + } + } + }) + + fmt.Println() + // Output: + // 12345678910 + // 10987654321 +} + +func ExampleTList_IteratorAsc() { + // concurrent-safe list. + l := glist.NewTFrom[any](garray.NewArrayRange(1, 10, 1).Slice(), true) + // iterate reading from head using IteratorAsc. + l.IteratorAsc(func(e *glist.TElement[any]) bool { + fmt.Print(e.Value) + return true + }) + + // Output: + // 12345678910 +} + +func ExampleTList_IteratorDesc() { + // concurrent-safe list. + l := glist.NewTFrom[any](garray.NewArrayRange(1, 10, 1).Slice(), true) + // iterate reading from tail using IteratorDesc. + l.IteratorDesc(func(e *glist.TElement[any]) bool { + fmt.Print(e.Value) + return true + }) + // Output: + // 10987654321 +} + +func ExampleTList_LockFunc() { + // concurrent-safe list. + l := glist.NewTFrom[any](garray.NewArrayRange(1, 10, 1).Slice(), true) + // iterate writing from head. + l.LockFunc(func(list *list.List) { + length := list.Len() + if length > 0 { + for i, e := 0, list.Front(); i < length; i, e = i+1, e.Next() { + if e.Value == 6 { + e.Value = "M" + break + } + } + } + }) + fmt.Println(l) + + // Output: + // [1,2,3,4,5,M,7,8,9,10] +} + +func ExampleTList_Join() { + var l glist.TList[any] + l.PushBacks(g.Slice{"a", "b", "c", "d"}) + + fmt.Println(l.Join(",")) + + // Output: + // a,b,c,d +} diff --git a/container/glist/glist_z_unit_t_test.go b/container/glist/glist_z_unit_t_test.go new file mode 100644 index 000000000..8a4310611 --- /dev/null +++ b/container/glist/glist_z_unit_t_test.go @@ -0,0 +1,933 @@ +// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://github.com/gogf/gf. + +package glist + +import ( + "container/list" + "testing" + + "github.com/gogf/gf/v2/internal/json" + "github.com/gogf/gf/v2/test/gtest" + "github.com/gogf/gf/v2/util/gconv" +) + +func checkTListLen(t *gtest.T, l *TList[any], len int) bool { + if n := l.Len(); n != len { + t.Errorf("l.Len() = %d, want %d", n, len) + return false + } + return true +} + +func checkTListPointers(t *gtest.T, l *TList[any], es []*TElement[any]) { + if !checkTListLen(t, l, len(es)) { + return + } + + i := 0 + l.Iterator(func(e *TElement[any]) bool { + if e.Prev() != es[i].Prev() { + t.Errorf("list[%d].Prev = %p, want %p", i, e.Prev(), es[i].Prev()) + return false + } + if e.Next() != es[i].Next() { + t.Errorf("list[%d].Next = %p, want %p", i, e.Next(), es[i].Next()) + return false + } + i++ + return true + }) +} + +func TestTVar(t *testing.T) { + var l TList[any] + l.PushFront(1) + l.PushFront(2) + if v := l.PopBack(); v != 1 { + t.Errorf("EXPECT %v, GOT %v", 1, v) + } else { + // fmt.Println(v) + } + if v := l.PopBack(); v != 2 { + t.Errorf("EXPECT %v, GOT %v", 2, v) + } else { + // fmt.Println(v) + } + if v := l.PopBack(); v != nil { + t.Errorf("EXPECT %v, GOT %v", nil, v) + } else { + // fmt.Println(v) + } + l.PushBack(1) + l.PushBack(2) + if v := l.PopFront(); v != 1 { + t.Errorf("EXPECT %v, GOT %v", 1, v) + } else { + // fmt.Println(v) + } + if v := l.PopFront(); v != 2 { + t.Errorf("EXPECT %v, GOT %v", 2, v) + } else { + // fmt.Println(v) + } + if v := l.PopFront(); v != nil { + t.Errorf("EXPECT %v, GOT %v", nil, v) + } else { + // fmt.Println(v) + } +} + +func TestTBasic(t *testing.T) { + l := NewT[any]() + l.PushFront(1) + l.PushFront(2) + if v := l.PopBack(); v != 1 { + t.Errorf("EXPECT %v, GOT %v", 1, v) + } else { + // fmt.Println(v) + } + if v := l.PopBack(); v != 2 { + t.Errorf("EXPECT %v, GOT %v", 2, v) + } else { + // fmt.Println(v) + } + if v := l.PopBack(); v != nil { + t.Errorf("EXPECT %v, GOT %v", nil, v) + } else { + // fmt.Println(v) + } + l.PushBack(1) + l.PushBack(2) + if v := l.PopFront(); v != 1 { + t.Errorf("EXPECT %v, GOT %v", 1, v) + } else { + // fmt.Println(v) + } + if v := l.PopFront(); v != 2 { + t.Errorf("EXPECT %v, GOT %v", 2, v) + } else { + // fmt.Println(v) + } + if v := l.PopFront(); v != nil { + t.Errorf("EXPECT %v, GOT %v", nil, v) + } else { + // fmt.Println(v) + } +} + +func TestTList(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l := NewT[any]() + checkTListPointers(t, l, []*TElement[any]{}) + + // Single element list + e := l.PushFront("a") + checkTListPointers(t, l, []*TElement[any]{e}) + l.MoveToFront(e) + checkTListPointers(t, l, []*TElement[any]{e}) + l.MoveToBack(e) + checkTListPointers(t, l, []*TElement[any]{e}) + l.Remove(e) + checkTListPointers(t, l, []*TElement[any]{}) + + // Bigger list + e2 := l.PushFront(2) + e1 := l.PushFront(1) + e3 := l.PushBack(3) + e4 := l.PushBack("banana") + checkTListPointers(t, l, []*TElement[any]{e1, e2, e3, e4}) + + l.Remove(e2) + checkTListPointers(t, l, []*TElement[any]{e1, e3, e4}) + + l.MoveToFront(e3) // move from middle + checkTListPointers(t, l, []*TElement[any]{e3, e1, e4}) + + l.MoveToFront(e1) + l.MoveToBack(e3) // move from middle + checkTListPointers(t, l, []*TElement[any]{e1, e4, e3}) + + l.MoveToFront(e3) // move from back + checkTListPointers(t, l, []*TElement[any]{e3, e1, e4}) + l.MoveToFront(e3) // should be no-op + checkTListPointers(t, l, []*TElement[any]{e3, e1, e4}) + + l.MoveToBack(e3) // move from front + checkTListPointers(t, l, []*TElement[any]{e1, e4, e3}) + l.MoveToBack(e3) // should be no-op + checkTListPointers(t, l, []*TElement[any]{e1, e4, e3}) + + e2 = l.InsertBefore(e1, 2) // insert before front + checkTListPointers(t, l, []*TElement[any]{e2, e1, e4, e3}) + l.Remove(e2) + e2 = l.InsertBefore(e4, 2) // insert before middle + checkTListPointers(t, l, []*TElement[any]{e1, e2, e4, e3}) + l.Remove(e2) + e2 = l.InsertBefore(e3, 2) // insert before back + checkTListPointers(t, l, []*TElement[any]{e1, e4, e2, e3}) + l.Remove(e2) + + e2 = l.InsertAfter(e1, 2) // insert after front + checkTListPointers(t, l, []*TElement[any]{e1, e2, e4, e3}) + l.Remove(e2) + e2 = l.InsertAfter(e4, 2) // insert after middle + checkTListPointers(t, l, []*TElement[any]{e1, e4, e2, e3}) + l.Remove(e2) + e2 = l.InsertAfter(e3, 2) // insert after back + checkTListPointers(t, l, []*TElement[any]{e1, e4, e3, e2}) + l.Remove(e2) + + // Check standard iteration. + sum := 0 + for e := l.Front(); e != nil; e = e.Next() { + if i, ok := e.Value.(int); ok { + sum += i + } + } + if sum != 4 { + t.Errorf("sum over l = %d, want 4", sum) + } + + // Clear all elements by iterating + var next *TElement[any] + for e := l.Front(); e != nil; e = next { + next = e.Next() + l.Remove(e) + } + checkTListPointers(t, l, []*TElement[any]{}) + }) +} + +func checkTList(t *gtest.T, l *TList[any], es []any) { + if !checkTListLen(t, l, len(es)) { + return + } + + i := 0 + for e := l.Front(); e != nil; e = e.Next() { + + switch e.Value.(type) { + case int: + if le := e.Value.(int); le != es[i] { + t.Errorf("elt[%d].Value() = %v, want %v", i, le, es[i]) + } + // default string + default: + if le := e.Value.(string); le != es[i] { + t.Errorf("elt[%v].Value() = %v, want %v", i, le, es[i]) + } + } + + i++ + } + + // for e := l.Front(); e != nil; e = e.Next() { + // le := e.Value.(int) + // if le != es[i] { + // t.Errorf("elt[%d].Value() = %v, want %v", i, le, es[i]) + // } + // i++ + // } +} + +func TestTExtending(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l1 := NewT[any]() + l2 := NewT[any]() + + l1.PushBack(1) + l1.PushBack(2) + l1.PushBack(3) + + l2.PushBack(4) + l2.PushBack(5) + + l3 := NewT[any]() + l3.PushBackList(l1) + checkTList(t, l3, []any{1, 2, 3}) + l3.PushBackList(l2) + checkTList(t, l3, []any{1, 2, 3, 4, 5}) + + l3 = NewT[any]() + l3.PushFrontList(l2) + checkTList(t, l3, []any{4, 5}) + l3.PushFrontList(l1) + checkTList(t, l3, []any{1, 2, 3, 4, 5}) + + checkTList(t, l1, []any{1, 2, 3}) + checkTList(t, l2, []any{4, 5}) + + l3 = NewT[any]() + l3.PushBackList(l1) + checkTList(t, l3, []any{1, 2, 3}) + l3.PushBackList(l3) + checkTList(t, l3, []any{1, 2, 3, 1, 2, 3}) + + l3 = NewT[any]() + l3.PushFrontList(l1) + checkTList(t, l3, []any{1, 2, 3}) + l3.PushFrontList(l3) + checkTList(t, l3, []any{1, 2, 3, 1, 2, 3}) + + l3 = NewT[any]() + l1.PushBackList(l3) + checkTList(t, l1, []any{1, 2, 3}) + l1.PushFrontList(l3) + checkTList(t, l1, []any{1, 2, 3}) + }) +} + +func TestTRemove(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l := NewT[any]() + e1 := l.PushBack(1) + e2 := l.PushBack(2) + checkTListPointers(t, l, []*TElement[any]{e1, e2}) + // e := l.Front() + // l.Remove(e) + // checkTListPointers(t, l, []*TElement[any]{e2}) + // l.Remove(e) + // checkTListPointers(t, l, []*TElement[any]{e2}) + }) +} + +func Test_T_Issue4103(t *testing.T) { + l1 := NewT[any]() + l1.PushBack(1) + l1.PushBack(2) + + l2 := NewT[any]() + l2.PushBack(3) + l2.PushBack(4) + + e := l1.Front() + l2.Remove(e) // l2 should not change because e is not an element of l2 + if n := l2.Len(); n != 2 { + t.Errorf("l2.Len() = %d, want 2", n) + } + + l1.InsertBefore(e, 8) + if n := l1.Len(); n != 3 { + t.Errorf("l1.Len() = %d, want 3", n) + } +} + +func Test_T_Issue6349(t *testing.T) { + l := NewT[any]() + l.PushBack(1) + l.PushBack(2) + + e := l.Front() + l.Remove(e) + if e.Value != 1 { + t.Errorf("e.value = %d, want 1", e.Value) + } + // if e.Next() != nil { + // t.Errorf("e.Next() != nil") + // } + // if e.Prev() != nil { + // t.Errorf("e.Prev() != nil") + // } +} + +func TestTMove(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l := NewT[any]() + e1 := l.PushBack(1) + e2 := l.PushBack(2) + e3 := l.PushBack(3) + e4 := l.PushBack(4) + + l.MoveAfter(e3, e3) + checkTListPointers(t, l, []*TElement[any]{e1, e2, e3, e4}) + l.MoveBefore(e2, e2) + checkTListPointers(t, l, []*TElement[any]{e1, e2, e3, e4}) + + l.MoveAfter(e3, e2) + checkTListPointers(t, l, []*TElement[any]{e1, e2, e3, e4}) + l.MoveBefore(e2, e3) + checkTListPointers(t, l, []*TElement[any]{e1, e2, e3, e4}) + + l.MoveBefore(e2, e4) + checkTListPointers(t, l, []*TElement[any]{e1, e3, e2, e4}) + e2, e3 = e3, e2 + + l.MoveBefore(e4, e1) + checkTListPointers(t, l, []*TElement[any]{e4, e1, e2, e3}) + e1, e2, e3, e4 = e4, e1, e2, e3 + + l.MoveAfter(e4, e1) + checkTListPointers(t, l, []*TElement[any]{e1, e4, e2, e3}) + e2, e3, e4 = e4, e2, e3 + + l.MoveAfter(e2, e3) + checkTListPointers(t, l, []*TElement[any]{e1, e3, e2, e4}) + e2, e3 = e3, e2 + }) +} + +// Test PushFront, PushBack, PushFrontList, PushBackList with uninitialized List +func TestTZeroList(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + var l1 = NewT[any]() + l1.PushFront(1) + checkTList(t, l1, []any{1}) + + var l2 = NewT[any]() + l2.PushBack(1) + checkTList(t, l2, []any{1}) + + var l3 = NewT[any]() + l3.PushFrontList(l1) + checkTList(t, l3, []any{1}) + + var l4 = NewT[any]() + l4.PushBackList(l2) + checkTList(t, l4, []any{1}) + }) +} + +// Test that a list l is not modified when calling InsertBefore with a mark that is not an element of l. +func TestTInsertBeforeUnknownMark(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l := NewT[any]() + l.PushBack(1) + l.PushBack(2) + l.PushBack(3) + l.InsertBefore(new(TElement[any]), 1) + checkTList(t, l, []any{1, 2, 3}) + }) +} + +// Test that a list l is not modified when calling InsertAfter with a mark that is not an element of l. +func TestTInsertAfterUnknownMark(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l := NewT[any]() + l.PushBack(1) + l.PushBack(2) + l.PushBack(3) + l.InsertAfter(new(TElement[any]), 1) + checkTList(t, l, []any{1, 2, 3}) + }) +} + +// Test that a list l is not modified when calling MoveAfter or MoveBefore with a mark that is not an element of l. +func TestTMoveUnknownMark(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l1 := NewT[any]() + e1 := l1.PushBack(1) + + l2 := NewT[any]() + e2 := l2.PushBack(2) + + l1.MoveAfter(e1, e2) + checkTList(t, l1, []any{1}) + checkTList(t, l2, []any{2}) + + l1.MoveBefore(e1, e2) + checkTList(t, l1, []any{1}) + checkTList(t, l2, []any{2}) + }) +} + +func TestTList_RemoveAll(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l := NewT[any]() + l.PushBack(1) + l.RemoveAll() + checkTList(t, l, []any{}) + l.PushBack(2) + checkTList(t, l, []any{2}) + }) +} + +func TestTList_PushFronts(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l := NewT[any]() + a1 := []any{1, 2} + l.PushFronts(a1) + checkTList(t, l, []any{2, 1}) + a1 = []any{3, 4, 5} + l.PushFronts(a1) + checkTList(t, l, []any{5, 4, 3, 2, 1}) + }) +} + +func TestTList_PushBacks(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l := NewT[any]() + a1 := []any{1, 2} + l.PushBacks(a1) + checkTList(t, l, []any{1, 2}) + a1 = []any{3, 4, 5} + l.PushBacks(a1) + checkTList(t, l, []any{1, 2, 3, 4, 5}) + }) +} + +func TestTList_PopBacks(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l := NewT[any]() + a1 := []any{1, 2, 3, 4} + a2 := []any{"a", "c", "b", "e"} + l.PushFronts(a1) + i1 := l.PopBacks(2) + t.Assert(i1, []any{1, 2}) + + l.PushBacks(a2) // 4.3,a,c,b,e + i1 = l.PopBacks(3) + t.Assert(i1, []any{"e", "b", "c"}) + }) +} + +func TestTList_PopFronts(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l := NewT[any]() + a1 := []any{1, 2, 3, 4} + l.PushFronts(a1) + i1 := l.PopFronts(2) + t.Assert(i1, []any{4, 3}) + t.Assert(l.Len(), 2) + }) +} + +func TestTList_PopBackAll(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l := NewT[any]() + a1 := []any{1, 2, 3, 4} + l.PushFronts(a1) + i1 := l.PopBackAll() + t.Assert(i1, []any{1, 2, 3, 4}) + t.Assert(l.Len(), 0) + }) +} + +func TestTList_PopFrontAll(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l := NewT[any]() + a1 := []any{1, 2, 3, 4} + l.PushFronts(a1) + i1 := l.PopFrontAll() + t.Assert(i1, []any{4, 3, 2, 1}) + t.Assert(l.Len(), 0) + }) +} + +func TestTList_FrontAll(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l := NewT[any]() + a1 := []any{1, 2, 3, 4} + l.PushFronts(a1) + i1 := l.FrontAll() + t.Assert(i1, []any{4, 3, 2, 1}) + t.Assert(l.Len(), 4) + }) +} + +func TestTList_BackAll(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l := NewT[any]() + a1 := []any{1, 2, 3, 4} + l.PushFronts(a1) + i1 := l.BackAll() + t.Assert(i1, []any{1, 2, 3, 4}) + t.Assert(l.Len(), 4) + }) +} + +func TestTList_FrontValue(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l := NewT[any]() + l2 := NewT[any]() + a1 := []any{1, 2, 3, 4} + l.PushFronts(a1) + i1 := l.FrontValue() + t.Assert(gconv.Int(i1), 4) + t.Assert(l.Len(), 4) + + i1 = l2.FrontValue() + t.Assert(i1, nil) + }) +} + +func TestTList_BackValue(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l := NewT[any]() + l2 := NewT[any]() + a1 := []any{1, 2, 3, 4} + l.PushFronts(a1) + i1 := l.BackValue() + t.Assert(gconv.Int(i1), 1) + t.Assert(l.Len(), 4) + + i1 = l2.FrontValue() + t.Assert(i1, nil) + }) +} + +func TestTList_Back(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l := NewT[any]() + a1 := []any{1, 2, 3, 4} + l.PushFronts(a1) + e1 := l.Back() + t.Assert(e1.Value, 1) + t.Assert(l.Len(), 4) + }) +} + +func TestTList_Size(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l := NewT[any]() + a1 := []any{1, 2, 3, 4} + l.PushFronts(a1) + t.Assert(l.Size(), 4) + l.PopFront() + t.Assert(l.Size(), 3) + }) +} + +func TestTList_Removes(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l := NewT[any]() + a1 := []any{1, 2, 3, 4} + l.PushFronts(a1) + e1 := l.Back() + l.Removes([]*TElement[any]{e1}) + t.Assert(l.Len(), 3) + + e2 := l.Back() + l.Removes([]*TElement[any]{e2}) + t.Assert(l.Len(), 2) + checkTList(t, l, []any{4, 3}) + }) +} + +func TestTList_Pop(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l := NewTFrom([]any{1, 2, 3, 4, 5, 6, 7, 8, 9}) + + t.Assert(l.PopBack(), 9) + t.Assert(l.PopBacks(2), []any{8, 7}) + t.Assert(l.PopFront(), 1) + t.Assert(l.PopFronts(2), []any{2, 3}) + }) +} + +func TestTList_Clear(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l := NewT[any]() + a1 := []any{1, 2, 3, 4} + l.PushFronts(a1) + l.Clear() + t.Assert(l.Len(), 0) + }) +} + +func TestTList_IteratorAsc(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l := NewT[any]() + a1 := []any{1, 2, 5, 6, 3, 4} + l.PushFronts(a1) + e1 := l.Back() + fun1 := func(e *TElement[any]) bool { + return gconv.Int(e1.Value) > 2 + } + checkTList(t, l, []any{4, 3, 6, 5, 2, 1}) + l.IteratorAsc(fun1) + checkTList(t, l, []any{4, 3, 6, 5, 2, 1}) + }) +} + +func TestTList_IteratorDesc(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l := NewT[any]() + a1 := []any{1, 2, 3, 4} + l.PushFronts(a1) + e1 := l.Back() + fun1 := func(e *TElement[any]) bool { + return gconv.Int(e1.Value) > 6 + } + l.IteratorDesc(fun1) + t.Assert(l.Len(), 4) + checkTList(t, l, []any{4, 3, 2, 1}) + }) +} + +func TestTList_Iterator(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l := NewT[any]() + a1 := []any{"a", "b", "c", "d", "e"} + l.PushFronts(a1) + e1 := l.Back() + fun1 := func(e *TElement[any]) bool { + return gconv.String(e1.Value) > "c" + } + checkTList(t, l, []any{"e", "d", "c", "b", "a"}) + l.Iterator(fun1) + checkTList(t, l, []any{"e", "d", "c", "b", "a"}) + }) +} + +func TestTList_Join(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l := NewTFrom([]any{1, 2, "a", `"b"`, `\c`}) + t.Assert(l.Join(","), `1,2,a,"b",\c`) + t.Assert(l.Join("."), `1.2.a."b".\c`) + }) +} + +func TestTList_String(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l := NewTFrom([]any{1, 2, "a", `"b"`, `\c`}) + t.Assert(l.String(), `[1,2,a,"b",\c]`) + }) +} + +func TestTList_Json(t *testing.T) { + // Marshal + gtest.C(t, func(t *gtest.T) { + a := []any{"a", "b", "c"} + l := NewT[any]() + l.PushBacks(a) + b1, err1 := json.Marshal(l) + b2, err2 := json.Marshal(a) + t.Assert(err1, err2) + t.Assert(b1, b2) + }) + // Unmarshal + gtest.C(t, func(t *gtest.T) { + a := []any{"a", "b", "c"} + l := NewT[any]() + b, err := json.Marshal(a) + t.AssertNil(err) + + err = json.UnmarshalUseNumber(b, l) + t.AssertNil(err) + t.Assert(l.FrontAll(), a) + }) + gtest.C(t, func(t *gtest.T) { + var l TList[any] + a := []any{"a", "b", "c"} + b, err := json.Marshal(a) + t.AssertNil(err) + + err = json.UnmarshalUseNumber(b, &l) + t.AssertNil(err) + t.Assert(l.FrontAll(), a) + }) +} + +func TestTList_UnmarshalValue(t *testing.T) { + type list struct { + Name string + List *TList[any] + } + // JSON + gtest.C(t, func(t *gtest.T) { + var tlist *list + err := gconv.Struct(map[string]any{ + "name": "john", + "list": []byte(`[1,2,3]`), + }, &tlist) + t.AssertNil(err) + t.Assert(tlist.Name, "john") + t.Assert(tlist.List.FrontAll(), []any{1, 2, 3}) + }) + // Map + gtest.C(t, func(t *gtest.T) { + var tlist *list + err := gconv.Struct(map[string]any{ + "name": "john", + "list": []any{1, 2, 3}, + }, &tlist) + t.AssertNil(err) + t.Assert(tlist.Name, "john") + t.Assert(tlist.List.FrontAll(), []any{1, 2, 3}) + }) +} + +func TestTList_DeepCopy(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l := NewTFrom([]any{1, 2, "a", `"b"`, `\c`}) + copyList := l.DeepCopy() + cl := copyList.(*TList[any]) + cl.PopBack() + t.AssertNE(l.Size(), cl.Size()) + }) + // Nil pointer deep copy + gtest.C(t, func(t *gtest.T) { + var l *TList[any] + copyList := l.DeepCopy() + t.AssertNil(copyList) + }) +} + +func TestTList_ToList(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l := NewTFrom([]any{1, 2, 3, 4, 5}) + nl := l.ToList() + t.Assert(nl.Len(), 5) + + // Verify elements + i := 1 + for e := nl.Front(); e != nil; e = e.Next() { + t.Assert(e.Value, i) + i++ + } + }) + // Empty list + gtest.C(t, func(t *gtest.T) { + l := NewT[any]() + nl := l.ToList() + t.Assert(nl.Len(), 0) + }) +} + +func TestTList_AppendList(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l := NewTFrom([]any{1, 2, 3}) + nl := list.New() + nl.PushBack(4) + nl.PushBack(5) + + l.AppendList(nl) + t.Assert(l.Len(), 5) + t.Assert(l.FrontAll(), []any{1, 2, 3, 4, 5}) + }) + // Append empty list + gtest.C(t, func(t *gtest.T) { + l := NewTFrom([]any{1, 2, 3}) + nl := list.New() + l.AppendList(nl) + t.Assert(l.Len(), 3) + t.Assert(l.FrontAll(), []any{1, 2, 3}) + }) + // Append with type mismatch (should skip) + gtest.C(t, func(t *gtest.T) { + l := NewT[int]() + nl := list.New() + nl.PushBack(1) + nl.PushBack("string") // type mismatch + nl.PushBack(2) + + l.AppendList(nl) + t.Assert(l.Len(), 2) + t.Assert(l.FrontAll(), []int{1, 2}) + }) +} + +func TestTList_AssignList(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l := NewTFrom([]any{1, 2, 3}) + nl := list.New() + nl.PushBack(4) + nl.PushBack(5) + nl.PushBack(6) + + skipped := l.AssignList(nl) + t.Assert(skipped, 0) + t.Assert(l.Len(), 3) + t.Assert(l.FrontAll(), []any{4, 5, 6}) + }) + // Assign empty list + gtest.C(t, func(t *gtest.T) { + l := NewTFrom([]any{1, 2, 3}) + nl := list.New() + + skipped := l.AssignList(nl) + t.Assert(skipped, 0) + t.Assert(l.Len(), 0) + }) + // Assign with type mismatch (should return skipped count) + gtest.C(t, func(t *gtest.T) { + l := NewT[int]() + nl := list.New() + nl.PushBack(1) + nl.PushBack("string") // type mismatch + nl.PushBack(2) + nl.PushBack("another") // type mismatch + + skipped := l.AssignList(nl) + t.Assert(skipped, 2) + t.Assert(l.Len(), 2) + t.Assert(l.FrontAll(), []int{1, 2}) + }) +} + +func TestTList_String_Nil(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + var l *TList[any] + t.Assert(l.String(), "") + }) +} + +func TestTList_UnmarshalJSON_Error(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l := NewT[any]() + err := l.UnmarshalJSON([]byte("invalid json")) + t.AssertNE(err, nil) + }) +} + +func TestTList_UnmarshalValue_String(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l := NewT[any]() + err := l.UnmarshalValue(`[1,2,3]`) + t.AssertNil(err) + t.Assert(l.FrontAll(), []any{1, 2, 3}) + }) +} + +func TestTList_UnmarshalValue_Bytes(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l := NewT[any]() + err := l.UnmarshalValue([]byte(`[1,2,3]`)) + t.AssertNil(err) + t.Assert(l.FrontAll(), []any{1, 2, 3}) + }) +} + +func TestTList_DeepCopy_Empty(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + l := NewT[any]() + copyList := l.DeepCopy() + cl := copyList.(*TList[any]) + t.Assert(cl.Len(), 0) + }) +} + +func TestTList_AppendList_WithTypeMismatch(t *testing.T) { + // Test appendList internal function through AppendList with mixed types + gtest.C(t, func(t *gtest.T) { + l := NewT[int]() + nl := list.New() + // Only add non-matching types + nl.PushBack("string1") + nl.PushBack("string2") + + l.AppendList(nl) + t.Assert(l.Len(), 0) + }) +} + +func TestTList_UnmarshalValue_Error(t *testing.T) { + // Test UnmarshalValue with data through default case + gtest.C(t, func(t *gtest.T) { + l := NewT[any]() + // Pass a slice directly through default case + _ = l.UnmarshalValue([]any{1, 2, 3}) + t.Assert(l.Len(), 3) + t.Assert(l.FrontAll(), []any{1, 2, 3}) + }) + // Test UnmarshalValue error in string case + gtest.C(t, func(t *gtest.T) { + l := NewT[any]() + err := l.UnmarshalValue("invalid json") + t.AssertNE(err, nil) + }) +} diff --git a/container/gmap/gmap.go b/container/gmap/gmap.go index 04efeb502..8afd76a4d 100644 --- a/container/gmap/gmap.go +++ b/container/gmap/gmap.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. // Package gmap provides most commonly used map container which also support concurrent-safe/unsafe switch feature. diff --git a/container/gmap/gmap_hash_any_any_map.go b/container/gmap/gmap_hash_any_any_map.go index 1a248bccb..9d50a4490 100644 --- a/container/gmap/gmap_hash_any_any_map.go +++ b/container/gmap/gmap_hash_any_any_map.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gmap diff --git a/container/gmap/gmap_hash_int_any_map.go b/container/gmap/gmap_hash_int_any_map.go index da4376a9d..5b5a4e282 100644 --- a/container/gmap/gmap_hash_int_any_map.go +++ b/container/gmap/gmap_hash_int_any_map.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. // diff --git a/container/gmap/gmap_hash_int_int_map.go b/container/gmap/gmap_hash_int_int_map.go index eb71c81fe..7332eea06 100644 --- a/container/gmap/gmap_hash_int_int_map.go +++ b/container/gmap/gmap_hash_int_int_map.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gmap diff --git a/container/gmap/gmap_hash_int_str_map.go b/container/gmap/gmap_hash_int_str_map.go index dfdba27bc..2de9788a8 100644 --- a/container/gmap/gmap_hash_int_str_map.go +++ b/container/gmap/gmap_hash_int_str_map.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gmap diff --git a/container/gmap/gmap_hash_str_any_map.go b/container/gmap/gmap_hash_str_any_map.go index 467b956c8..80b4bdc06 100644 --- a/container/gmap/gmap_hash_str_any_map.go +++ b/container/gmap/gmap_hash_str_any_map.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. // diff --git a/container/gmap/gmap_hash_str_int_map.go b/container/gmap/gmap_hash_str_int_map.go index f9c582d55..3ee4f4225 100644 --- a/container/gmap/gmap_hash_str_int_map.go +++ b/container/gmap/gmap_hash_str_int_map.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. // diff --git a/container/gmap/gmap_hash_str_str_map.go b/container/gmap/gmap_hash_str_str_map.go index b346bdfb2..9e62794ca 100644 --- a/container/gmap/gmap_hash_str_str_map.go +++ b/container/gmap/gmap_hash_str_str_map.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. // diff --git a/container/gmap/gmap_list_map.go b/container/gmap/gmap_list_map.go index 2b426176f..5f90aaa41 100644 --- a/container/gmap/gmap_list_map.go +++ b/container/gmap/gmap_list_map.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gmap diff --git a/container/gmap/gmap_tree_map.go b/container/gmap/gmap_tree_map.go index 3e07d97ee..fde034b81 100644 --- a/container/gmap/gmap_tree_map.go +++ b/container/gmap/gmap_tree_map.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gmap diff --git a/container/gmap/gmap_z_basic_test.go b/container/gmap/gmap_z_basic_test.go index b2675228a..da294499a 100644 --- a/container/gmap/gmap_z_basic_test.go +++ b/container/gmap/gmap_z_basic_test.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gmap_test diff --git a/container/gmap/gmap_z_bench_maps_test.go b/container/gmap/gmap_z_bench_maps_test.go index 62e56c6b6..857ca5c95 100644 --- a/container/gmap/gmap_z_bench_maps_test.go +++ b/container/gmap/gmap_z_bench_maps_test.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. // go test *.go -bench=".*" -benchmem diff --git a/container/gmap/gmap_z_bench_safe_test.go b/container/gmap/gmap_z_bench_safe_test.go index 9700a66bb..d60e371db 100644 --- a/container/gmap/gmap_z_bench_safe_test.go +++ b/container/gmap/gmap_z_bench_safe_test.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. // go test *.go -bench=".*" -benchmem diff --git a/container/gmap/gmap_z_bench_syncmap_test.go b/container/gmap/gmap_z_bench_syncmap_test.go index 20f814a85..515e0c862 100644 --- a/container/gmap/gmap_z_bench_syncmap_test.go +++ b/container/gmap/gmap_z_bench_syncmap_test.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. // go test *.go -bench=".*" -benchmem diff --git a/container/gmap/gmap_z_bench_unsafe_test.go b/container/gmap/gmap_z_bench_unsafe_test.go index c7f971f22..4bd699396 100644 --- a/container/gmap/gmap_z_bench_unsafe_test.go +++ b/container/gmap/gmap_z_bench_unsafe_test.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. // go test *.go -bench=".*" -benchmem diff --git a/container/gmap/gmap_z_example_any_any_test.go b/container/gmap/gmap_z_example_any_any_test.go index bb53bd776..5e6a5c31a 100644 --- a/container/gmap/gmap_z_example_any_any_test.go +++ b/container/gmap/gmap_z_example_any_any_test.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gmap_test diff --git a/container/gmap/gmap_z_example_int_any_test.go b/container/gmap/gmap_z_example_int_any_test.go index 14201c7a1..e9a668b8d 100644 --- a/container/gmap/gmap_z_example_int_any_test.go +++ b/container/gmap/gmap_z_example_int_any_test.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gmap_test diff --git a/container/gmap/gmap_z_example_int_int_test.go b/container/gmap/gmap_z_example_int_int_test.go index fff14d922..107ff5fcc 100644 --- a/container/gmap/gmap_z_example_int_int_test.go +++ b/container/gmap/gmap_z_example_int_int_test.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gmap_test diff --git a/container/gmap/gmap_z_example_list_test.go b/container/gmap/gmap_z_example_list_test.go index 36f57833a..98b59c252 100644 --- a/container/gmap/gmap_z_example_list_test.go +++ b/container/gmap/gmap_z_example_list_test.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gmap_test diff --git a/container/gmap/gmap_z_example_str_any_test.go b/container/gmap/gmap_z_example_str_any_test.go index 0571befa8..f1f8bc11e 100644 --- a/container/gmap/gmap_z_example_str_any_test.go +++ b/container/gmap/gmap_z_example_str_any_test.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gmap_test diff --git a/container/gmap/gmap_z_example_str_int_test.go b/container/gmap/gmap_z_example_str_int_test.go index 304e683c8..9f78a0d8c 100644 --- a/container/gmap/gmap_z_example_str_int_test.go +++ b/container/gmap/gmap_z_example_str_int_test.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gmap_test diff --git a/container/gmap/gmap_z_example_str_str_test.go b/container/gmap/gmap_z_example_str_str_test.go index e0849c1c4..fc7b8dec9 100644 --- a/container/gmap/gmap_z_example_str_str_test.go +++ b/container/gmap/gmap_z_example_str_str_test.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gmap_test diff --git a/container/gmap/gmap_z_example_test.go b/container/gmap/gmap_z_example_test.go index b88da67e9..fae970d26 100644 --- a/container/gmap/gmap_z_example_test.go +++ b/container/gmap/gmap_z_example_test.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gmap_test diff --git a/container/gmap/gmap_z_unit_hash_any_any_test.go b/container/gmap/gmap_z_unit_hash_any_any_test.go index 9665db1b8..709bdfb1c 100644 --- a/container/gmap/gmap_z_unit_hash_any_any_test.go +++ b/container/gmap/gmap_z_unit_hash_any_any_test.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gmap_test diff --git a/container/gmap/gmap_z_unit_hash_int_any_test.go b/container/gmap/gmap_z_unit_hash_int_any_test.go index 7c2f17314..848c81530 100644 --- a/container/gmap/gmap_z_unit_hash_int_any_test.go +++ b/container/gmap/gmap_z_unit_hash_int_any_test.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gmap_test diff --git a/container/gmap/gmap_z_unit_hash_int_int_test.go b/container/gmap/gmap_z_unit_hash_int_int_test.go index 0d352725e..2765db03f 100644 --- a/container/gmap/gmap_z_unit_hash_int_int_test.go +++ b/container/gmap/gmap_z_unit_hash_int_int_test.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gmap_test diff --git a/container/gmap/gmap_z_unit_hash_int_str_test.go b/container/gmap/gmap_z_unit_hash_int_str_test.go index 36ae4de0a..6eed7eab2 100644 --- a/container/gmap/gmap_z_unit_hash_int_str_test.go +++ b/container/gmap/gmap_z_unit_hash_int_str_test.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gmap_test diff --git a/container/gmap/gmap_z_unit_hash_str_any_test.go b/container/gmap/gmap_z_unit_hash_str_any_test.go index dcf34aa37..4be223706 100644 --- a/container/gmap/gmap_z_unit_hash_str_any_test.go +++ b/container/gmap/gmap_z_unit_hash_str_any_test.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gmap_test diff --git a/container/gmap/gmap_z_unit_hash_str_int_test.go b/container/gmap/gmap_z_unit_hash_str_int_test.go index 577eff1e1..365a5077f 100644 --- a/container/gmap/gmap_z_unit_hash_str_int_test.go +++ b/container/gmap/gmap_z_unit_hash_str_int_test.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gmap_test diff --git a/container/gmap/gmap_z_unit_hash_str_str_test.go b/container/gmap/gmap_z_unit_hash_str_str_test.go index 7cbd4fbb6..cbf0a22a8 100644 --- a/container/gmap/gmap_z_unit_hash_str_str_test.go +++ b/container/gmap/gmap_z_unit_hash_str_str_test.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gmap_test diff --git a/container/gmap/gmap_z_unit_list_map_test.go b/container/gmap/gmap_z_unit_list_map_test.go index c8a6074bf..06271cbf8 100644 --- a/container/gmap/gmap_z_unit_list_map_test.go +++ b/container/gmap/gmap_z_unit_list_map_test.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gmap_test diff --git a/container/gmap/gmap_z_unit_tree_map_test.go b/container/gmap/gmap_z_unit_tree_map_test.go index 741c31286..18d8de90f 100644 --- a/container/gmap/gmap_z_unit_tree_map_test.go +++ b/container/gmap/gmap_z_unit_tree_map_test.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gmap_test diff --git a/container/gpool/gpool_z_example_test.go b/container/gpool/gpool_z_example_test.go index 8077128ed..cbb2f5895 100644 --- a/container/gpool/gpool_z_example_test.go +++ b/container/gpool/gpool_z_example_test.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gpool_test diff --git a/container/gqueue/gqueue.go b/container/gqueue/gqueue.go index 65443a5da..d94551369 100644 --- a/container/gqueue/gqueue.go +++ b/container/gqueue/gqueue.go @@ -113,6 +113,7 @@ func (q *Queue) Len() (length int64) { } // Size is alias of Len. +// // Deprecated: use Len instead. func (q *Queue) Size() int64 { return q.Len() diff --git a/container/gset/gset_z_example_any_test.go b/container/gset/gset_z_example_any_test.go index 8592ae852..0c786e5f7 100644 --- a/container/gset/gset_z_example_any_test.go +++ b/container/gset/gset_z_example_any_test.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gset_test diff --git a/container/gset/gset_z_example_int_test.go b/container/gset/gset_z_example_int_test.go index 2462f472b..69f41dc6a 100644 --- a/container/gset/gset_z_example_int_test.go +++ b/container/gset/gset_z_example_int_test.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gset_test diff --git a/container/gset/gset_z_example_str_test.go b/container/gset/gset_z_example_str_test.go index 9bcc5d58b..58eff8591 100644 --- a/container/gset/gset_z_example_str_test.go +++ b/container/gset/gset_z_example_str_test.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gset_test diff --git a/container/gtree/gtree_z_avl_tree_test.go b/container/gtree/gtree_z_avl_tree_test.go index ffc711ebd..9233f32b1 100644 --- a/container/gtree/gtree_z_avl_tree_test.go +++ b/container/gtree/gtree_z_avl_tree_test.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gtree_test diff --git a/container/gtree/gtree_z_b_tree_test.go b/container/gtree/gtree_z_b_tree_test.go index 9dee970e4..1cf4a26be 100644 --- a/container/gtree/gtree_z_b_tree_test.go +++ b/container/gtree/gtree_z_b_tree_test.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gtree_test diff --git a/container/gtree/gtree_z_example_avltree_test.go b/container/gtree/gtree_z_example_avltree_test.go index 5dd24229e..bd9e12c97 100644 --- a/container/gtree/gtree_z_example_avltree_test.go +++ b/container/gtree/gtree_z_example_avltree_test.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gtree_test diff --git a/container/gtree/gtree_z_example_btree_test.go b/container/gtree/gtree_z_example_btree_test.go index 661311b31..4e861766f 100644 --- a/container/gtree/gtree_z_example_btree_test.go +++ b/container/gtree/gtree_z_example_btree_test.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/Agogf/gf. package gtree_test diff --git a/container/gtree/gtree_z_example_redblacktree_test.go b/container/gtree/gtree_z_example_redblacktree_test.go index 84d434776..9917745ee 100644 --- a/container/gtree/gtree_z_example_redblacktree_test.go +++ b/container/gtree/gtree_z_example_redblacktree_test.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gtree_test diff --git a/container/gtree/gtree_z_example_test.go b/container/gtree/gtree_z_example_test.go index 410fbcf2a..0f733b446 100644 --- a/container/gtree/gtree_z_example_test.go +++ b/container/gtree/gtree_z_example_test.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/Agogf/gf. package gtree_test diff --git a/container/gtree/gtree_z_redblack_tree_test.go b/container/gtree/gtree_z_redblack_tree_test.go index 2989b44c5..4708e035f 100644 --- a/container/gtree/gtree_z_redblack_tree_test.go +++ b/container/gtree/gtree_z_redblack_tree_test.go @@ -1,7 +1,7 @@ // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with gm file, +// If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gtree_test diff --git a/container/gvar/gvar_map.go b/container/gvar/gvar_map.go index 3e4d538f6..0321275ed 100644 --- a/container/gvar/gvar_map.go +++ b/container/gvar/gvar_map.go @@ -40,18 +40,21 @@ func (v *Var) MapStrVar(option ...MapOption) map[string]*Var { } // MapDeep converts and returns `v` as map[string]any recursively. +// // Deprecated: used Map instead. func (v *Var) MapDeep(tags ...string) map[string]any { return gconv.MapDeep(v.Val(), tags...) } // MapStrStrDeep converts and returns `v` as map[string]string recursively. +// // Deprecated: used MapStrStr instead. func (v *Var) MapStrStrDeep(tags ...string) map[string]string { return gconv.MapStrStrDeep(v.Val(), tags...) } // MapStrVarDeep converts and returns `v` as map[string]*Var recursively. +// // Deprecated: used MapStrVar instead. func (v *Var) MapStrVarDeep(tags ...string) map[string]*Var { m := v.MapDeep(tags...) @@ -72,6 +75,7 @@ func (v *Var) Maps(option ...MapOption) []map[string]any { } // MapsDeep converts `value` to []map[string]any recursively. +// // Deprecated: used Maps instead. func (v *Var) MapsDeep(tags ...string) []map[string]any { return gconv.MapsDeep(v.Val(), tags...) diff --git a/contrib/config/apollo/apollo.go b/contrib/config/apollo/apollo.go index 9fb76f92c..5ac306770 100644 --- a/contrib/config/apollo/apollo.go +++ b/contrib/config/apollo/apollo.go @@ -19,9 +19,20 @@ import ( "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gcfg" "github.com/gogf/gf/v2/os/gctx" + "github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/util/gconv" ) +var ( + // Compile-time checking for interface implementation. + _ gcfg.Adapter = (*Client)(nil) + _ gcfg.WatcherAdapter = (*Client)(nil) +) + +const ( + apolloNamespaceDelimiter = "," +) + // Config is the configuration object for apollo client. type Config struct { AppID string `v:"required"` // See apolloConfig.Config. @@ -38,9 +49,10 @@ type Config struct { // Client implements gcfg.Adapter implementing using apollo service. type Client struct { - config Config // Config object when created. - client agollo.Client // Apollo client. - value *g.Var // Configmap content cached. It is `*gjson.Json` value internally. + config Config // Config object when created. + client agollo.Client // Apollo client. + value *g.Var // Configmap content cached. It is `*gjson.Json` value internally. + watchers *gcfg.WatcherRegistry // Watchers for watching file changes. } // New creates and returns gcfg.Adapter implementing using apollo service. @@ -54,8 +66,9 @@ func New(ctx context.Context, config Config) (adapter gcfg.Adapter, err error) { config.NamespaceName = storage.GetDefaultNamespace() } client := &Client{ - config: config, - value: g.NewVar(nil, true), + config: config, + value: g.NewVar(nil, true), + watchers: gcfg.NewWatcherRegistry(), } // Apollo client. client.client, err = agollo.StartWithConfig(func() (*apolloConfig.AppConfig, error) { @@ -89,11 +102,19 @@ func (c *Client) Available(ctx context.Context, resource ...string) (ok bool) { if len(resource) == 0 && !c.value.IsNil() { return true } - var namespace = c.config.NamespaceName + + namespaces := gstr.SplitAndTrim(c.config.NamespaceName, apolloNamespaceDelimiter) if len(resource) > 0 { - namespace = resource[0] + namespaces = resource } - return c.client.GetConfig(namespace) != nil + + for _, namespace := range namespaces { + if c.client.GetConfig(namespace) == nil { + return false + } + } + + return true } // Get retrieves and returns value by specified `pattern` in current resource. @@ -132,18 +153,47 @@ func (c *Client) OnNewestChange(event *storage.FullChangeEvent) { } func (c *Client) updateLocalValue(ctx context.Context) (err error) { - var j = gjson.New(nil) - cache := c.client.GetConfigCache(c.config.NamespaceName) - cache.Range(func(key, value any) bool { - err = j.Set(gconv.String(key), value) - if err != nil { - return false - } - return true - }) - cache.Clear() + j := gjson.New(nil) + content := gjson.New(nil, true) + + for _, namespace := range gstr.SplitAndTrim(c.config.NamespaceName, apolloNamespaceDelimiter) { + cache := c.client.GetConfigCache(namespace) + cache.Range(func(key, value any) bool { + err = j.Set(gconv.String(key), value) + if err != nil { + return false + } + err = content.Set(gconv.String(key), value) + return err == nil + }) + cache.Clear() + } + if err == nil { c.value.Set(j) + adapterCtx := NewAdapterCtx(ctx).WithOperation(gcfg.OperationUpdate).WithNamespace(c.config.NamespaceName). + WithAppId(c.config.AppID).WithCluster(c.config.Cluster).WithContent(content) + c.notifyWatchers(adapterCtx.Ctx) } return } + +// AddWatcher adds a watcher for the specified configuration file. +func (c *Client) AddWatcher(name string, f func(ctx context.Context)) { + c.watchers.Add(name, f) +} + +// RemoveWatcher removes the watcher for the specified configuration file. +func (c *Client) RemoveWatcher(name string) { + c.watchers.Remove(name) +} + +// GetWatcherNames returns all watcher names. +func (c *Client) GetWatcherNames() []string { + return c.watchers.GetNames() +} + +// notifyWatchers notifies all watchers. +func (c *Client) notifyWatchers(ctx context.Context) { + c.watchers.Notify(ctx) +} diff --git a/contrib/config/apollo/apollo_adapter_ctx.go b/contrib/config/apollo/apollo_adapter_ctx.go new file mode 100644 index 000000000..e2c0274bc --- /dev/null +++ b/contrib/config/apollo/apollo_adapter_ctx.go @@ -0,0 +1,132 @@ +// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://github.com/gogf/gf. + +// Package apollo implements gcfg.Adapter using apollo service. +package apollo + +import ( + "context" + + "github.com/gogf/gf/v2/encoding/gjson" + "github.com/gogf/gf/v2/os/gcfg" + "github.com/gogf/gf/v2/os/gctx" +) + +const ( + // ContextKeyNamespace is the context key for namespace + ContextKeyNamespace gctx.StrKey = "namespace" + // ContextKeyAppId is the context key for appId + ContextKeyAppId gctx.StrKey = "appId" + // ContextKeyCluster is the context key for cluster + ContextKeyCluster gctx.StrKey = "cluster" +) + +// ApolloAdapterCtx is the context adapter for Apollo configuration +type ApolloAdapterCtx struct { + Ctx context.Context +} + +// NewAdapterCtxWithCtx creates and returns a new ApolloAdapterCtx with the given context. +func NewAdapterCtxWithCtx(ctx context.Context) *ApolloAdapterCtx { + if ctx == nil { + ctx = context.Background() + } + return &ApolloAdapterCtx{Ctx: ctx} +} + +// NewAdapterCtx creates and returns a new ApolloAdapterCtx. +// If context is provided, it will be used; otherwise, a background context is created. +func NewAdapterCtx(ctx ...context.Context) *ApolloAdapterCtx { + if len(ctx) > 0 { + return NewAdapterCtxWithCtx(ctx[0]) + } + return NewAdapterCtxWithCtx(context.Background()) +} + +// GetAdapterCtx creates a new ApolloAdapterCtx with the given context +func GetAdapterCtx(ctx context.Context) *ApolloAdapterCtx { + return NewAdapterCtxWithCtx(ctx) +} + +// WithOperation sets the operation in the context +func (a *ApolloAdapterCtx) WithOperation(operation gcfg.OperationType) *ApolloAdapterCtx { + a.Ctx = context.WithValue(a.Ctx, gcfg.ContextKeyOperation, operation) + return a +} + +// WithNamespace sets the namespace in the context +func (a *ApolloAdapterCtx) WithNamespace(namespace string) *ApolloAdapterCtx { + a.Ctx = context.WithValue(a.Ctx, ContextKeyNamespace, namespace) + return a +} + +// WithAppId sets the appId in the context +func (a *ApolloAdapterCtx) WithAppId(appId string) *ApolloAdapterCtx { + a.Ctx = context.WithValue(a.Ctx, ContextKeyAppId, appId) + return a +} + +// WithCluster sets the cluster in the context +func (a *ApolloAdapterCtx) WithCluster(cluster string) *ApolloAdapterCtx { + a.Ctx = context.WithValue(a.Ctx, ContextKeyCluster, cluster) + return a +} + +// WithContent sets the content in the context +func (a *ApolloAdapterCtx) WithContent(content *gjson.Json) *ApolloAdapterCtx { + a.Ctx = context.WithValue(a.Ctx, gcfg.ContextKeyContent, content) + return a +} + +// GetNamespace retrieves the namespace from the context +func (a *ApolloAdapterCtx) GetNamespace() string { + if v := a.Ctx.Value(ContextKeyNamespace); v != nil { + if s, ok := v.(string); ok { + return s + } + } + return "" +} + +// GetAppId retrieves the appId from the context +func (a *ApolloAdapterCtx) GetAppId() string { + if v := a.Ctx.Value(ContextKeyAppId); v != nil { + if s, ok := v.(string); ok { + return s + } + } + return "" +} + +// GetCluster retrieves the cluster from the context +func (a *ApolloAdapterCtx) GetCluster() string { + if v := a.Ctx.Value(ContextKeyCluster); v != nil { + if s, ok := v.(string); ok { + return s + } + } + return "" +} + +// GetContent retrieves the content from the context +func (a *ApolloAdapterCtx) GetContent() *gjson.Json { + if v := a.Ctx.Value(gcfg.ContextKeyContent); v != nil { + if s, ok := v.(*gjson.Json); ok { + return s + } + } + return gjson.New(nil) +} + +// GetOperation retrieves the operation from the context +func (a *ApolloAdapterCtx) GetOperation() gcfg.OperationType { + if v := a.Ctx.Value(gcfg.ContextKeyOperation); v != nil { + if s, ok := v.(gcfg.OperationType); ok { + return s + } + } + return "" +} diff --git a/contrib/config/apollo/go.mod b/contrib/config/apollo/go.mod index 7174beff7..b37096db2 100644 --- a/contrib/config/apollo/go.mod +++ b/contrib/config/apollo/go.mod @@ -4,7 +4,7 @@ go 1.23.0 require ( github.com/apolloconfig/agollo/v4 v4.3.1 - github.com/gogf/gf/v2 v2.9.3 + github.com/gogf/gf/v2 v2.9.5 ) require ( @@ -20,15 +20,15 @@ require ( github.com/grokify/html-strip-tags-go v0.1.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/magiconair/properties v1.8.10 // indirect - github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/mitchellh/mapstructure v1.4.1 // indirect github.com/olekukonko/errors v1.1.0 // indirect github.com/olekukonko/ll v0.0.9 // indirect - github.com/olekukonko/tablewriter v1.0.9 // indirect + github.com/olekukonko/tablewriter v1.1.0 // indirect github.com/pelletier/go-toml v1.9.3 // indirect - github.com/rivo/uniseg v0.4.7 // indirect + github.com/rivo/uniseg v0.2.0 // indirect github.com/spf13/afero v1.6.0 // indirect github.com/spf13/cast v1.3.1 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect @@ -36,13 +36,13 @@ require ( github.com/spf13/viper v1.8.1 // indirect github.com/subosito/gotenv v1.2.0 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect - go.opentelemetry.io/otel v1.37.0 // indirect - go.opentelemetry.io/otel/metric v1.37.0 // indirect - go.opentelemetry.io/otel/sdk v1.37.0 // indirect - go.opentelemetry.io/otel/trace v1.37.0 // indirect - golang.org/x/net v0.43.0 // indirect + go.opentelemetry.io/otel v1.38.0 // indirect + go.opentelemetry.io/otel/metric v1.38.0 // indirect + go.opentelemetry.io/otel/sdk v1.38.0 // indirect + go.opentelemetry.io/otel/trace v1.38.0 // indirect + golang.org/x/net v0.40.0 // indirect golang.org/x/sys v0.35.0 // indirect - golang.org/x/text v0.28.0 // indirect + golang.org/x/text v0.25.0 // indirect gopkg.in/ini.v1 v1.62.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/contrib/config/apollo/go.sum b/contrib/config/apollo/go.sum index a99e717c5..f7f13199c 100644 --- a/contrib/config/apollo/go.sum +++ b/contrib/config/apollo/go.sum @@ -204,9 +204,10 @@ github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPK github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= -github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= @@ -228,8 +229,8 @@ github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5 github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y= github.com/olekukonko/ll v0.0.9 h1:Y+1YqDfVkqMWuEQMclsF9HUR5+a82+dxJuL1HHSRpxI= github.com/olekukonko/ll v0.0.9/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g= -github.com/olekukonko/tablewriter v1.0.9 h1:XGwRsYLC2bY7bNd93Dk51bcPZksWZmLYuaTHR0FqfL8= -github.com/olekukonko/tablewriter v1.0.9/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= +github.com/olekukonko/tablewriter v1.1.0 h1:N0LHrshF4T39KvI96fn6GT8HEjXRXYNDrDjKFDB7RIY= +github.com/olekukonko/tablewriter v1.1.0/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml v1.9.3 h1:zeC5b1GviRUyKYd6OJPvBU/mcVDVoL1OhT17FCt5dSQ= github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= @@ -239,13 +240,12 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= -github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= @@ -269,8 +269,8 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/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/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/tevid/gohamcrest v1.1.1 h1:ou+xSqlIw1xfGTg1uq1nif/htZ2S3EzRqLm2BP+tYU0= @@ -292,14 +292,16 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= -go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= -go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= -go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= -go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= -go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= -go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= -go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= +go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= +go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= +go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= +go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= +go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= @@ -383,8 +385,8 @@ golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= -golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= +golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= +golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -449,6 +451,7 @@ golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= @@ -460,8 +463,8 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= -golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/contrib/config/consul/consul.go b/contrib/config/consul/consul.go index 1d63ce431..d3a7f71c8 100644 --- a/contrib/config/consul/consul.go +++ b/contrib/config/consul/consul.go @@ -21,6 +21,12 @@ import ( "github.com/gogf/gf/v2/os/glog" ) +var ( + // Compile-time checking for interface implementation. + _ gcfg.Adapter = (*Client)(nil) + _ gcfg.WatcherAdapter = (*Client)(nil) +) + // Config is the configuration object for consul client. type Config struct { // api.Config in consul package @@ -41,6 +47,8 @@ type Client struct { client *api.Client // Configmap content cached. It is `*gjson.Json` value internally. value *g.Var + // Watchers for watching file changes. + watchers *gcfg.WatcherRegistry } // New creates and returns gcfg.Adapter implementing using consul service. @@ -55,8 +63,9 @@ func New(ctx context.Context, config Config) (adapter gcfg.Adapter, err error) { } client := &Client{ - config: config, - value: g.NewVar(nil, true), + config: config, + value: g.NewVar(nil, true), + watchers: gcfg.NewWatcherRegistry(), } client.client, err = api.NewClient(&config.ConsulConfig) @@ -156,13 +165,26 @@ func (c *Client) addWatcher() (err error) { if v, ok = raw.(*api.KVPair); !ok { return } - - if err = c.doUpdate(v.Value); err != nil { + err = c.doUpdate(v.Value) + if err != nil { c.config.Logger.Errorf( context.Background(), "watch config from consul path %+v update failed: %s", c.config.Path, err, ) + } else { + var m *gjson.Json + m, err = gjson.LoadContent(v.Value, true) + if err != nil { + c.config.Logger.Errorf( + context.Background(), + "watch config from consul path %+v parse failed: %s", + c.config.Path, err, + ) + } else { + adapterCtx := NewAdapterCtx().WithOperation(gcfg.OperationUpdate).WithPath(c.config.Path).WithContent(m) + c.notifyWatchers(adapterCtx.Ctx) + } } } @@ -173,6 +195,7 @@ func (c *Client) addWatcher() (err error) { return nil } +// startAsynchronousWatch starts the asynchronous watch. func (c *Client) startAsynchronousWatch(plan *watch.Plan) { if err := plan.Run(c.config.ConsulConfig.Address); err != nil { c.config.Logger.Errorf( @@ -182,3 +205,23 @@ func (c *Client) startAsynchronousWatch(plan *watch.Plan) { ) } } + +// AddWatcher adds a watcher for the specified configuration file. +func (c *Client) AddWatcher(name string, f func(ctx context.Context)) { + c.watchers.Add(name, f) +} + +// RemoveWatcher removes the watcher for the specified configuration file. +func (c *Client) RemoveWatcher(name string) { + c.watchers.Remove(name) +} + +// GetWatcherNames returns all watcher names. +func (c *Client) GetWatcherNames() []string { + return c.watchers.GetNames() +} + +// notifyWatchers notifies all watchers. +func (c *Client) notifyWatchers(ctx context.Context) { + c.watchers.Notify(ctx) +} diff --git a/contrib/config/consul/consul_adapter_ctx.go b/contrib/config/consul/consul_adapter_ctx.go new file mode 100644 index 000000000..48554ad88 --- /dev/null +++ b/contrib/config/consul/consul_adapter_ctx.go @@ -0,0 +1,96 @@ +// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://github.com/gogf/gf. + +// Package consul implements gcfg.Adapter using consul service. +package consul + +import ( + "context" + + "github.com/gogf/gf/v2/encoding/gjson" + "github.com/gogf/gf/v2/os/gcfg" + "github.com/gogf/gf/v2/os/gctx" +) + +const ( + // ContextKeyPath is the context key for path + ContextKeyPath gctx.StrKey = "path" +) + +// ConsulAdapterCtx is the context adapter for Consul configuration +type ConsulAdapterCtx struct { + Ctx context.Context +} + +// NewAdapterCtxWithCtx creates and returns a new ConsulAdapterCtx with the given context. +func NewAdapterCtxWithCtx(ctx context.Context) *ConsulAdapterCtx { + if ctx == nil { + ctx = context.Background() + } + return &ConsulAdapterCtx{Ctx: ctx} +} + +// NewAdapterCtx creates and returns a new ConsulAdapterCtx. +// If context is provided, it will be used; otherwise, a background context is created. +func NewAdapterCtx(ctx ...context.Context) *ConsulAdapterCtx { + if len(ctx) > 0 { + return NewAdapterCtxWithCtx(ctx[0]) + } + return NewAdapterCtxWithCtx(context.Background()) +} + +// GetAdapterCtx creates a new ConsulAdapterCtx with the given context +func GetAdapterCtx(ctx context.Context) *ConsulAdapterCtx { + return NewAdapterCtxWithCtx(ctx) +} + +// WithOperation sets the operation in the context +func (a *ConsulAdapterCtx) WithOperation(operation gcfg.OperationType) *ConsulAdapterCtx { + a.Ctx = context.WithValue(a.Ctx, gcfg.ContextKeyOperation, operation) + return a +} + +// WithPath sets the path in the context +func (a *ConsulAdapterCtx) WithPath(path string) *ConsulAdapterCtx { + a.Ctx = context.WithValue(a.Ctx, ContextKeyPath, path) + return a +} + +// WithContent sets the content in the context +func (a *ConsulAdapterCtx) WithContent(content *gjson.Json) *ConsulAdapterCtx { + a.Ctx = context.WithValue(a.Ctx, gcfg.ContextKeyContent, content) + return a +} + +// GetContent retrieves the content from the context +func (a *ConsulAdapterCtx) GetContent() *gjson.Json { + if v := a.Ctx.Value(gcfg.ContextKeyContent); v != nil { + if s, ok := v.(*gjson.Json); ok { + return s + } + } + return gjson.New(nil) +} + +// GetOperation retrieves the operation from the context +func (a *ConsulAdapterCtx) GetOperation() gcfg.OperationType { + if v := a.Ctx.Value(gcfg.ContextKeyOperation); v != nil { + if s, ok := v.(gcfg.OperationType); ok { + return s + } + } + return "" +} + +// GetPath retrieves the path from the context +func (a *ConsulAdapterCtx) GetPath() string { + if v := a.Ctx.Value(ContextKeyPath); v != nil { + if s, ok := v.(string); ok { + return s + } + } + return "" +} diff --git a/contrib/config/consul/go.mod b/contrib/config/consul/go.mod index 930f0a272..fcecd3819 100644 --- a/contrib/config/consul/go.mod +++ b/contrib/config/consul/go.mod @@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/config/consul/v2 go 1.23.0 require ( - github.com/gogf/gf/v2 v2.9.3 + github.com/gogf/gf/v2 v2.9.5 github.com/hashicorp/consul/api v1.24.0 github.com/hashicorp/go-cleanhttp v0.5.2 ) @@ -23,27 +23,27 @@ require ( github.com/hashicorp/go-hclog v1.5.0 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-rootcerts v1.0.2 // indirect - github.com/hashicorp/golang-lru v1.0.2 // indirect + github.com/hashicorp/golang-lru v0.5.4 // indirect github.com/hashicorp/serf v0.10.1 // indirect github.com/magiconair/properties v1.8.10 // indirect - github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/olekukonko/errors v1.1.0 // indirect github.com/olekukonko/ll v0.0.9 // indirect - github.com/olekukonko/tablewriter v1.0.9 // indirect - github.com/rivo/uniseg v0.4.7 // indirect + github.com/olekukonko/tablewriter v1.1.0 // indirect + github.com/rivo/uniseg v0.2.0 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect - go.opentelemetry.io/otel v1.37.0 // indirect - go.opentelemetry.io/otel/metric v1.37.0 // indirect - go.opentelemetry.io/otel/sdk v1.37.0 // indirect - go.opentelemetry.io/otel/trace v1.37.0 // indirect - golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 // indirect - golang.org/x/net v0.43.0 // indirect + go.opentelemetry.io/otel v1.38.0 // indirect + go.opentelemetry.io/otel/metric v1.38.0 // indirect + go.opentelemetry.io/otel/sdk v1.38.0 // indirect + go.opentelemetry.io/otel/trace v1.38.0 // indirect + golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect + golang.org/x/net v0.40.0 // indirect golang.org/x/sys v0.35.0 // indirect - golang.org/x/text v0.28.0 // indirect + golang.org/x/text v0.25.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/contrib/config/consul/go.sum b/contrib/config/consul/go.sum index da613101b..e71f764e4 100644 --- a/contrib/config/consul/go.sum +++ b/contrib/config/consul/go.sum @@ -97,8 +97,8 @@ github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b github.com/hashicorp/go-version v1.2.1 h1:zEfKbn2+PDgroKdiOzqiE8rsmLqU2uwi5PB5pBJ3TkI= github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= -github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= +github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc= github.com/hashicorp/memberlist v0.5.0 h1:EtYPN8DpAURiapus508I4n9CzHs2W+8NZGbmmR/prTM= @@ -124,13 +124,14 @@ github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVc github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= -github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= -github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= @@ -154,8 +155,8 @@ github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5 github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y= github.com/olekukonko/ll v0.0.9 h1:Y+1YqDfVkqMWuEQMclsF9HUR5+a82+dxJuL1HHSRpxI= github.com/olekukonko/ll v0.0.9/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g= -github.com/olekukonko/tablewriter v1.0.9 h1:XGwRsYLC2bY7bNd93Dk51bcPZksWZmLYuaTHR0FqfL8= -github.com/olekukonko/tablewriter v1.0.9/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= +github.com/olekukonko/tablewriter v1.1.0 h1:N0LHrshF4T39KvI96fn6GT8HEjXRXYNDrDjKFDB7RIY= +github.com/olekukonko/tablewriter v1.1.0/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= @@ -179,11 +180,10 @@ github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8b github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= -github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= @@ -197,26 +197,28 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= -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/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= -go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= -go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= -go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= -go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= -go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= -go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= -go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= +go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= +go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= +go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= +go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= +go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= -golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 h1:m64FZMko/V45gv0bNmrNYoDEq8U5YUhetc9cBWKS1TQ= -golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63/go.mod h1:0v4NqG35kSWCMzLaMeX+IQrlSnVE/bqGSyC2cz/9Le8= +golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug= +golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -224,8 +226,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190923162816-aa69164e4478/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-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8= -golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= -golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= +golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= +golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -250,6 +252,7 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= @@ -258,8 +261,8 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= -golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/contrib/config/kubecm/go.mod b/contrib/config/kubecm/go.mod index 5dd2b9cb0..9908d30d9 100644 --- a/contrib/config/kubecm/go.mod +++ b/contrib/config/kubecm/go.mod @@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/config/kubecm/v2 go 1.24.0 require ( - github.com/gogf/gf/v2 v2.9.3 + github.com/gogf/gf/v2 v2.9.5 k8s.io/api v0.33.4 k8s.io/apimachinery v0.33.4 k8s.io/client-go v0.33.4 @@ -33,7 +33,7 @@ require ( github.com/json-iterator/go v1.1.12 // indirect github.com/magiconair/properties v1.8.10 // indirect github.com/mailru/easyjson v0.7.7 // indirect - github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect @@ -41,24 +41,24 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/olekukonko/errors v1.1.0 // indirect github.com/olekukonko/ll v0.0.9 // indirect - github.com/olekukonko/tablewriter v1.0.9 // indirect - github.com/rivo/uniseg v0.4.7 // indirect + github.com/olekukonko/tablewriter v1.1.0 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/rivo/uniseg v0.2.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/x448/float16 v0.8.4 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect - go.opentelemetry.io/otel v1.37.0 // indirect - go.opentelemetry.io/otel/metric v1.37.0 // indirect - go.opentelemetry.io/otel/sdk v1.37.0 // indirect - go.opentelemetry.io/otel/trace v1.37.0 // indirect - go.yaml.in/yaml/v2 v2.4.2 // indirect - golang.org/x/net v0.43.0 // indirect - golang.org/x/oauth2 v0.30.0 // indirect + go.opentelemetry.io/otel v1.38.0 // indirect + go.opentelemetry.io/otel/metric v1.38.0 // indirect + go.opentelemetry.io/otel/sdk v1.38.0 // indirect + go.opentelemetry.io/otel/trace v1.38.0 // indirect + golang.org/x/net v0.40.0 // indirect + golang.org/x/oauth2 v0.27.0 // indirect golang.org/x/sys v0.35.0 // indirect - golang.org/x/term v0.34.0 // indirect - golang.org/x/text v0.28.0 // indirect - golang.org/x/time v0.12.0 // indirect - google.golang.org/protobuf v1.36.8 // indirect - gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect + golang.org/x/term v0.32.0 // indirect + golang.org/x/text v0.25.0 // indirect + golang.org/x/time v0.9.0 // indirect + google.golang.org/protobuf v1.36.5 // indirect + gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/klog/v2 v2.130.1 // indirect @@ -67,7 +67,7 @@ require ( sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect sigs.k8s.io/randfill v1.0.0 // indirect sigs.k8s.io/structured-merge-diff/v4 v4.6.0 // indirect - sigs.k8s.io/yaml v1.6.0 // indirect + sigs.k8s.io/yaml v1.4.0 // indirect ) replace github.com/gogf/gf/v2 => ../../../ diff --git a/contrib/config/kubecm/go.sum b/contrib/config/kubecm/go.sum index a535d09d7..45f78857c 100644 --- a/contrib/config/kubecm/go.sum +++ b/contrib/config/kubecm/go.sum @@ -64,8 +64,9 @@ github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8S github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= -github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= @@ -81,19 +82,20 @@ github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5 github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y= github.com/olekukonko/ll v0.0.9 h1:Y+1YqDfVkqMWuEQMclsF9HUR5+a82+dxJuL1HHSRpxI= github.com/olekukonko/ll v0.0.9/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g= -github.com/olekukonko/tablewriter v1.0.9 h1:XGwRsYLC2bY7bNd93Dk51bcPZksWZmLYuaTHR0FqfL8= -github.com/olekukonko/tablewriter v1.0.9/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= +github.com/olekukonko/tablewriter v1.1.0 h1:N0LHrshF4T39KvI96fn6GT8HEjXRXYNDrDjKFDB7RIY= +github.com/olekukonko/tablewriter v1.1.0/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= github.com/onsi/ginkgo/v2 v2.21.0 h1:7rg/4f3rB88pb5obDgNZrNHrQ4e6WpjonchcpuBRnZM= github.com/onsi/ginkgo/v2 v2.21.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo= github.com/onsi/gomega v1.35.1 h1:Cwbd75ZBPxFSuZ6T+rN/WCb/gOc6YgFBXLlZLhC7Ds4= github.com/onsi/gomega v1.35.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= -github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -105,28 +107,26 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -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/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= -go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= -go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= -go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= -go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= -go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= -go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= -go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= +go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= +go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= +go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= +go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= +go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI= -go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU= -go.yaml.in/yaml/v3 v3.0.3 h1:bXOww4E/J3f66rav3pX3m8w6jDE4knZjGOw8b5Y6iNE= -go.yaml.in/yaml/v3 v3.0.3/go.mod h1:tBHosrYAkRZjRAOREWbDnBXUf08JOwYq++0QNwQiWzI= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -136,44 +136,45 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= -golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= -golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI= -golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU= +golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= +golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= +golang.org/x/oauth2 v0.27.0 h1:da9Vo7/tDv5RH/7nZDz1eMGS/q1Vv1N/7FCrBhI9I3M= +golang.org/x/oauth2 v0.27.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8= 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-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 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-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4= -golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw= +golang.org/x/term v0.32.0 h1:DR4lr0TjUs3epypdhTOkMmuF5CDFJ/8pOnbzMZPQ7bg= +golang.org/x/term v0.32.0/go.mod h1:uZG1FhGx848Sqfsq4/DlJr3xGGsYMu/L5GW4abiaEPQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= -golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= -golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE= -golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= +golang.org/x/time v0.9.0 h1:EsRrnYcQiGH+5FfbgvV4AP7qEZstoyrHB0DzarOQ4ZY= +golang.org/x/time v0.9.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0= -golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc= -google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= +google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM= +google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/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/evanphx/json-patch.v4 v4.13.0 h1:czT3CmqEaQ1aanPc5SdlgQrrEIb8w/wwCvWWnfEbYzo= -gopkg.in/evanphx/json-patch.v4 v4.13.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M= +gopkg.in/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSPG+6V4= +gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= @@ -198,6 +199,5 @@ sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU= sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY= sigs.k8s.io/structured-merge-diff/v4 v4.6.0 h1:IUA9nvMmnKWcj5jl84xn+T5MnlZKThmUW1TdblaLVAc= sigs.k8s.io/structured-merge-diff/v4 v4.6.0/go.mod h1:dDy58f92j70zLsuZVuUX5Wp9vtxXpaZnkPGWeqDfCps= +sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= -sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs= -sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4= diff --git a/contrib/config/kubecm/kubecm.go b/contrib/config/kubecm/kubecm.go index d15481710..f7e1bb102 100644 --- a/contrib/config/kubecm/kubecm.go +++ b/contrib/config/kubecm/kubecm.go @@ -23,11 +23,18 @@ import ( "github.com/gogf/gf/v2/util/gutil" ) +var ( + // Compile-time checking for interface implementation. + _ gcfg.Adapter = (*Client)(nil) + _ gcfg.WatcherAdapter = (*Client)(nil) +) + // Client implements gcfg.Adapter. type Client struct { - config Config // Config object when created. - client *kubernetes.Clientset // Kubernetes client. - value *g.Var // Configmap content cached. It is `*gjson.Json` value internally. + config Config // Config object when created. + client *kubernetes.Clientset // Kubernetes client. + value *g.Var // Configmap content cached. It is `*gjson.Json` value internally. + watchers *gcfg.WatcherRegistry // Watchers for watching file changes. } // Config for Client. @@ -61,9 +68,10 @@ func New(ctx context.Context, config Config) (adapter gcfg.Adapter, err error) { } } adapter = &Client{ - config: config, - client: config.KubeClient, - value: g.NewVar(nil, true), + config: config, + client: config.KubeClient, + value: g.NewVar(nil, true), + watchers: gcfg.NewWatcherRegistry(), } return } @@ -128,6 +136,7 @@ func (c *Client) updateLocalValueAndWatch(ctx context.Context) (err error) { return nil } +// doUpdate retrieves and caches the configmap content. func (c *Client) doUpdate(ctx context.Context, namespace string) (err error) { cm, err := c.client.CoreV1().ConfigMaps(namespace).Get(ctx, c.config.ConfigMap, kubeMetaV1.GetOptions{}) if err != nil { @@ -145,9 +154,19 @@ func (c *Client) doUpdate(ctx context.Context, namespace string) (err error) { ) } c.value.Set(j) + var content *gjson.Json + if content, err = gjson.LoadContent([]byte(cm.Data[c.config.DataItem])); err != nil { + return gerror.Wrapf( + err, + `parse config map item from %s[%s] failed`, c.config.ConfigMap, c.config.DataItem, + ) + } + adapterCtx := NewAdapterCtx(ctx).WithOperation(gcfg.OperationUpdate).WithNamespace(namespace).WithConfigMap(c.config.ConfigMap).WithDataItem(c.config.DataItem).WithContent(content) + c.notifyWatchers(adapterCtx.Ctx) return nil } +// doWatch watches the configmap content. func (c *Client) doWatch(ctx context.Context, namespace string) (err error) { if !c.config.Watch { return nil @@ -168,6 +187,7 @@ func (c *Client) doWatch(ctx context.Context, namespace string) (err error) { return nil } +// startAsynchronousWatch starts an asynchronous watch for the specified configuration file. func (c *Client) startAsynchronousWatch(ctx context.Context, namespace string, watchHandler watch.Interface) { for { event := <-watchHandler.ResultChan() @@ -177,3 +197,23 @@ func (c *Client) startAsynchronousWatch(ctx context.Context, namespace string, w } } } + +// AddWatcher adds a watcher for the specified configuration file. +func (c *Client) AddWatcher(name string, f func(ctx context.Context)) { + c.watchers.Add(name, f) +} + +// RemoveWatcher removes the watcher for the specified configuration file. +func (c *Client) RemoveWatcher(name string) { + c.watchers.Remove(name) +} + +// GetWatcherNames returns all watcher names. +func (c *Client) GetWatcherNames() []string { + return c.watchers.GetNames() +} + +// notifyWatchers notifies all watchers. +func (c *Client) notifyWatchers(ctx context.Context) { + c.watchers.Notify(ctx) +} diff --git a/contrib/config/kubecm/kubecm_adapter_ctx.go b/contrib/config/kubecm/kubecm_adapter_ctx.go new file mode 100644 index 000000000..c4be351df --- /dev/null +++ b/contrib/config/kubecm/kubecm_adapter_ctx.go @@ -0,0 +1,132 @@ +// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://github.com/gogf/gf. + +// Package kubecm implements gcfg.Adapter using kubecm service. +package kubecm + +import ( + "context" + + "github.com/gogf/gf/v2/encoding/gjson" + "github.com/gogf/gf/v2/os/gcfg" + "github.com/gogf/gf/v2/os/gctx" +) + +const ( + // ContextKeyNamespace is the context key for namespace + ContextKeyNamespace gctx.StrKey = "namespace" + // ContextKeyConfigMap is the context key for configmap + ContextKeyConfigMap gctx.StrKey = "configMap" + // ContextKeyDataItem is the context key for dataitem + ContextKeyDataItem gctx.StrKey = "dataItem" +) + +// KubecmAdapterCtx is the context adapter for kubecm configuration +type KubecmAdapterCtx struct { + Ctx context.Context +} + +// NewKubecmAdapterCtx creates and returns a new KubecmAdapterCtx with the given context. +func NewKubecmAdapterCtx(ctx context.Context) *KubecmAdapterCtx { + if ctx == nil { + ctx = context.Background() + } + return &KubecmAdapterCtx{Ctx: ctx} +} + +// NewAdapterCtx creates and returns a new KubecmAdapterCtx. +// If context is provided, it will be used; otherwise, a background context is created. +func NewAdapterCtx(ctx ...context.Context) *KubecmAdapterCtx { + if len(ctx) > 0 { + return NewKubecmAdapterCtx(ctx[0]) + } + return NewKubecmAdapterCtx(context.Background()) +} + +// GetAdapterCtx creates a new KubecmAdapterCtx with the given context +func GetAdapterCtx(ctx context.Context) *KubecmAdapterCtx { + return NewKubecmAdapterCtx(ctx) +} + +// WithOperation sets the operation in the context +func (a *KubecmAdapterCtx) WithOperation(operation gcfg.OperationType) *KubecmAdapterCtx { + a.Ctx = context.WithValue(a.Ctx, gcfg.ContextKeyOperation, operation) + return a +} + +// WithNamespace sets the namespace in the context +func (a *KubecmAdapterCtx) WithNamespace(namespace string) *KubecmAdapterCtx { + a.Ctx = context.WithValue(a.Ctx, ContextKeyNamespace, namespace) + return a +} + +// WithConfigMap sets the configmap in the context +func (a *KubecmAdapterCtx) WithConfigMap(configMap string) *KubecmAdapterCtx { + a.Ctx = context.WithValue(a.Ctx, ContextKeyConfigMap, configMap) + return a +} + +// WithDataItem sets the dataitem in the context +func (a *KubecmAdapterCtx) WithDataItem(dataItem string) *KubecmAdapterCtx { + a.Ctx = context.WithValue(a.Ctx, ContextKeyDataItem, dataItem) + return a +} + +// WithContent sets the content in the context +func (a *KubecmAdapterCtx) WithContent(content *gjson.Json) *KubecmAdapterCtx { + a.Ctx = context.WithValue(a.Ctx, gcfg.ContextKeyContent, content) + return a +} + +// GetOperation retrieves the operation from the context +func (a *KubecmAdapterCtx) GetOperation() gcfg.OperationType { + if v := a.Ctx.Value(gcfg.ContextKeyOperation); v != nil { + if s, ok := v.(gcfg.OperationType); ok { + return s + } + } + return "" +} + +// GetNamespace retrieves the namespace from the context +func (a *KubecmAdapterCtx) GetNamespace() string { + if v := a.Ctx.Value(ContextKeyNamespace); v != nil { + if s, ok := v.(string); ok { + return s + } + } + return "" +} + +// GetConfigMap retrieves the configmap from the context +func (a *KubecmAdapterCtx) GetConfigMap() string { + if v := a.Ctx.Value(ContextKeyConfigMap); v != nil { + if s, ok := v.(string); ok { + return s + } + } + return "" +} + +// GetDataItem retrieves the dataitem from the context +func (a *KubecmAdapterCtx) GetDataItem() string { + if v := a.Ctx.Value(ContextKeyDataItem); v != nil { + if s, ok := v.(string); ok { + return s + } + } + return "" +} + +// GetContent retrieves the content from the context +func (a *KubecmAdapterCtx) GetContent() *gjson.Json { + if v := a.Ctx.Value(gcfg.ContextKeyContent); v != nil { + if s, ok := v.(*gjson.Json); ok { + return s + } + } + return gjson.New(nil) +} diff --git a/contrib/config/nacos/go.mod b/contrib/config/nacos/go.mod index 47b10a91f..03ed1e1fc 100644 --- a/contrib/config/nacos/go.mod +++ b/contrib/config/nacos/go.mod @@ -3,22 +3,38 @@ module github.com/gogf/gf/contrib/config/nacos/v2 go 1.23.0 require ( - github.com/gogf/gf/v2 v2.9.3 - github.com/nacos-group/nacos-sdk-go/v2 v2.2.5 + github.com/gogf/gf/v2 v2.9.5 + github.com/nacos-group/nacos-sdk-go/v2 v2.3.3 ) require ( github.com/BurntSushi/toml v1.5.0 // indirect - github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 // indirect - github.com/alibabacloud-go/tea v1.1.17 // indirect + github.com/alibabacloud-go/alibabacloud-gateway-pop v0.0.6 // indirect + github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.5 // indirect + github.com/alibabacloud-go/darabonba-array v0.1.0 // indirect + github.com/alibabacloud-go/darabonba-encode-util v0.0.2 // indirect + github.com/alibabacloud-go/darabonba-map v0.0.2 // indirect + github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.10 // indirect + github.com/alibabacloud-go/darabonba-signature-util v0.0.7 // indirect + github.com/alibabacloud-go/darabonba-string v1.0.2 // indirect + github.com/alibabacloud-go/debug v1.0.1 // indirect + github.com/alibabacloud-go/endpoint-util v1.1.0 // indirect + github.com/alibabacloud-go/kms-20160120/v3 v3.2.3 // indirect + github.com/alibabacloud-go/openapi-util v0.1.0 // indirect + github.com/alibabacloud-go/tea v1.2.2 // indirect github.com/alibabacloud-go/tea-utils v1.4.4 // indirect - github.com/aliyun/alibaba-cloud-sdk-go v1.62.589 // indirect - github.com/aliyun/alibabacloud-dkms-gcs-go-sdk v0.2.2 // indirect - github.com/aliyun/alibabacloud-dkms-transfer-go-sdk v0.1.7 // indirect + github.com/alibabacloud-go/tea-utils/v2 v2.0.7 // indirect + github.com/alibabacloud-go/tea-xml v1.1.3 // indirect + github.com/aliyun/alibaba-cloud-sdk-go v1.61.1800 // indirect + github.com/aliyun/alibabacloud-dkms-gcs-go-sdk v0.5.1 // indirect + github.com/aliyun/alibabacloud-dkms-transfer-go-sdk v0.1.8 // indirect + github.com/aliyun/aliyun-secretsmanager-client-go v1.1.5 // indirect + github.com/aliyun/credentials-go v1.4.3 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/buger/jsonparser v1.1.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/clbanning/mxj/v2 v2.7.0 // indirect + github.com/deckarep/golang-set v1.7.1 // indirect github.com/emirpasic/gods v1.18.1 // indirect github.com/fatih/color v1.18.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect @@ -32,41 +48,42 @@ require ( github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/magiconair/properties v1.8.10 // indirect - github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/olekukonko/errors v1.1.0 // indirect github.com/olekukonko/ll v0.0.9 // indirect - github.com/olekukonko/tablewriter v1.0.9 // indirect - github.com/opentracing/opentracing-go v1.2.1-0.20220228012449-10b1cf09e00b // indirect + github.com/olekukonko/tablewriter v1.1.0 // indirect + github.com/orcaman/concurrent-map v0.0.0-20210501183033-44dafcb38ecc // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect - github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect - github.com/prometheus/procfs v0.15.1 // indirect - github.com/rivo/uniseg v0.4.7 // indirect + github.com/prometheus/client_golang v1.12.2 // indirect + github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/common v0.32.1 // indirect + github.com/prometheus/procfs v0.7.3 // indirect + github.com/rivo/uniseg v0.2.0 // indirect + github.com/tjfoc/gmsm v1.4.1 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect - go.opentelemetry.io/otel v1.37.0 // indirect - go.opentelemetry.io/otel/metric v1.37.0 // indirect - go.opentelemetry.io/otel/sdk v1.37.0 // indirect - go.opentelemetry.io/otel/trace v1.37.0 // indirect - go.uber.org/atomic v1.10.0 // indirect + go.opentelemetry.io/otel v1.38.0 // indirect + go.opentelemetry.io/otel/metric v1.38.0 // indirect + go.opentelemetry.io/otel/sdk v1.38.0 // indirect + go.opentelemetry.io/otel/trace v1.38.0 // indirect + go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect go.uber.org/zap v1.21.0 // indirect - golang.org/x/crypto v0.41.0 // indirect - golang.org/x/net v0.43.0 // indirect - golang.org/x/sync v0.16.0 // indirect + golang.org/x/crypto v0.38.0 // indirect + golang.org/x/net v0.40.0 // indirect + golang.org/x/sync v0.14.0 // indirect golang.org/x/sys v0.35.0 // indirect - golang.org/x/text v0.28.0 // indirect + golang.org/x/text v0.25.0 // indirect golang.org/x/time v0.1.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/grpc v1.59.0 // indirect - google.golang.org/protobuf v1.34.2 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/grpc v1.67.3 // indirect + google.golang.org/protobuf v1.36.5 // indirect gopkg.in/ini.v1 v1.67.0 // indirect - gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect + gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/contrib/config/nacos/go.sum b/contrib/config/nacos/go.sum index 300ab855f..6c5e5a63c 100644 --- a/contrib/config/nacos/go.sum +++ b/contrib/config/nacos/go.sum @@ -1,76 +1,245 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg= github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= -github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= -github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 h1:NqugFkGxx1TXSh/pBcU00Y6bljgDPaFdh5MUSeJ7e50= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/alibabacloud-go/alibabacloud-gateway-pop v0.0.6 h1:eIf+iGJxdU4U9ypaUfbtOWCsZSbTb8AUHvyPrxu6mAA= +github.com/alibabacloud-go/alibabacloud-gateway-pop v0.0.6/go.mod h1:4EUIoxs/do24zMOGGqYVWgw0s9NtiylnJglOeEB5UJo= +github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.4/go.mod h1:sCavSAvdzOjul4cEqeVtvlSaSScfNsTQ+46HwlTL1hc= +github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.5 h1:zE8vH9C7JiZLNJJQ5OwjU9mSi4T9ef9u3BURT6LCLC8= +github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.5/go.mod h1:tWnyE9AjF8J8qqLk645oUmVUnFybApTQWklQmi5tY6g= +github.com/alibabacloud-go/darabonba-array v0.1.0 h1:vR8s7b1fWAQIjEjWnuF0JiKsCvclSRTfDzZHTYqfufY= +github.com/alibabacloud-go/darabonba-array v0.1.0/go.mod h1:BLKxr0brnggqOJPqT09DFJ8g3fsDshapUD3C3aOEFaI= +github.com/alibabacloud-go/darabonba-encode-util v0.0.2 h1:1uJGrbsGEVqWcWxrS9MyC2NG0Ax+GpOM5gtupki31XE= +github.com/alibabacloud-go/darabonba-encode-util v0.0.2/go.mod h1:JiW9higWHYXm7F4PKuMgEUETNZasrDM6vqVr/Can7H8= +github.com/alibabacloud-go/darabonba-map v0.0.2 h1:qvPnGB4+dJbJIxOOfawxzF3hzMnIpjmafa0qOTp6udc= +github.com/alibabacloud-go/darabonba-map v0.0.2/go.mod h1:28AJaX8FOE/ym8OUFWga+MtEzBunJwQGceGQlvaPGPc= +github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.9/go.mod h1:bb+Io8Sn2RuM3/Rpme6ll86jMyFSrD1bxeV/+v61KeU= +github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.10 h1:GEYkMApgpKEVDn6z12DcH1EGYpDYRB8JxsazM4Rywak= +github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.10/go.mod h1:26a14FGhZVELuz2cc2AolvW4RHmIO3/HRwsdHhaIPDE= +github.com/alibabacloud-go/darabonba-signature-util v0.0.7 h1:UzCnKvsjPFzApvODDNEYqBHMFt1w98wC7FOo0InLyxg= +github.com/alibabacloud-go/darabonba-signature-util v0.0.7/go.mod h1:oUzCYV2fcCH797xKdL6BDH8ADIHlzrtKVjeRtunBNTQ= +github.com/alibabacloud-go/darabonba-string v1.0.2 h1:E714wms5ibdzCqGeYJ9JCFywE5nDyvIXIIQbZVFkkqo= +github.com/alibabacloud-go/darabonba-string v1.0.2/go.mod h1:93cTfV3vuPhhEwGGpKKqhVW4jLe7tDpo3LUM0i0g6mA= github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68/go.mod h1:6pb/Qy8c+lqua8cFpEy7g39NRRqOWc3rOwAy8m5Y2BY= +github.com/alibabacloud-go/debug v1.0.0/go.mod h1:8gfgZCCAC3+SCzjWtY053FrOcd4/qlH6IHTI4QyICOc= +github.com/alibabacloud-go/debug v1.0.1 h1:MsW9SmUtbb1Fnt3ieC6NNZi6aEwrXfDksD4QA6GSbPg= +github.com/alibabacloud-go/debug v1.0.1/go.mod h1:8gfgZCCAC3+SCzjWtY053FrOcd4/qlH6IHTI4QyICOc= +github.com/alibabacloud-go/endpoint-util v1.1.0 h1:r/4D3VSw888XGaeNpP994zDUaxdgTSHBbVfZlzf6b5Q= +github.com/alibabacloud-go/endpoint-util v1.1.0/go.mod h1:O5FuCALmCKs2Ff7JFJMudHs0I5EBgecXXxZRyswlEjE= +github.com/alibabacloud-go/kms-20160120/v3 v3.2.3 h1:vamGcYQFwXVqR6RWcrVTTqlIXZVsYjaA7pZbx+Xw6zw= +github.com/alibabacloud-go/kms-20160120/v3 v3.2.3/go.mod h1:3rIyughsFDLie1ut9gQJXkWkMg/NfXBCk+OtXnPu3lw= +github.com/alibabacloud-go/openapi-util v0.1.0 h1:0z75cIULkDrdEhkLWgi9tnLe+KhAFE/r5Pb3312/eAY= +github.com/alibabacloud-go/openapi-util v0.1.0/go.mod h1:sQuElr4ywwFRlCCberQwKRFhRzIyG4QTP/P4y1CJ6Ws= github.com/alibabacloud-go/tea v1.1.0/go.mod h1:IkGyUSX4Ba1V+k4pCtJUc6jDpZLFph9QMy2VUPTwukg= -github.com/alibabacloud-go/tea v1.1.17 h1:05R5DnaJXe9sCNIe8KUgWHC/z6w/VZIwczgUwzRnul8= +github.com/alibabacloud-go/tea v1.1.7/go.mod h1:/tmnEaQMyb4Ky1/5D+SE1BAsa5zj/KeGOFfwYm3N/p4= +github.com/alibabacloud-go/tea v1.1.8/go.mod h1:/tmnEaQMyb4Ky1/5D+SE1BAsa5zj/KeGOFfwYm3N/p4= +github.com/alibabacloud-go/tea v1.1.11/go.mod h1:/tmnEaQMyb4Ky1/5D+SE1BAsa5zj/KeGOFfwYm3N/p4= github.com/alibabacloud-go/tea v1.1.17/go.mod h1:nXxjm6CIFkBhwW4FQkNrolwbfon8Svy6cujmKFUq98A= +github.com/alibabacloud-go/tea v1.1.20/go.mod h1:nXxjm6CIFkBhwW4FQkNrolwbfon8Svy6cujmKFUq98A= +github.com/alibabacloud-go/tea v1.2.1/go.mod h1:qbzof29bM/IFhLMtJPrgTGK3eauV5J2wSyEUo4OEmnA= +github.com/alibabacloud-go/tea v1.2.2 h1:aTsR6Rl3ANWPfqeQugPglfurloyBJY85eFy7Gc1+8oU= +github.com/alibabacloud-go/tea v1.2.2/go.mod h1:CF3vOzEMAG+bR4WOql8gc2G9H3EkH3ZLAQdpmpXMgwk= +github.com/alibabacloud-go/tea-utils v1.3.1/go.mod h1:EI/o33aBfj3hETm4RLiAxF/ThQdSngxrpF8rKUDJjPE= github.com/alibabacloud-go/tea-utils v1.4.4 h1:lxCDvNCdTo9FaXKKq45+4vGETQUKNOW/qKTcX9Sk53o= github.com/alibabacloud-go/tea-utils v1.4.4/go.mod h1:KNcT0oXlZZxOXINnZBs6YvgOd5aYp9U67G+E3R8fcQw= +github.com/alibabacloud-go/tea-utils/v2 v2.0.3/go.mod h1:sj1PbjPodAVTqGTA3olprfeeqqmwD0A5OQz94o9EuXQ= +github.com/alibabacloud-go/tea-utils/v2 v2.0.5/go.mod h1:dL6vbUT35E4F4bFTHL845eUloqaerYBYPsdWR2/jhe4= +github.com/alibabacloud-go/tea-utils/v2 v2.0.6/go.mod h1:qxn986l+q33J5VkialKMqT/TTs3E+U9MJpd001iWQ9I= +github.com/alibabacloud-go/tea-utils/v2 v2.0.7 h1:WDx5qW3Xa5ZgJ1c8NfqJkF6w+AU5wB8835UdhPr6Ax0= +github.com/alibabacloud-go/tea-utils/v2 v2.0.7/go.mod h1:qxn986l+q33J5VkialKMqT/TTs3E+U9MJpd001iWQ9I= +github.com/alibabacloud-go/tea-xml v1.1.3 h1:7LYnm+JbOq2B+T/B0fHC4Ies4/FofC4zHzYtqw7dgt0= +github.com/alibabacloud-go/tea-xml v1.1.3/go.mod h1:Rq08vgCcCAjHyRi/M7xlHKUykZCEtyBy9+DPF6GgEu8= +github.com/aliyun/alibaba-cloud-sdk-go v1.61.1800 h1:ie/8RxBOfKZWcrbYSJi2Z8uX8TcOlSMwPlEJh83OeOw= github.com/aliyun/alibaba-cloud-sdk-go v1.61.1800/go.mod h1:RcDobYh8k5VP6TNybz9m++gL3ijVI5wueVr0EM10VsU= -github.com/aliyun/alibaba-cloud-sdk-go v1.62.589 h1:G0ct80P/GKraO8BIZnkuzzNho/3x2QoWnXWdEmW+1Ok= -github.com/aliyun/alibaba-cloud-sdk-go v1.62.589/go.mod h1:CJJYa1ZMxjlN/NbXEwmejEnBkhi0DV+Yb3B2lxf+74o= -github.com/aliyun/alibabacloud-dkms-gcs-go-sdk v0.2.2 h1:rWkH6D2XlXb/Y+tNAQROxBzp3a0p92ni+pXcaHBe/WI= -github.com/aliyun/alibabacloud-dkms-gcs-go-sdk v0.2.2/go.mod h1:GDtq+Kw+v0fO+j5BrrWiUHbBq7L+hfpzpPfXKOZMFE0= -github.com/aliyun/alibabacloud-dkms-transfer-go-sdk v0.1.7 h1:olLiPI2iM8Hqq6vKnSxpM3awCrm9/BeOgHpzQkOYnI4= -github.com/aliyun/alibabacloud-dkms-transfer-go-sdk v0.1.7/go.mod h1:oDg1j4kFxnhgftaiLJABkGeSvuEvSF5Lo6UmRAMruX4= +github.com/aliyun/alibabacloud-dkms-gcs-go-sdk v0.5.1 h1:nJYyoFP+aqGKgPs9JeZgS1rWQ4NndNR0Zfhh161ZltU= +github.com/aliyun/alibabacloud-dkms-gcs-go-sdk v0.5.1/go.mod h1:WzGOmFFTlUzXM03CJnHWMQ85UN6QGpOXZocCjwkiyOg= +github.com/aliyun/alibabacloud-dkms-transfer-go-sdk v0.1.8 h1:QeUdR7JF7iNCvO/81EhxEr3wDwxk4YBoYZOq6E0AjHI= +github.com/aliyun/alibabacloud-dkms-transfer-go-sdk v0.1.8/go.mod h1:xP0KIZry6i7oGPF24vhAPr1Q8vLZRcMcxtft5xDKwCU= +github.com/aliyun/aliyun-secretsmanager-client-go v1.1.5 h1:8S0mtD101RDYa0LXwdoqgN0RxdMmmJYjq8g2mk7/lQ4= +github.com/aliyun/aliyun-secretsmanager-client-go v1.1.5/go.mod h1:M19fxYz3gpm0ETnoKweYyYtqrtnVtrpKFpwsghbw+cQ= +github.com/aliyun/credentials-go v1.1.2/go.mod h1:ozcZaMR5kLM7pwtCMEpVmQ242suV6qTJya2bDq4X1Tw= +github.com/aliyun/credentials-go v1.3.1/go.mod h1:8jKYhQuDawt8x2+fusqa1Y6mPxemTsBEN04dgcAcYz0= +github.com/aliyun/credentials-go v1.3.6/go.mod h1:1LxUuX7L5YrZUWzBrRyk0SwSdH4OmPrib8NVePL3fxM= +github.com/aliyun/credentials-go v1.3.10/go.mod h1:Jm6d+xIgwJVLVWT561vy67ZRP4lPTQxMbEYRuT2Ti1U= +github.com/aliyun/credentials-go v1.4.3 h1:N3iHyvHRMyOwY1+0qBLSf3hb5JFiOujVSVuEpgeGttY= +github.com/aliyun/credentials-go v1.4.3/go.mod h1:Jm6d+xIgwJVLVWT561vy67ZRP4lPTQxMbEYRuT2Ti1U= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs= github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/clbanning/mxj/v2 v2.5.5/go.mod h1:hNiWqW14h+kc+MdF9C6/YoRfjEJoR3ou6tn/Qo+ve2s= github.com/clbanning/mxj/v2 v2.7.0 h1:WA/La7UGCanFe5NpHF0Q3DNtnCsVoxbPKuyBNHWRyME= github.com/clbanning/mxj/v2 v2.7.0/go.mod h1:hNiWqW14h+kc+MdF9C6/YoRfjEJoR3ou6tn/Qo+ve2s= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/deckarep/golang-set v1.7.1 h1:SCQV0S6gTtp6itiFrTqI+pfmJ4LN85S1YzhDf9rTHJQ= +github.com/deckarep/golang-set v1.7.1/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= -github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/goji/httpauth v0.0.0-20160601135302-2da839ab0f4d/go.mod h1:nnjvkQ9ptGaCkuDUx6wNykzzlUixGxvkme+H/lnzb+A= -github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +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/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= +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= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grokify/html-strip-tags-go v0.1.0 h1:03UrQLjAny8xci+R+qjCce/MYnpNXCtgzltlQbOBae4= github.com/grokify/html-strip-tags-go v0.1.0/go.mod h1:ZdzgfHEzAfz9X6Xe5eBLVblWIxXfYSQ40S/VKrAOGpc= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= 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= @@ -80,12 +249,15 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= -github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -93,62 +265,97 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= -github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/nacos-group/nacos-sdk-go/v2 v2.2.5 h1:r0wwT7PayEjvEHzWXwr1ROi/JSqzujM4w+1L5ikThzQ= -github.com/nacos-group/nacos-sdk-go/v2 v2.2.5/go.mod h1:OObBon0prVJVPoIbSZxpEkFiBfL0d1LcBtuAMiNn+8c= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nacos-group/nacos-sdk-go/v2 v2.3.3 h1:lvkBZcYkKENLVR1ubO+vGxTP2L4VtVSArLvYZKuu4Pk= +github.com/nacos-group/nacos-sdk-go/v2 v2.3.3/go.mod h1:ygUBdt7eGeYBt6Lz2HO3wx7crKXk25Mp80568emGMWU= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5sM= github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y= github.com/olekukonko/ll v0.0.9 h1:Y+1YqDfVkqMWuEQMclsF9HUR5+a82+dxJuL1HHSRpxI= github.com/olekukonko/ll v0.0.9/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g= -github.com/olekukonko/tablewriter v1.0.9 h1:XGwRsYLC2bY7bNd93Dk51bcPZksWZmLYuaTHR0FqfL8= -github.com/olekukonko/tablewriter v1.0.9/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= -github.com/opentracing/opentracing-go v1.2.1-0.20220228012449-10b1cf09e00b h1:FfH+VrHHk6Lxt9HdVS0PXzSXFyS2NbZKXv33FYPol0A= -github.com/opentracing/opentracing-go v1.2.1-0.20220228012449-10b1cf09e00b/go.mod h1:AC62GU6hc0BrNm+9RK9VSiwa/EUe1bkIeFORAMcHvJU= +github.com/olekukonko/tablewriter v1.1.0 h1:N0LHrshF4T39KvI96fn6GT8HEjXRXYNDrDjKFDB7RIY= +github.com/olekukonko/tablewriter v1.1.0/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= +github.com/orcaman/concurrent-map v0.0.0-20210501183033-44dafcb38ecc h1:Ak86L+yDSOzKFa7WM5bf5itSOo1e3Xh8bm5YCMUXIjQ= +github.com/orcaman/concurrent-map v0.0.0-20210501183033-44dafcb38ecc/go.mod h1:Lu3tH6HLW3feq74c2GC+jIMS/K2CFcDWnWD9XkenwhI= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 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/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= -github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= -github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= -github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= -github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.12.2 h1:51L9cDoUHVrXx4zWYlcLQIZ+d+VXHgqnYKkIuq4g/34= +github.com/prometheus/client_golang v1.12.2/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/common v0.32.1 h1:hWIdL3N2HoUx3B8j3YN9mWor0qhY/NlEKZEaXxuIRh4= +github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= +github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= -github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/assertions v1.1.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.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/uber/jaeger-client-go v2.30.0+incompatible h1:D6wyKGCecFaSRUpo8lCVbaOOb6ThwMmTEbhRwtKR97o= -github.com/uber/jaeger-client-go v2.30.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk= -github.com/uber/jaeger-lib v2.4.1+incompatible h1:td4jdvLcExb4cBISKIpHuGoVXh+dVKhn2Um6rjCsSsg= -github.com/uber/jaeger-lib v2.4.1+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/tjfoc/gmsm v1.3.2/go.mod h1:HaUcFuY0auTiaHB9MHFGCPx5IaLhTUd2atbCFBQXn9w= +github.com/tjfoc/gmsm v1.4.1 h1:aMe1GlZb+0bLjn+cKTPEvvn9oUEBlJitaZiiBwsbgho= +github.com/tjfoc/gmsm v1.4.1/go.mod h1:j4INPkHWMrhJb38G+J6W4Tw0AbuN8Thu3PbdVYhVcTE= +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.30/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +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= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= -go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= -go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= -go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= -go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= -go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= -go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= -go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= +go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= +go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= +go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= +go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= +go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= +go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= -go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= @@ -156,93 +363,366 @@ go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/zap v1.21.0 h1:WefMeulhovoZ2sYXz7st6K0sLj7bBhpiFaud4r4zST8= go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191219195013-becbf705a915/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4= -golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc= -golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= +golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8= +golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 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= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= -golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= +golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= +golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 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-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw= -golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ= +golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200509044756-6aff5f38e54f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.9.0/go.mod h1:M6DEAAIenWoTxdKrOltXcmDY3rSplQUkrvaDU5FcQyo= +golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= +golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= +golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= +golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= -golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.1.0 h1:xYY+Bajn2a7VBmTM5GikTmnK8ZuX8YgnQCqZpbBNtmA= golang.org/x/time v0.1.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200509030707-2212a7e161a5/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= -gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0= -gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= -gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= -google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= -google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.67.3 h1:OgPcDAFKHnH8X3O4WcO4XUc8GRDeKsKReqbQtiCj7N8= +google.golang.org/grpc v1.67.3/go.mod h1:YGaHCc6Oap+FzBJTZLBzkGSYt/cvGPFTPxkn7QfSU8s= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM= +google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/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/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/ini.v1 v1.56.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= -gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= +gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= +gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0/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= -rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/contrib/config/nacos/nacos.go b/contrib/config/nacos/nacos.go index 1788b1ed5..6d8082b0b 100644 --- a/contrib/config/nacos/nacos.go +++ b/contrib/config/nacos/nacos.go @@ -21,6 +21,12 @@ import ( "github.com/gogf/gf/v2/os/gcfg" ) +var ( + // Compile-time checking for interface implementation. + _ gcfg.Adapter = (*Client)(nil) + _ gcfg.WatcherAdapter = (*Client)(nil) +) + // Config is the configuration object for nacos client. type Config struct { ServerConfigs []constant.ServerConfig `v:"required"` // See constant.ServerConfig @@ -32,9 +38,10 @@ type Config struct { // Client implements gcfg.Adapter implementing using nacos service. type Client struct { - config Config // Config object when created. - client config_client.IConfigClient // Nacos config client. - value *g.Var // Configmap content cached. It is `*gjson.Json` value internally. + config Config // Config object when created. + client config_client.IConfigClient // Nacos config client. + value *g.Var // Configmap content cached. It is `*gjson.Json` value internally. + watchers *gcfg.WatcherRegistry // Watchers for watching file changes. } // New creates and returns gcfg.Adapter implementing using nacos service. @@ -46,8 +53,9 @@ func New(ctx context.Context, config Config) (adapter gcfg.Adapter, err error) { } client := &Client{ - config: config, - value: g.NewVar(nil, true), + config: config, + value: g.NewVar(nil, true), + watchers: gcfg.NewWatcherRegistry(), } client.client, err = clients.CreateConfigClient(map[string]any{ @@ -127,10 +135,13 @@ func (c *Client) addWatcher() error { return nil } c.config.ConfigParam.OnChange = func(namespace, group, dataId, data string) { - c.doUpdate(data) + _ = c.doUpdate(data) if c.config.OnConfigChange != nil { go c.config.OnConfigChange(namespace, group, dataId, data) } + adapterCtx := NewAdapterCtx().WithOperation(gcfg.OperationUpdate).WithNamespace(namespace). + WithGroup(group).WithDataId(dataId).WithContent(data) + c.notifyWatchers(adapterCtx.Ctx) } if err := c.client.ListenConfig(c.config.ConfigParam); err != nil { @@ -139,3 +150,23 @@ func (c *Client) addWatcher() error { return nil } + +// AddWatcher adds a watcher for the specified configuration file. +func (c *Client) AddWatcher(name string, f func(ctx context.Context)) { + c.watchers.Add(name, f) +} + +// RemoveWatcher removes the watcher for the specified configuration file. +func (c *Client) RemoveWatcher(name string) { + c.watchers.Remove(name) +} + +// GetWatcherNames returns all watcher names. +func (c *Client) GetWatcherNames() []string { + return c.watchers.GetNames() +} + +// notifyWatchers notifies all watchers. +func (c *Client) notifyWatchers(ctx context.Context) { + c.watchers.Notify(ctx) +} diff --git a/contrib/config/nacos/nacos_adapter_ctx.go b/contrib/config/nacos/nacos_adapter_ctx.go new file mode 100644 index 000000000..43880ff2c --- /dev/null +++ b/contrib/config/nacos/nacos_adapter_ctx.go @@ -0,0 +1,131 @@ +// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://github.com/gogf/gf. + +// Package nacos implements gcfg.Adapter using nacos service. +package nacos + +import ( + "context" + + "github.com/gogf/gf/v2/os/gcfg" + "github.com/gogf/gf/v2/os/gctx" +) + +const ( + // ContextKeyNamespace is the context key for namespace + ContextKeyNamespace gctx.StrKey = "namespace" + // ContextKeyGroup is the context key for group + ContextKeyGroup gctx.StrKey = "group" + // ContextKeyDataId is the context key for dataId + ContextKeyDataId gctx.StrKey = "dataId" +) + +// NacosAdapterCtx is the context adapter for Nacos configuration +type NacosAdapterCtx struct { + Ctx context.Context +} + +// NewAdapterCtxWithCtx creates and returns a new NacosAdapterCtx with the given context. +func NewAdapterCtxWithCtx(ctx context.Context) *NacosAdapterCtx { + if ctx == nil { + ctx = context.Background() + } + return &NacosAdapterCtx{Ctx: ctx} +} + +// NewAdapterCtx creates and returns a new NacosAdapterCtx. +// If context is provided, it will be used; otherwise, a background context is created. +func NewAdapterCtx(ctx ...context.Context) *NacosAdapterCtx { + if len(ctx) > 0 { + return NewAdapterCtxWithCtx(ctx[0]) + } + return NewAdapterCtxWithCtx(context.Background()) +} + +// GetAdapterCtx creates a new NacosAdapterCtx with the given context +func GetAdapterCtx(ctx context.Context) *NacosAdapterCtx { + return NewAdapterCtxWithCtx(ctx) +} + +// WithOperation sets the operation in the context +func (n *NacosAdapterCtx) WithOperation(operation gcfg.OperationType) *NacosAdapterCtx { + n.Ctx = context.WithValue(n.Ctx, gcfg.ContextKeyOperation, operation) + return n +} + +// WithNamespace sets the namespace in the context +func (n *NacosAdapterCtx) WithNamespace(namespace string) *NacosAdapterCtx { + n.Ctx = context.WithValue(n.Ctx, ContextKeyNamespace, namespace) + return n +} + +// WithGroup sets the group in the context +func (n *NacosAdapterCtx) WithGroup(group string) *NacosAdapterCtx { + n.Ctx = context.WithValue(n.Ctx, ContextKeyGroup, group) + return n +} + +// WithDataId sets the dataId in the context +func (n *NacosAdapterCtx) WithDataId(dataId string) *NacosAdapterCtx { + n.Ctx = context.WithValue(n.Ctx, ContextKeyDataId, dataId) + return n +} + +// WithContent sets the content in the context +func (n *NacosAdapterCtx) WithContent(content string) *NacosAdapterCtx { + n.Ctx = context.WithValue(n.Ctx, gcfg.ContextKeyContent, content) + return n +} + +// GetNamespace retrieves the namespace from the context +func (n *NacosAdapterCtx) GetNamespace() string { + if v := n.Ctx.Value(ContextKeyNamespace); v != nil { + if s, ok := v.(string); ok { + return s + } + } + return "" +} + +// GetGroup retrieves the group from the context +func (n *NacosAdapterCtx) GetGroup() string { + if v := n.Ctx.Value(ContextKeyGroup); v != nil { + if s, ok := v.(string); ok { + return s + } + } + return "" +} + +// GetDataId retrieves the dataId from the context +func (n *NacosAdapterCtx) GetDataId() string { + if v := n.Ctx.Value(ContextKeyDataId); v != nil { + if s, ok := v.(string); ok { + return s + } + } + return "" +} + +// GetContent retrieves the content from the context +func (n *NacosAdapterCtx) GetContent() string { + if v := n.Ctx.Value(gcfg.ContextKeyContent); v != nil { + if s, ok := v.(string); ok { + return s + } + } + return "" +} + +// GetOperation retrieves the operation from the context +func (n *NacosAdapterCtx) GetOperation() gcfg.OperationType { + if v := n.Ctx.Value(gcfg.ContextKeyOperation); v != nil { + if s, ok := v.(gcfg.OperationType); ok { + return s + } + } + return "" +} diff --git a/contrib/config/nacos/nacos_test.go b/contrib/config/nacos/nacos_test.go index 473a81747..1178d2cfe 100644 --- a/contrib/config/nacos/nacos_test.go +++ b/contrib/config/nacos/nacos_test.go @@ -7,6 +7,7 @@ package nacos_test import ( + "context" "net/url" "testing" "time" @@ -16,6 +17,7 @@ import ( "github.com/gogf/gf/v2/encoding/gjson" "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gcfg" "github.com/gogf/gf/v2/os/gctx" "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/util/guid" @@ -70,12 +72,22 @@ func TestNacosOnConfigChangeFunc(t *testing.T) { ConfigParam: configParam, Watch: true, OnConfigChange: func(namespace, group, dataId, data string) { - gtest.Assert("public", namespace) - gtest.Assert("test", group) - gtest.Assert("config.toml", dataId) - gtest.Assert("gf", g.Cfg().MustGet(gctx.GetInitCtx(), "app.name").String()) + t.Assert(namespace, "public") + t.Assert(group, "test") + t.Assert(dataId, "config.toml") + t.Assert(g.Cfg().MustGet(gctx.GetInitCtx(), "app.name").String(), "gf") }, }) + if watcherAdapter, ok := adapter.(gcfg.WatcherAdapter); ok { + watcherAdapter.AddWatcher("test", func(ctx context.Context) { + adapterCtx := nacos.GetAdapterCtx(ctx) + t.Assert(adapterCtx.GetNamespace(), "public") + t.Assert(adapterCtx.GetGroup(), "test") + t.Assert(adapterCtx.GetDataId(), "config.toml") + t.Assert(adapterCtx.GetOperation(), gcfg.OperationUpdate) + t.Assert(g.Cfg().MustGet(gctx.GetInitCtx(), "app.name").String(), "gf") + }) + } g.Cfg().SetAdapter(adapter) t.Assert(g.Cfg().Available(ctx), true) appName, err := g.Cfg().Get(ctx, "app.name") @@ -97,5 +109,8 @@ func TestNacosOnConfigChangeFunc(t *testing.T) { t.AssertNil(err) _, err = g.Client().Post(ctx, configPublishUrl+"&content="+url.QueryEscape(res2)) t.AssertNil(err) + if watcherAdapter, ok := adapter.(gcfg.WatcherAdapter); ok { + t.Assert(watcherAdapter.GetWatcherNames()[0], "test") + } }) } diff --git a/contrib/config/polaris/go.mod b/contrib/config/polaris/go.mod index 5e1b018e4..4d19a2f5e 100644 --- a/contrib/config/polaris/go.mod +++ b/contrib/config/polaris/go.mod @@ -3,60 +3,60 @@ module github.com/gogf/gf/contrib/config/polaris/v2 go 1.23.0 require ( - github.com/gogf/gf/v2 v2.9.3 + github.com/gogf/gf/v2 v2.9.5 github.com/polarismesh/polaris-go v1.6.1 ) require ( github.com/BurntSushi/toml v1.5.0 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/clbanning/mxj/v2 v2.7.0 // indirect - github.com/dlclark/regexp2 v1.11.2 // indirect + github.com/dlclark/regexp2 v1.7.0 // indirect github.com/emirpasic/gods v1.18.1 // indirect github.com/fatih/color v1.18.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/protobuf v1.5.4 // indirect + github.com/golang/protobuf v1.5.2 // indirect github.com/google/uuid v1.6.0 // indirect github.com/gorilla/websocket v1.5.3 // indirect github.com/grokify/html-strip-tags-go v0.1.0 // indirect - github.com/hashicorp/errwrap v1.1.0 // indirect + github.com/hashicorp/errwrap v1.0.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/magiconair/properties v1.8.10 // indirect - github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/natefinch/lumberjack v2.0.0+incompatible // indirect github.com/olekukonko/errors v1.1.0 // indirect github.com/olekukonko/ll v0.0.9 // indirect - github.com/olekukonko/tablewriter v1.0.9 // indirect + github.com/olekukonko/tablewriter v1.1.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/polarismesh/specification v1.5.5-alpha.1 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect - github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect - github.com/prometheus/procfs v0.15.1 // indirect - github.com/rivo/uniseg v0.4.7 // indirect + github.com/prometheus/client_golang v1.12.2 // indirect + github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/common v0.32.1 // indirect + github.com/prometheus/procfs v0.7.3 // indirect + github.com/rivo/uniseg v0.2.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect - go.opentelemetry.io/otel v1.37.0 // indirect - go.opentelemetry.io/otel/metric v1.37.0 // indirect - go.opentelemetry.io/otel/sdk v1.37.0 // indirect - go.opentelemetry.io/otel/trace v1.37.0 // indirect + go.opentelemetry.io/otel v1.38.0 // indirect + go.opentelemetry.io/otel/metric v1.38.0 // indirect + go.opentelemetry.io/otel/sdk v1.38.0 // indirect + go.opentelemetry.io/otel/trace v1.38.0 // indirect go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect go.uber.org/zap v1.21.0 // indirect - golang.org/x/net v0.43.0 // indirect + golang.org/x/net v0.40.0 // indirect golang.org/x/sys v0.35.0 // indirect - golang.org/x/text v0.28.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/grpc v1.59.0 // indirect - google.golang.org/protobuf v1.34.2 // indirect + golang.org/x/text v0.25.0 // indirect + google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a // indirect + google.golang.org/grpc v1.51.0 // indirect + google.golang.org/protobuf v1.28.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/contrib/config/polaris/go.sum b/contrib/config/polaris/go.sum index 1be90b589..2eec6a1b5 100644 --- a/contrib/config/polaris/go.sum +++ b/contrib/config/polaris/go.sum @@ -188,9 +188,8 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= -github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= @@ -209,9 +208,8 @@ github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWH github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dlclark/regexp2 v1.7.0 h1:7lJfhqlPssTb1WQx4yvTHN0uElPEv52sbaECrAQxjAo= github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= -github.com/dlclark/regexp2 v1.11.2 h1:/u628IuisSTwri5/UKloiIsH8+qF2Pu7xEQX+yIKg68= -github.com/dlclark/regexp2 v1.11.2/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -274,9 +272,8 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= -github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/gonum/blas v0.0.0-20181208220705-f22b278b28ac/go.mod h1:P32wAyui1PQ58Oce/KYkOqQv8cVw1zAapXOl+dRFGbc= github.com/gonum/floats v0.0.0-20181209220543-c233463c7e82/go.mod h1:PxC8OnwL11+aosOB5+iEPoV3picfs8tUpkVd0pDo+Kg= @@ -344,9 +341,8 @@ github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad github.com/grokify/html-strip-tags-go v0.1.0 h1:03UrQLjAny8xci+R+qjCce/MYnpNXCtgzltlQbOBae4= github.com/grokify/html-strip-tags-go v0.1.0/go.mod h1:ZdzgfHEzAfz9X6Xe5eBLVblWIxXfYSQ40S/VKrAOGpc= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= -github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= @@ -377,12 +373,14 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= -github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= @@ -392,8 +390,6 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= -github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/natefinch/lumberjack v2.0.0+incompatible h1:4QJd3OLAMgj7ph+yZTuX13Ld4UpgHp07nNdFX7mqFfM= @@ -402,8 +398,8 @@ github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5 github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y= github.com/olekukonko/ll v0.0.9 h1:Y+1YqDfVkqMWuEQMclsF9HUR5+a82+dxJuL1HHSRpxI= github.com/olekukonko/ll v0.0.9/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g= -github.com/olekukonko/tablewriter v1.0.9 h1:XGwRsYLC2bY7bNd93Dk51bcPZksWZmLYuaTHR0FqfL8= -github.com/olekukonko/tablewriter v1.0.9/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= +github.com/olekukonko/tablewriter v1.1.0 h1:N0LHrshF4T39KvI96fn6GT8HEjXRXYNDrDjKFDB7RIY= +github.com/olekukonko/tablewriter v1.1.0/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -418,35 +414,30 @@ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.12.2 h1:51L9cDoUHVrXx4zWYlcLQIZ+d+VXHgqnYKkIuq4g/34= github.com/prometheus/client_golang v1.12.2/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= -github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/common v0.32.1 h1:hWIdL3N2HoUx3B8j3YN9mWor0qhY/NlEKZEaXxuIRh4= github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= -github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= -github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= @@ -468,8 +459,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -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/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= 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= @@ -485,14 +476,16 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= -go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= -go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= -go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= -go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= -go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= -go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= -go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= +go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= +go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= +go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= +go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= +go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= @@ -595,8 +588,8 @@ golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= -golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= +golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= +golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -704,6 +697,7 @@ golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= @@ -721,8 +715,8 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= -golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -936,9 +930,8 @@ google.golang.org/genproto v0.0.0-20220919141832-68c03719ef51/go.mod h1:0Nb8Qy+S google.golang.org/genproto v0.0.0-20220920201722-2b89144ce006/go.mod h1:ht8XFiar2npT/g4vkk7O0WYS1sHOHbdujxbEp7CJWbw= google.golang.org/genproto v0.0.0-20220926165614-551eb538f295/go.mod h1:woMGP53BroOrRY3xTxlbr8Y3eB/nzAvvFM83q7kG2OI= google.golang.org/genproto v0.0.0-20220926220553-6981cbe3cfce/go.mod h1:woMGP53BroOrRY3xTxlbr8Y3eB/nzAvvFM83q7kG2OI= +google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a h1:GH6UPn3ixhWcKDhpnEC55S75cerLPdpp3hrhfKYjZgw= google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -973,9 +966,8 @@ google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= -google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= -google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -991,9 +983,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/contrib/config/polaris/polaris.go b/contrib/config/polaris/polaris.go index 5ab4f5548..e46180ffe 100644 --- a/contrib/config/polaris/polaris.go +++ b/contrib/config/polaris/polaris.go @@ -21,6 +21,12 @@ import ( "github.com/gogf/gf/v2/text/gstr" ) +var ( + // Compile-time checking for interface implementation. + _ gcfg.Adapter = (*Client)(nil) + _ gcfg.WatcherAdapter = (*Client)(nil) +) + // Config is the configuration for polaris. type Config struct { // The namespace of the configuration. @@ -39,9 +45,10 @@ type Config struct { // Client implements gcfg.Adapter implementing using polaris service. type Client struct { - config Config - client model.ConfigFile - value *g.Var + config Config + client model.ConfigFile + value *g.Var + watchers *gcfg.WatcherRegistry } const defaultLogDir = "/tmp/polaris/log" @@ -54,8 +61,9 @@ func New(ctx context.Context, config Config) (adapter gcfg.Adapter, err error) { } var ( client = &Client{ - config: config, - value: g.NewVar(nil, true), + config: config, + value: g.NewVar(nil, true), + watchers: gcfg.NewWatcherRegistry(), } configAPI polaris.ConfigAPI ) @@ -142,18 +150,24 @@ func (c *Client) updateLocalValueAndWatch(ctx context.Context) (err error) { return nil } +// doUpdate retrieves and caches the configmap content. func (c *Client) doUpdate(ctx context.Context) (err error) { if !c.client.HasContent() { return gerror.New("config file is empty") } var j *gjson.Json - if j, err = gjson.LoadContent([]byte(c.client.GetContent())); err != nil { + content := c.client.GetContent() + if j, err = gjson.LoadContent([]byte(content)); err != nil { return gerror.Wrap(err, `parse config map item from polaris failed`) } c.value.Set(j) + adapterCtx := NewAdapterCtx(ctx).WithNamespace(c.config.Namespace).WithFileGroup(c.config.FileGroup). + WithFileName(c.config.FileName).WithOperation(gcfg.OperationUpdate).WithContent(content) + c.notifyWatchers(adapterCtx.Ctx) return nil } +// doWatch watches the configmap content. func (c *Client) doWatch(ctx context.Context) (err error) { if !c.config.Watch { return nil @@ -165,11 +179,29 @@ func (c *Client) doWatch(ctx context.Context) (err error) { return nil } +// startAsynchronousWatch starts the asynchronous watch for the specified configuration file. func (c *Client) startAsynchronousWatch(ctx context.Context, changeChan <-chan model.ConfigFileChangeEvent) { - for { - select { - case <-changeChan: - _ = c.doUpdate(ctx) - } + for range changeChan { + _ = c.doUpdate(ctx) } } + +// AddWatcher adds a watcher for the specified configuration file. +func (c *Client) AddWatcher(name string, f func(ctx context.Context)) { + c.watchers.Add(name, f) +} + +// RemoveWatcher removes the watcher for the specified configuration file. +func (c *Client) RemoveWatcher(name string) { + c.watchers.Remove(name) +} + +// GetWatcherNames returns all watcher names. +func (c *Client) GetWatcherNames() []string { + return c.watchers.GetNames() +} + +// notifyWatchers notifies all watchers. +func (c *Client) notifyWatchers(ctx context.Context) { + c.watchers.Notify(ctx) +} diff --git a/contrib/config/polaris/polaris_adapter_ctx.go b/contrib/config/polaris/polaris_adapter_ctx.go new file mode 100644 index 000000000..d954f72c7 --- /dev/null +++ b/contrib/config/polaris/polaris_adapter_ctx.go @@ -0,0 +1,129 @@ +// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://github.com/gogf/gf. + +// Package polaris implements gcfg.Adapter using polaris service. +package polaris + +import ( + "context" + + "github.com/gogf/gf/v2/os/gcfg" + "github.com/gogf/gf/v2/os/gctx" +) + +const ( + // ContextKeyNamespace is the context key for namespace + ContextKeyNamespace gctx.StrKey = "namespace" + // ContextKeyFileGroup is the context key for group + ContextKeyFileGroup gctx.StrKey = "fileGroup" +) + +// PolarisAdapterCtx is the context adapter for polaris configuration +type PolarisAdapterCtx struct { + Ctx context.Context +} + +// NewAdapterCtxWithCtx creates and returns a new PolarisAdapterCtx with the given context. +func NewAdapterCtxWithCtx(ctx context.Context) *PolarisAdapterCtx { + if ctx == nil { + ctx = context.Background() + } + return &PolarisAdapterCtx{Ctx: ctx} +} + +// NewAdapterCtx creates and returns a new PolarisAdapterCtx. +// If context is provided, it will be used; otherwise, a background context is created. +func NewAdapterCtx(ctx ...context.Context) *PolarisAdapterCtx { + if len(ctx) > 0 { + return NewAdapterCtxWithCtx(ctx[0]) + } + return NewAdapterCtxWithCtx(context.Background()) +} + +// GetAdapterCtx creates a new PolarisAdapterCtx with the given context +func GetAdapterCtx(ctx context.Context) *PolarisAdapterCtx { + return NewAdapterCtxWithCtx(ctx) +} + +// WithOperation sets the operation in the context +func (n *PolarisAdapterCtx) WithOperation(operation gcfg.OperationType) *PolarisAdapterCtx { + n.Ctx = context.WithValue(n.Ctx, gcfg.ContextKeyOperation, operation) + return n +} + +// WithNamespace sets the namespace in the context +func (n *PolarisAdapterCtx) WithNamespace(namespace string) *PolarisAdapterCtx { + n.Ctx = context.WithValue(n.Ctx, ContextKeyNamespace, namespace) + return n +} + +// WithFileGroup sets the group in the context +func (n *PolarisAdapterCtx) WithFileGroup(fileGroup string) *PolarisAdapterCtx { + n.Ctx = context.WithValue(n.Ctx, ContextKeyFileGroup, fileGroup) + return n +} + +// WithFileName sets the fileName in the context +func (n *PolarisAdapterCtx) WithFileName(fileName string) *PolarisAdapterCtx { + n.Ctx = context.WithValue(n.Ctx, gcfg.ContextKeyFileName, fileName) + return n +} + +// WithContent sets the content in the context +func (n *PolarisAdapterCtx) WithContent(content string) *PolarisAdapterCtx { + n.Ctx = context.WithValue(n.Ctx, gcfg.ContextKeyContent, content) + return n +} + +// GetNamespace retrieves the namespace from the context +func (n *PolarisAdapterCtx) GetNamespace() string { + if v := n.Ctx.Value(ContextKeyNamespace); v != nil { + if s, ok := v.(string); ok { + return s + } + } + return "" +} + +// GetFileGroup retrieves the group from the context +func (n *PolarisAdapterCtx) GetFileGroup() string { + if v := n.Ctx.Value(ContextKeyFileGroup); v != nil { + if s, ok := v.(string); ok { + return s + } + } + return "" +} + +// GetFileName retrieves the fileName from the context +func (n *PolarisAdapterCtx) GetFileName() string { + if v := n.Ctx.Value(gcfg.ContextKeyFileName); v != nil { + if s, ok := v.(string); ok { + return s + } + } + return "" +} + +// GetContent retrieves the content from the context +func (n *PolarisAdapterCtx) GetContent() string { + if v := n.Ctx.Value(gcfg.ContextKeyContent); v != nil { + if s, ok := v.(string); ok { + return s + } + } + return "" +} + +// GetOperation retrieves the operation from the context +func (n *PolarisAdapterCtx) GetOperation() gcfg.OperationType { + if v := n.Ctx.Value(gcfg.ContextKeyOperation); v != nil { + if s, ok := v.(gcfg.OperationType); ok { + return s + } + } + return "" +} diff --git a/contrib/drivers/clickhouse/clickhouse.go b/contrib/drivers/clickhouse/clickhouse.go index e0dbc24fa..2452c931c 100644 --- a/contrib/drivers/clickhouse/clickhouse.go +++ b/contrib/drivers/clickhouse/clickhouse.go @@ -15,7 +15,7 @@ import ( "github.com/gogf/gf/v2/os/gctx" ) -// Driver is the driver for postgresql database. +// Driver is the driver for clickhouse database. type Driver struct { *gdb.Core } @@ -29,12 +29,11 @@ var ( ) const ( - updateFilterPattern = `(?i)UPDATE[\s]+?(\w+[\.]?\w+)[\s]+?SET` - deleteFilterPattern = `(?i)DELETE[\s]+?FROM[\s]+?(\w+[\.]?\w+)` - filterTypePattern = `(?i)^UPDATE|DELETE` - replaceSchemaPattern = `@(.+?)/([\w\.\-]+)+` - needParsedSqlInCtx gctx.StrKey = "NeedParsedSql" - driverName = "clickhouse" + updateFilterPattern = `(?i)UPDATE[\s]+?(\w+[\.]?\w+)[\s]+?SET` + deleteFilterPattern = `(?i)DELETE[\s]+?FROM[\s]+?(\w+[\.]?\w+)` + filterTypePattern = `(?i)^UPDATE|DELETE` + needParsedSqlInCtx gctx.StrKey = "NeedParsedSql" + driverName = "clickhouse" ) func init() { diff --git a/contrib/drivers/clickhouse/clickhouse_convert.go b/contrib/drivers/clickhouse/clickhouse_convert.go index e4392bcec..ccde35141 100644 --- a/contrib/drivers/clickhouse/clickhouse_convert.go +++ b/contrib/drivers/clickhouse/clickhouse_convert.go @@ -26,6 +26,7 @@ func (d *Driver) ConvertValueForField(ctx context.Context, fieldType string, fie if itemValue.IsZero() { return nil, nil } + return itemValue, nil case uuid.UUID: return itemValue, nil @@ -48,15 +49,13 @@ func (d *Driver) ConvertValueForField(ctx context.Context, fieldType string, fie return itemValue.Time, nil case *gtime.Time: - // for gtime type, needs to get time.Time - if itemValue != nil { - return itemValue.Time, nil - } // If the time is zero, it then updates it to nil, // which will insert/update the value to database as "null". if itemValue == nil || itemValue.IsZero() { return nil, nil } + // for gtime type, needs to get time.Time + return itemValue.Time, nil case decimal.Decimal: return itemValue, nil @@ -81,5 +80,4 @@ func (d *Driver) ConvertValueForField(ctx context.Context, fieldType string, fie } return convertedValue, nil } - return fieldValue, nil } diff --git a/contrib/drivers/clickhouse/clickhouse_do_filter.go b/contrib/drivers/clickhouse/clickhouse_do_filter.go index 0bac9fbea..04fa04ee5 100644 --- a/contrib/drivers/clickhouse/clickhouse_do_filter.go +++ b/contrib/drivers/clickhouse/clickhouse_do_filter.go @@ -73,13 +73,11 @@ func (d *Driver) DoFilter( } return newSql, args, nil + default: + return originSql, args, nil } - return originSql, args, nil } func (d *Driver) getNeedParsedSqlFromCtx(ctx context.Context) bool { - if ctx.Value(needParsedSqlInCtx) != nil { - return true - } - return false + return ctx.Value(needParsedSqlInCtx) != nil } diff --git a/contrib/drivers/clickhouse/clickhouse_do_insert.go b/contrib/drivers/clickhouse/clickhouse_do_insert.go index 6a3f4b7c2..a6c397ae3 100644 --- a/contrib/drivers/clickhouse/clickhouse_do_insert.go +++ b/contrib/drivers/clickhouse/clickhouse_do_insert.go @@ -19,10 +19,8 @@ import ( func (d *Driver) DoInsert( ctx context.Context, link gdb.Link, table string, list gdb.List, option gdb.DoInsertOption, ) (result sql.Result, err error) { - var ( - keys []string // Field names. - valueHolder = make([]string, 0) - ) + var keys, valueHolder []string + // Handle the field names and placeholders. for k := range list[0] { keys = append(keys, k) @@ -56,7 +54,12 @@ func (d *Driver) DoInsert( if err != nil { return } - for i := 0; i < len(list); i++ { + + defer func() { + _ = stmt.Close() + }() + + for i := range len(list) { // Values that will be committed to underlying database driver. params := make([]any, 0) for _, k := range keys { diff --git a/contrib/drivers/clickhouse/clickhouse_z_unit_db_test.go b/contrib/drivers/clickhouse/clickhouse_z_unit_db_test.go index fc8d62fb8..05e1cbc69 100644 --- a/contrib/drivers/clickhouse/clickhouse_z_unit_db_test.go +++ b/contrib/drivers/clickhouse/clickhouse_z_unit_db_test.go @@ -303,6 +303,8 @@ func Test_DB_Tables(t *testing.T) { createTable(v) } + defer dropTable(tables...) + result, err := db.Tables(ctx) gtest.AssertNil(err) diff --git a/contrib/drivers/clickhouse/clickhouse_z_unit_init_test.go b/contrib/drivers/clickhouse/clickhouse_z_unit_init_test.go index ab775d818..f7bffd155 100644 --- a/contrib/drivers/clickhouse/clickhouse_z_unit_init_test.go +++ b/contrib/drivers/clickhouse/clickhouse_z_unit_init_test.go @@ -52,8 +52,10 @@ func createInitTable(table ...string) string { return createInitTableWithDb(db, table...) } -func dropTable(table string) { - dropTableWithDb(db, table) +func dropTable(tables ...string) { + for _, table := range tables { + dropTableWithDb(db, table) + } } func createTableWithDb(db gdb.DB, table ...string) (name string) { diff --git a/contrib/drivers/clickhouse/clickhouse_z_unit_test.go b/contrib/drivers/clickhouse/clickhouse_z_unit_test.go index e2b7f2ac2..a496db0e8 100644 --- a/contrib/drivers/clickhouse/clickhouse_z_unit_test.go +++ b/contrib/drivers/clickhouse/clickhouse_z_unit_test.go @@ -8,7 +8,6 @@ package clickhouse import ( "context" - "fmt" "testing" "time" @@ -166,22 +165,22 @@ func createClickhouseExampleTable(connect gdb.DB) error { } func dropClickhouseTableVisits(conn gdb.DB) { - sqlStr := fmt.Sprintf("DROP TABLE IF EXISTS `visits`") + sqlStr := "DROP TABLE IF EXISTS `visits`" _, _ = conn.Exec(context.Background(), sqlStr) } func dropClickhouseTableDim(conn gdb.DB) { - sqlStr := fmt.Sprintf("DROP TABLE IF EXISTS `dim`") + sqlStr := "DROP TABLE IF EXISTS `dim`" _, _ = conn.Exec(context.Background(), sqlStr) } func dropClickhouseTableFact(conn gdb.DB) { - sqlStr := fmt.Sprintf("DROP TABLE IF EXISTS `fact`") + sqlStr := "DROP TABLE IF EXISTS `fact`" _, _ = conn.Exec(context.Background(), sqlStr) } func dropClickhouseExampleTable(conn gdb.DB) { - sqlStr := fmt.Sprintf("DROP TABLE IF EXISTS `data_type`") + sqlStr := "DROP TABLE IF EXISTS `data_type`" _, _ = conn.Exec(context.Background(), sqlStr) } diff --git a/contrib/drivers/clickhouse/go.mod b/contrib/drivers/clickhouse/go.mod index 9aee2bc46..b9813145a 100644 --- a/contrib/drivers/clickhouse/go.mod +++ b/contrib/drivers/clickhouse/go.mod @@ -4,7 +4,7 @@ go 1.23.0 require ( github.com/ClickHouse/clickhouse-go/v2 v2.0.15 - github.com/gogf/gf/v2 v2.9.3 + github.com/gogf/gf/v2 v2.9.5 github.com/google/uuid v1.6.0 github.com/shopspring/decimal v1.3.1 ) @@ -20,23 +20,23 @@ require ( github.com/gorilla/websocket v1.5.3 // indirect github.com/grokify/html-strip-tags-go v0.1.0 // indirect github.com/magiconair/properties v1.8.10 // indirect - github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/olekukonko/errors v1.1.0 // indirect github.com/olekukonko/ll v0.0.9 // indirect - github.com/olekukonko/tablewriter v1.0.9 // indirect + github.com/olekukonko/tablewriter v1.1.0 // indirect github.com/paulmach/orb v0.7.1 // indirect github.com/pierrec/lz4/v4 v4.1.14 // indirect - github.com/rivo/uniseg v0.4.7 // indirect + github.com/rivo/uniseg v0.2.0 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect - go.opentelemetry.io/otel v1.37.0 // indirect - go.opentelemetry.io/otel/metric v1.37.0 // indirect - go.opentelemetry.io/otel/sdk v1.37.0 // indirect - go.opentelemetry.io/otel/trace v1.37.0 // indirect - golang.org/x/net v0.43.0 // indirect + go.opentelemetry.io/otel v1.38.0 // indirect + go.opentelemetry.io/otel/metric v1.38.0 // indirect + go.opentelemetry.io/otel/sdk v1.38.0 // indirect + go.opentelemetry.io/otel/trace v1.38.0 // indirect + golang.org/x/net v0.40.0 // indirect golang.org/x/sys v0.35.0 // indirect - golang.org/x/text v0.28.0 // indirect + golang.org/x/text v0.25.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/contrib/drivers/clickhouse/go.sum b/contrib/drivers/clickhouse/go.sum index 0994055f6..1c66dda3a 100644 --- a/contrib/drivers/clickhouse/go.sum +++ b/contrib/drivers/clickhouse/go.sum @@ -51,8 +51,9 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= -github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= @@ -63,8 +64,8 @@ github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5 github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y= github.com/olekukonko/ll v0.0.9 h1:Y+1YqDfVkqMWuEQMclsF9HUR5+a82+dxJuL1HHSRpxI= github.com/olekukonko/ll v0.0.9/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g= -github.com/olekukonko/tablewriter v1.0.9 h1:XGwRsYLC2bY7bNd93Dk51bcPZksWZmLYuaTHR0FqfL8= -github.com/olekukonko/tablewriter v1.0.9/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= +github.com/olekukonko/tablewriter v1.1.0 h1:N0LHrshF4T39KvI96fn6GT8HEjXRXYNDrDjKFDB7RIY= +github.com/olekukonko/tablewriter v1.1.0/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= github.com/paulmach/orb v0.7.1 h1:Zha++Z5OX/l168sqHK3k4z18LDvr+YAO/VjK0ReQ9rU= github.com/paulmach/orb v0.7.1/go.mod h1:FWRlTgl88VI1RBx/MkrwWDRhQ96ctqMCh8boXhmqB/A= github.com/paulmach/protoscan v0.2.1/go.mod h1:SpcSwydNLrxUGSDvXvO0P7g7AuhJ7lcKfDlhJCDw2gY= @@ -73,11 +74,10 @@ github.com/pierrec/lz4/v4 v4.1.14 h1:+fL8AQEZtz/ijeNnpduH0bROTu0O3NZAlPjQxGn8LwE github.com/pierrec/lz4/v4 v4.1.14/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= -github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= github.com/shirou/gopsutil v2.19.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc= @@ -88,8 +88,8 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= -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/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/tklauser/go-sysconf v0.3.10/go.mod h1:C8XykCvCb+Gn0oNCWPIlcb0RuglQTYaQ2hGm7jmxEFk= github.com/tklauser/numcpus v0.4.0/go.mod h1:1+UI3pD8NW14VMwdgJNJ1ESk2UnwhAnz5hMwiKKqXCQ= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -98,15 +98,17 @@ github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQ go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= go.opentelemetry.io/otel v1.7.0/go.mod h1:5BdUoMIz5WEs0vt0CUEMtSSaTSHBBVwrhnz7+nrD5xk= -go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= -go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= -go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= -go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= -go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= -go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= +go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= +go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= +go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= +go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= +go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= go.opentelemetry.io/otel/trace v1.7.0/go.mod h1:fzLSB9nqR2eXzxPXb2JW9IKE+ScyXA48yyE4TNvoHqU= -go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= -go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -118,8 +120,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= -golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= +golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= +golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= 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-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -130,13 +132,14 @@ golang.org/x/sys v0.0.0-20191220220014-0732a990476f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220429233432-b5fbb4746d32/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= -golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= diff --git a/contrib/drivers/dm/go.mod b/contrib/drivers/dm/go.mod index c79aaf1a6..a6f0b5ce1 100644 --- a/contrib/drivers/dm/go.mod +++ b/contrib/drivers/dm/go.mod @@ -6,7 +6,7 @@ replace github.com/gogf/gf/v2 => ../../../ require ( gitee.com/chunanyong/dm v1.8.12 - github.com/gogf/gf/v2 v2.9.3 + github.com/gogf/gf/v2 v2.9.5 ) require ( @@ -22,20 +22,20 @@ require ( github.com/gorilla/websocket v1.5.3 // indirect github.com/grokify/html-strip-tags-go v0.1.0 // indirect github.com/magiconair/properties v1.8.10 // indirect - github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/olekukonko/errors v1.1.0 // indirect github.com/olekukonko/ll v0.0.9 // indirect - github.com/olekukonko/tablewriter v1.0.9 // indirect - github.com/rivo/uniseg v0.4.7 // indirect + github.com/olekukonko/tablewriter v1.1.0 // indirect + github.com/rivo/uniseg v0.2.0 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect - go.opentelemetry.io/otel v1.37.0 // indirect - go.opentelemetry.io/otel/metric v1.37.0 // indirect - go.opentelemetry.io/otel/sdk v1.37.0 // indirect - go.opentelemetry.io/otel/trace v1.37.0 // indirect - golang.org/x/net v0.43.0 // indirect + go.opentelemetry.io/otel v1.38.0 // indirect + go.opentelemetry.io/otel/metric v1.38.0 // indirect + go.opentelemetry.io/otel/sdk v1.38.0 // indirect + go.opentelemetry.io/otel/trace v1.38.0 // indirect + golang.org/x/net v0.40.0 // indirect golang.org/x/sys v0.35.0 // indirect - golang.org/x/text v0.28.0 // indirect + golang.org/x/text v0.25.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/contrib/drivers/dm/go.sum b/contrib/drivers/dm/go.sum index 6cfa39ab0..4494a4204 100644 --- a/contrib/drivers/dm/go.sum +++ b/contrib/drivers/dm/go.sum @@ -33,8 +33,9 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= -github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= @@ -43,37 +44,39 @@ github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5 github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y= github.com/olekukonko/ll v0.0.9 h1:Y+1YqDfVkqMWuEQMclsF9HUR5+a82+dxJuL1HHSRpxI= github.com/olekukonko/ll v0.0.9/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g= -github.com/olekukonko/tablewriter v1.0.9 h1:XGwRsYLC2bY7bNd93Dk51bcPZksWZmLYuaTHR0FqfL8= -github.com/olekukonko/tablewriter v1.0.9/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= +github.com/olekukonko/tablewriter v1.1.0 h1:N0LHrshF4T39KvI96fn6GT8HEjXRXYNDrDjKFDB7RIY= +github.com/olekukonko/tablewriter v1.1.0/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= -github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -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/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= -go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= -go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= -go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= -go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= -go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= -go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= -go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= +go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= +go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= +go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= +go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= +go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= -golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= +golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= +golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= -golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= diff --git a/contrib/drivers/mssql/go.mod b/contrib/drivers/mssql/go.mod index 1702839d8..420fdadce 100644 --- a/contrib/drivers/mssql/go.mod +++ b/contrib/drivers/mssql/go.mod @@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/drivers/mssql/v2 go 1.23.0 require ( - github.com/gogf/gf/v2 v2.9.3 + github.com/gogf/gf/v2 v2.9.5 github.com/microsoft/go-mssqldb v1.7.1 ) @@ -21,22 +21,22 @@ require ( github.com/gorilla/websocket v1.5.3 // indirect github.com/grokify/html-strip-tags-go v0.1.0 // indirect github.com/magiconair/properties v1.8.10 // indirect - github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/olekukonko/errors v1.1.0 // indirect github.com/olekukonko/ll v0.0.9 // indirect - github.com/olekukonko/tablewriter v1.0.9 // indirect - github.com/rivo/uniseg v0.4.7 // indirect + github.com/olekukonko/tablewriter v1.1.0 // indirect + github.com/rivo/uniseg v0.2.0 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect - go.opentelemetry.io/otel v1.37.0 // indirect - go.opentelemetry.io/otel/metric v1.37.0 // indirect - go.opentelemetry.io/otel/sdk v1.37.0 // indirect - go.opentelemetry.io/otel/trace v1.37.0 // indirect - golang.org/x/crypto v0.41.0 // indirect - golang.org/x/net v0.43.0 // indirect + go.opentelemetry.io/otel v1.38.0 // indirect + go.opentelemetry.io/otel/metric v1.38.0 // indirect + go.opentelemetry.io/otel/sdk v1.38.0 // indirect + go.opentelemetry.io/otel/trace v1.38.0 // indirect + golang.org/x/crypto v0.38.0 // indirect + golang.org/x/net v0.40.0 // indirect golang.org/x/sys v0.35.0 // indirect - golang.org/x/text v0.28.0 // indirect + golang.org/x/text v0.25.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/contrib/drivers/mssql/go.sum b/contrib/drivers/mssql/go.sum index a96040345..6163e9541 100644 --- a/contrib/drivers/mssql/go.sum +++ b/contrib/drivers/mssql/go.sum @@ -49,8 +49,9 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0 github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= -github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= @@ -61,40 +62,42 @@ github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5 github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y= github.com/olekukonko/ll v0.0.9 h1:Y+1YqDfVkqMWuEQMclsF9HUR5+a82+dxJuL1HHSRpxI= github.com/olekukonko/ll v0.0.9/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g= -github.com/olekukonko/tablewriter v1.0.9 h1:XGwRsYLC2bY7bNd93Dk51bcPZksWZmLYuaTHR0FqfL8= -github.com/olekukonko/tablewriter v1.0.9/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= +github.com/olekukonko/tablewriter v1.1.0 h1:N0LHrshF4T39KvI96fn6GT8HEjXRXYNDrDjKFDB7RIY= +github.com/olekukonko/tablewriter v1.1.0/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= -github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -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/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= -go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= -go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= -go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= -go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= -go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= -go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= -go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= +go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= +go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= +go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= +go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= +go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4= -golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc= -golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= -golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= +golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8= +golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw= +golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= +golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= -golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/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= diff --git a/contrib/drivers/mysql/go.mod b/contrib/drivers/mysql/go.mod index 4062c4a66..fe29ce59b 100644 --- a/contrib/drivers/mysql/go.mod +++ b/contrib/drivers/mysql/go.mod @@ -4,7 +4,7 @@ go 1.23.0 require ( github.com/go-sql-driver/mysql v1.7.1 - github.com/gogf/gf/v2 v2.9.3 + github.com/gogf/gf/v2 v2.9.5 ) require ( @@ -19,21 +19,21 @@ require ( github.com/gorilla/websocket v1.5.3 // indirect github.com/grokify/html-strip-tags-go v0.1.0 // indirect github.com/magiconair/properties v1.8.10 // indirect - github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/olekukonko/errors v1.1.0 // indirect github.com/olekukonko/ll v0.0.9 // indirect - github.com/olekukonko/tablewriter v1.0.9 // indirect - github.com/rivo/uniseg v0.4.7 // indirect + github.com/olekukonko/tablewriter v1.1.0 // indirect + github.com/rivo/uniseg v0.2.0 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect - go.opentelemetry.io/otel v1.37.0 // indirect - go.opentelemetry.io/otel/metric v1.37.0 // indirect - go.opentelemetry.io/otel/sdk v1.37.0 // indirect - go.opentelemetry.io/otel/trace v1.37.0 // indirect - golang.org/x/net v0.43.0 // indirect + go.opentelemetry.io/otel v1.38.0 // indirect + go.opentelemetry.io/otel/metric v1.38.0 // indirect + go.opentelemetry.io/otel/sdk v1.38.0 // indirect + go.opentelemetry.io/otel/trace v1.38.0 // indirect + golang.org/x/net v0.40.0 // indirect golang.org/x/sys v0.35.0 // indirect - golang.org/x/text v0.28.0 // indirect + golang.org/x/text v0.25.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/contrib/drivers/mysql/go.sum b/contrib/drivers/mysql/go.sum index f349de96e..aff4d99da 100644 --- a/contrib/drivers/mysql/go.sum +++ b/contrib/drivers/mysql/go.sum @@ -31,8 +31,9 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= -github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= @@ -41,36 +42,38 @@ github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5 github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y= github.com/olekukonko/ll v0.0.9 h1:Y+1YqDfVkqMWuEQMclsF9HUR5+a82+dxJuL1HHSRpxI= github.com/olekukonko/ll v0.0.9/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g= -github.com/olekukonko/tablewriter v1.0.9 h1:XGwRsYLC2bY7bNd93Dk51bcPZksWZmLYuaTHR0FqfL8= -github.com/olekukonko/tablewriter v1.0.9/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= +github.com/olekukonko/tablewriter v1.1.0 h1:N0LHrshF4T39KvI96fn6GT8HEjXRXYNDrDjKFDB7RIY= +github.com/olekukonko/tablewriter v1.1.0/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= -github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -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/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= -go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= -go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= -go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= -go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= -go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= -go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= -go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= +go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= +go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= +go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= +go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= +go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= -golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= +golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= +golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= -golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/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= diff --git a/contrib/drivers/mysql/mysql_z_unit_issue_test.go b/contrib/drivers/mysql/mysql_z_unit_issue_test.go index 6f4656bec..52c28b9fe 100644 --- a/contrib/drivers/mysql/mysql_z_unit_issue_test.go +++ b/contrib/drivers/mysql/mysql_z_unit_issue_test.go @@ -853,8 +853,8 @@ func Test_Issue2561(t *testing.T) { } result, err := db.Model(table).Data(data).Insert() t.AssertNil(err) - m, _ := result.LastInsertId() - t.Assert(m, 3) + // m, _ := result.LastInsertId() // TODO: The order of LastInsertId cannot be guaranteed + // t.Assert(m, 3) n, _ := result.RowsAffected() t.Assert(n, 3) @@ -1002,11 +1002,11 @@ func Test_Issue3086(t *testing.T) { } data := g.Slice{ User{ - Id: nil, + Id: 1, Passport: "user_1", }, User{ - Id: 2, + Id: 1, Passport: "user_2", }, } @@ -1024,11 +1024,11 @@ func Test_Issue3086(t *testing.T) { } data := g.Slice{ User{ - Id: 1, + Id: 3, Passport: "user_1", }, User{ - Id: 2, + Id: 4, Passport: "user_2", }, } diff --git a/contrib/drivers/mysql/testdata/fix_gdb_join_expect.sql b/contrib/drivers/mysql/testdata/fix_gdb_join_expect.sql index c391675cb..2ee4a53a4 100644 --- a/contrib/drivers/mysql/testdata/fix_gdb_join_expect.sql +++ b/contrib/drivers/mysql/testdata/fix_gdb_join_expect.sql @@ -1 +1 @@ -SELECT managed_resource.resource_id,managed_resource.user,managed_resource.status,managed_resource.status_message,managed_resource.safe_publication,managed_resource.rule_template_id,managed_resource.created_at,managed_resource.comments,managed_resource.expired_at,managed_resource.resource_mark_id,managed_resource.instance_id,managed_resource.resource_name,managed_resource.pay_mode,resource_mark.mark_name,resource_mark.color,rules_template.name,common_resource.src_instance_id,common_resource.database_kind,common_resource.source_type,common_resource.ip,common_resource.port FROM `managed_resource` LEFT JOIN `common_resource` ON (`managed_resource`.`resource_id`=`common_resource`.`resource_id`) LEFT JOIN `resource_mark` ON (`managed_resource`.`resource_mark_id` = `resource_mark`.`id`) LEFT JOIN `rules_template` ON (`managed_resource`.`rule_template_id` = `rules_template`.`template_id`) ORDER BY `src_instance_id` ASC \ No newline at end of file +SELECT `managed_resource`.`resource_id`,`managed_resource`.`user`,`managed_resource`.`status`,`managed_resource`.`status_message`,`managed_resource`.`safe_publication`,`managed_resource`.`rule_template_id`,`managed_resource`.`created_at`,`managed_resource`.`comments`,`managed_resource`.`expired_at`,`managed_resource`.`resource_mark_id`,`managed_resource`.`instance_id`,`managed_resource`.`resource_name`,`managed_resource`.`pay_mode`,`resource_mark`.`mark_name`,`resource_mark`.`color`,`rules_template`.`name`,`common_resource`.`src_instance_id`,`common_resource`.`database_kind`,`common_resource`.`source_type`,`common_resource`.`ip`,`common_resource`.`port` FROM `managed_resource` LEFT JOIN `common_resource` ON (`managed_resource`.`resource_id`=`common_resource`.`resource_id`) LEFT JOIN `resource_mark` ON (`managed_resource`.`resource_mark_id` = `resource_mark`.`id`) LEFT JOIN `rules_template` ON (`managed_resource`.`rule_template_id` = `rules_template`.`template_id`) ORDER BY `src_instance_id` ASC \ No newline at end of file diff --git a/contrib/drivers/oracle/go.mod b/contrib/drivers/oracle/go.mod index 08899feeb..529e6efc8 100644 --- a/contrib/drivers/oracle/go.mod +++ b/contrib/drivers/oracle/go.mod @@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/drivers/oracle/v2 go 1.23.0 require ( - github.com/gogf/gf/v2 v2.9.3 + github.com/gogf/gf/v2 v2.9.5 github.com/sijms/go-ora/v2 v2.7.10 ) @@ -19,21 +19,21 @@ require ( github.com/gorilla/websocket v1.5.3 // indirect github.com/grokify/html-strip-tags-go v0.1.0 // indirect github.com/magiconair/properties v1.8.10 // indirect - github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/olekukonko/errors v1.1.0 // indirect github.com/olekukonko/ll v0.0.9 // indirect - github.com/olekukonko/tablewriter v1.0.9 // indirect - github.com/rivo/uniseg v0.4.7 // indirect + github.com/olekukonko/tablewriter v1.1.0 // indirect + github.com/rivo/uniseg v0.2.0 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect - go.opentelemetry.io/otel v1.37.0 // indirect - go.opentelemetry.io/otel/metric v1.37.0 // indirect - go.opentelemetry.io/otel/sdk v1.37.0 // indirect - go.opentelemetry.io/otel/trace v1.37.0 // indirect - golang.org/x/net v0.43.0 // indirect + go.opentelemetry.io/otel v1.38.0 // indirect + go.opentelemetry.io/otel/metric v1.38.0 // indirect + go.opentelemetry.io/otel/sdk v1.38.0 // indirect + go.opentelemetry.io/otel/trace v1.38.0 // indirect + golang.org/x/net v0.40.0 // indirect golang.org/x/sys v0.35.0 // indirect - golang.org/x/text v0.28.0 // indirect + golang.org/x/text v0.25.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/contrib/drivers/oracle/go.sum b/contrib/drivers/oracle/go.sum index 93a1fcc6b..8b036b666 100644 --- a/contrib/drivers/oracle/go.sum +++ b/contrib/drivers/oracle/go.sum @@ -29,8 +29,9 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= -github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= @@ -39,38 +40,40 @@ github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5 github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y= github.com/olekukonko/ll v0.0.9 h1:Y+1YqDfVkqMWuEQMclsF9HUR5+a82+dxJuL1HHSRpxI= github.com/olekukonko/ll v0.0.9/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g= -github.com/olekukonko/tablewriter v1.0.9 h1:XGwRsYLC2bY7bNd93Dk51bcPZksWZmLYuaTHR0FqfL8= -github.com/olekukonko/tablewriter v1.0.9/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= +github.com/olekukonko/tablewriter v1.1.0 h1:N0LHrshF4T39KvI96fn6GT8HEjXRXYNDrDjKFDB7RIY= +github.com/olekukonko/tablewriter v1.1.0/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= -github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= github.com/sijms/go-ora/v2 v2.7.10 h1:GSLdj0PYYgSndhsnm7b6p32OqgnwnUZSkFb3j+htfhI= github.com/sijms/go-ora/v2 v2.7.10/go.mod h1:EHxlY6x7y9HAsdfumurRfTd+v8NrEOTR3Xl4FWlH6xk= -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/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= -go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= -go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= -go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= -go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= -go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= -go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= -go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= +go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= +go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= +go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= +go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= +go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= -golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= +golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= +golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= -golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/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= diff --git a/contrib/drivers/pgsql/go.mod b/contrib/drivers/pgsql/go.mod index 3efdb465f..8389caf92 100644 --- a/contrib/drivers/pgsql/go.mod +++ b/contrib/drivers/pgsql/go.mod @@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/drivers/pgsql/v2 go 1.23.0 require ( - github.com/gogf/gf/v2 v2.9.3 + github.com/gogf/gf/v2 v2.9.5 github.com/lib/pq v1.10.9 ) @@ -19,21 +19,21 @@ require ( github.com/gorilla/websocket v1.5.3 // indirect github.com/grokify/html-strip-tags-go v0.1.0 // indirect github.com/magiconair/properties v1.8.10 // indirect - github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/olekukonko/errors v1.1.0 // indirect github.com/olekukonko/ll v0.0.9 // indirect - github.com/olekukonko/tablewriter v1.0.9 // indirect - github.com/rivo/uniseg v0.4.7 // indirect + github.com/olekukonko/tablewriter v1.1.0 // indirect + github.com/rivo/uniseg v0.2.0 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect - go.opentelemetry.io/otel v1.37.0 // indirect - go.opentelemetry.io/otel/metric v1.37.0 // indirect - go.opentelemetry.io/otel/sdk v1.37.0 // indirect - go.opentelemetry.io/otel/trace v1.37.0 // indirect - golang.org/x/net v0.43.0 // indirect + go.opentelemetry.io/otel v1.38.0 // indirect + go.opentelemetry.io/otel/metric v1.38.0 // indirect + go.opentelemetry.io/otel/sdk v1.38.0 // indirect + go.opentelemetry.io/otel/trace v1.38.0 // indirect + golang.org/x/net v0.40.0 // indirect golang.org/x/sys v0.35.0 // indirect - golang.org/x/text v0.28.0 // indirect + golang.org/x/text v0.25.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/contrib/drivers/pgsql/go.sum b/contrib/drivers/pgsql/go.sum index f358f4198..418882c2a 100644 --- a/contrib/drivers/pgsql/go.sum +++ b/contrib/drivers/pgsql/go.sum @@ -31,8 +31,9 @@ github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= -github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= @@ -41,36 +42,38 @@ github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5 github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y= github.com/olekukonko/ll v0.0.9 h1:Y+1YqDfVkqMWuEQMclsF9HUR5+a82+dxJuL1HHSRpxI= github.com/olekukonko/ll v0.0.9/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g= -github.com/olekukonko/tablewriter v1.0.9 h1:XGwRsYLC2bY7bNd93Dk51bcPZksWZmLYuaTHR0FqfL8= -github.com/olekukonko/tablewriter v1.0.9/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= +github.com/olekukonko/tablewriter v1.1.0 h1:N0LHrshF4T39KvI96fn6GT8HEjXRXYNDrDjKFDB7RIY= +github.com/olekukonko/tablewriter v1.1.0/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= -github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -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/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= -go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= -go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= -go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= -go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= -go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= -go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= -go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= +go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= +go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= +go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= +go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= +go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= -golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= +golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= +golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= -golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/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= diff --git a/contrib/drivers/pgsql/pgsql_convert.go b/contrib/drivers/pgsql/pgsql_convert.go index 00e1e92fa..f308d95df 100644 --- a/contrib/drivers/pgsql/pgsql_convert.go +++ b/contrib/drivers/pgsql/pgsql_convert.go @@ -77,6 +77,8 @@ func (d *Driver) CheckLocalTypeForField(ctx context.Context, fieldType string, f case "_varchar", "_text": return gdb.LocalTypeStringSlice, nil + case "_numeric", "_decimal": + return gdb.LocalTypeFloat64Slice, nil default: return d.Core.CheckLocalTypeForField(ctx, fieldType, fieldValue) @@ -130,6 +132,13 @@ func (d *Driver) ConvertValueForLocal(ctx context.Context, fieldType string, fie } return []string(result), nil + // Float64 slice. + case "_numeric", "_decimal": + var result pq.Float64Array + if err := result.Scan(fieldValue); err != nil { + return nil, err + } + return []float64(result), nil default: return d.Core.ConvertValueForLocal(ctx, fieldType, fieldValue) } diff --git a/contrib/drivers/pgsql/pgsql_table_fields.go b/contrib/drivers/pgsql/pgsql_table_fields.go index d53667c08..64e0ee790 100644 --- a/contrib/drivers/pgsql/pgsql_table_fields.go +++ b/contrib/drivers/pgsql/pgsql_table_fields.go @@ -27,7 +27,7 @@ FROM pg_attribute a left join pg_description b ON a.attrelid=b.objoid AND a.attnum = b.objsubid left join pg_type t ON a.atttypid = t.oid left join information_schema.columns ic on ic.column_name = a.attname and ic.table_name = c.relname -WHERE c.relname = '%s' and a.attisdropped is false and a.attnum > 0 +WHERE c.oid = '%s'::regclass and a.attisdropped is false and a.attnum > 0 ORDER BY a.attnum` ) @@ -57,14 +57,21 @@ func (d *Driver) TableFields(ctx context.Context, table string, schema ...string } fields = make(map[string]*gdb.TableField) var ( - index = 0 - name string - ok bool + index = 0 + name string + ok bool + existingField *gdb.TableField ) for _, m := range result { name = m["field"].String() - // Filter duplicated fields. - if _, ok = fields[name]; ok { + // Merge duplicated fields, especially for key constraints. + // Priority: pri > uni > others + if existingField, ok = fields[name]; ok { + currentKey := m["key"].String() + // Merge key information with priority: pri > uni + if currentKey == "pri" || (currentKey == "uni" && existingField.Key != "pri") { + existingField.Key = currentKey + } continue } fields[name] = &gdb.TableField{ diff --git a/contrib/drivers/pgsql/pgsql_z_unit_db_test.go b/contrib/drivers/pgsql/pgsql_z_unit_db_test.go index 3dd264c9c..67b9d7978 100644 --- a/contrib/drivers/pgsql/pgsql_z_unit_db_test.go +++ b/contrib/drivers/pgsql/pgsql_z_unit_db_test.go @@ -302,8 +302,8 @@ func Test_DB_TableFields(t *testing.T) { defer dropTable(table) var expect = map[string][]any{ - //[]string: Index Type Null Key Default Comment - //id is bigserial so the default is a pgsql function + // []string: Index Type Null Key Default Comment + // id is bigserial so the default is a pgsql function "id": {0, "int8", false, "pri", fmt.Sprintf("nextval('%s_id_seq'::regclass)", table), ""}, "passport": {1, "varchar", false, "", nil, ""}, "password": {2, "varchar", false, "", nil, ""}, @@ -339,8 +339,8 @@ int_col INT);` IntCol int64 } // pgsql converts table names to lowercase + // mark: [c.oid = '%s'::regclass] is not case-sensitive tableName := "Error_table" - errStr := fmt.Sprintf(`The table "%s" may not exist, or the table contains no fields`, tableName) _, err := db.Exec(ctx, fmt.Sprintf(createSql, tableName)) gtest.AssertNil(err) defer dropTable(tableName) @@ -351,7 +351,7 @@ int_col INT);` IntCol: 2, } _, err = db.Model(tableName).Data(data).Insert() - t.Assert(err, errStr) + t.AssertNE(err, nil) // Insert a piece of test data using lowercase _, err = db.Model(strings.ToLower(tableName)).Data(data).Insert() @@ -360,7 +360,7 @@ int_col INT);` _, err = db.Model(tableName).Where("id", 1).Data(g.Map{ "int_col": 9999, }).Update() - t.Assert(err, errStr) + t.AssertNE(err, nil) }) // The inserted field does not exist in the table @@ -370,7 +370,7 @@ int_col INT);` "int_col_22": 11111, } _, err = db.Model(tableName).Data(data).Insert() - t.Assert(err, errStr) + t.Assert(err, fmt.Errorf(`input data match no fields in table "%s"`, tableName)) lowerTableName := strings.ToLower(tableName) _, err = db.Model(lowerTableName).Data(data).Insert() @@ -384,6 +384,91 @@ int_col INT);` } +func Test_DB_TableFields_DuplicateConstraints(t *testing.T) { + // Test for the fix of duplicate field results with multiple constraints + // This test verifies that when a field has multiple constraints (e.g., both primary key and unique), + // the TableFields method correctly merges the results with proper priority (pri > uni > others) + gtest.C(t, func(t *gtest.T) { + tableName := "test_multi_constraint" + createSql := fmt.Sprintf(` + CREATE TABLE %s ( + id bigserial NOT NULL PRIMARY KEY, + email varchar(100) NOT NULL UNIQUE, + username varchar(50) NOT NULL, + status int NOT NULL DEFAULT 1 + )`, tableName) + + _, err := db.Exec(ctx, createSql) + t.AssertNil(err) + defer dropTable(tableName) + + // Get table fields + fields, err := db.TableFields(ctx, tableName) + t.AssertNil(err) + + // Verify id field has primary key constraint + t.AssertNE(fields["id"], nil) + t.Assert(fields["id"].Key, "pri") + t.Assert(fields["id"].Name, "id") + t.Assert(fields["id"].Type, "int8") + + // Verify email field has unique constraint + t.AssertNE(fields["email"], nil) + t.Assert(fields["email"].Key, "uni") + t.Assert(fields["email"].Name, "email") + t.Assert(fields["email"].Type, "varchar") + + // Verify username field has no constraint + t.AssertNE(fields["username"], nil) + t.Assert(fields["username"].Key, "") + t.Assert(fields["username"].Name, "username") + + // Verify status field has no constraint and has default value + t.AssertNE(fields["status"], nil) + t.Assert(fields["status"].Key, "") + t.Assert(fields["status"].Name, "status") + t.Assert(fields["status"].Default, 1) + + // Verify field count is correct (no duplicates) + t.Assert(len(fields), 4) + }) + + // Test table with composite constraints + gtest.C(t, func(t *gtest.T) { + tableName := "test_composite_constraint" + createSql := fmt.Sprintf(` + CREATE TABLE %s ( + user_id bigint NOT NULL, + project_id bigint NOT NULL, + role varchar(50) NOT NULL, + PRIMARY KEY (user_id, project_id) + )`, tableName) + + _, err := db.Exec(ctx, createSql) + t.AssertNil(err) + defer dropTable(tableName) + + // Get table fields + fields, err := db.TableFields(ctx, tableName) + t.AssertNil(err) + + // In PostgreSQL, composite primary keys may appear in query results + // The first field in the composite key should be marked as 'pri' + t.AssertNE(fields["user_id"], nil) + t.Assert(fields["user_id"].Name, "user_id") + + t.AssertNE(fields["project_id"], nil) + t.Assert(fields["project_id"].Name, "project_id") + + t.AssertNE(fields["role"], nil) + t.Assert(fields["role"].Name, "role") + t.Assert(fields["role"].Key, "") + + // Verify field count is correct (no duplicates) + t.Assert(len(fields), 3) + }) +} + func Test_DB_InsertIgnore(t *testing.T) { table := createTable() defer dropTable(table) diff --git a/contrib/drivers/pgsql/pgsql_z_unit_init_test.go b/contrib/drivers/pgsql/pgsql_z_unit_init_test.go index e317d3000..f1a0034f3 100644 --- a/contrib/drivers/pgsql/pgsql_z_unit_init_test.go +++ b/contrib/drivers/pgsql/pgsql_z_unit_init_test.go @@ -37,8 +37,8 @@ func init() { Link: `pgsql:postgres:12345678@tcp(127.0.0.1:5432)`, } - //pgsql only permit to connect to the designation database. - //so you need to create the pgsql database before you use orm + // pgsql only permit to connect to the designation database. + // so you need to create the pgsql database before you use orm gdb.AddConfigNode(gdb.DefaultGroupName, configNode) if r, err := gdb.New(configNode); err != nil { gtest.Fatal(err) @@ -85,6 +85,8 @@ func createTableWithDb(db gdb.DB, table ...string) (name string) { create_time timestamp NOT NULL, favorite_movie varchar[], favorite_music text[], + numeric_values numeric[], + decimal_values decimal[], PRIMARY KEY (id) ) ;`, name, )); err != nil { diff --git a/contrib/drivers/pgsql/pgsql_z_unit_model_test.go b/contrib/drivers/pgsql/pgsql_z_unit_model_test.go index 3a51ba264..56db22a85 100644 --- a/contrib/drivers/pgsql/pgsql_z_unit_model_test.go +++ b/contrib/drivers/pgsql/pgsql_z_unit_model_test.go @@ -692,3 +692,68 @@ func Test_ConvertSliceString(t *testing.T) { t.Assert(len(user2.FavoriteMovie), 0) }) } + +func Test_ConvertSliceFloat64(t *testing.T) { + table := createTable() + defer dropTable(table) + + type Args struct { + NumericValues []float64 `orm:"numeric_values"` + DecimalValues []float64 `orm:"decimal_values"` + } + type User struct { + Id int `orm:"id"` + Passport string `orm:"passport"` + Password string `json:"password"` + NickName string `json:"nickname"` + CreateTime *gtime.Time `json:"create_time"` + Args + } + + tests := []struct { + name string + args Args + }{ + { + name: "nil", + args: Args{ + NumericValues: nil, + DecimalValues: nil, + }, + }, + { + name: "not nil", + args: Args{ + NumericValues: []float64{1.1, 2.2, 3.3}, + DecimalValues: []float64{1.1, 2.2, 3.3}, + }, + }, + { + name: "not empty", + args: Args{ + NumericValues: []float64{}, + DecimalValues: []float64{}, + }, + }, + } + now := gtime.New(CreateTime) + for i, tt := range tests { + gtest.C(t, func(t *gtest.T) { + user := User{ + Id: i + 1, + Passport: "", + Password: "", + NickName: "", + CreateTime: now, + Args: tt.args, + } + + _, err := db.Model(table).OmitNilData().Insert(user) + t.AssertNil(err) + var got Args + err = db.Model(table).Where("id", user.Id).Limit(1).Scan(&got) + t.AssertNil(err) + t.AssertEQ(tt.args, got) + }) + } +} diff --git a/contrib/drivers/sqlite/go.mod b/contrib/drivers/sqlite/go.mod index c565556cc..0b62c344e 100644 --- a/contrib/drivers/sqlite/go.mod +++ b/contrib/drivers/sqlite/go.mod @@ -4,7 +4,7 @@ go 1.23.0 require ( github.com/glebarez/go-sqlite v1.21.2 - github.com/gogf/gf/v2 v2.9.3 + github.com/gogf/gf/v2 v2.9.5 ) require ( @@ -20,22 +20,22 @@ require ( github.com/gorilla/websocket v1.5.3 // indirect github.com/grokify/html-strip-tags-go v0.1.0 // indirect github.com/magiconair/properties v1.8.10 // indirect - github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/olekukonko/errors v1.1.0 // indirect github.com/olekukonko/ll v0.0.9 // indirect - github.com/olekukonko/tablewriter v1.0.9 // indirect + github.com/olekukonko/tablewriter v1.1.0 // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect - github.com/rivo/uniseg v0.4.7 // indirect + github.com/rivo/uniseg v0.2.0 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect - go.opentelemetry.io/otel v1.37.0 // indirect - go.opentelemetry.io/otel/metric v1.37.0 // indirect - go.opentelemetry.io/otel/sdk v1.37.0 // indirect - go.opentelemetry.io/otel/trace v1.37.0 // indirect - golang.org/x/net v0.43.0 // indirect + go.opentelemetry.io/otel v1.38.0 // indirect + go.opentelemetry.io/otel/metric v1.38.0 // indirect + go.opentelemetry.io/otel/sdk v1.38.0 // indirect + go.opentelemetry.io/otel/trace v1.38.0 // indirect + golang.org/x/net v0.40.0 // indirect golang.org/x/sys v0.35.0 // indirect - golang.org/x/text v0.28.0 // indirect + golang.org/x/text v0.25.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect modernc.org/libc v1.22.5 // indirect modernc.org/mathutil v1.5.0 // indirect diff --git a/contrib/drivers/sqlite/go.sum b/contrib/drivers/sqlite/go.sum index 377b0e485..3c3cdb256 100644 --- a/contrib/drivers/sqlite/go.sum +++ b/contrib/drivers/sqlite/go.sum @@ -35,8 +35,9 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= -github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= @@ -45,39 +46,41 @@ github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5 github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y= github.com/olekukonko/ll v0.0.9 h1:Y+1YqDfVkqMWuEQMclsF9HUR5+a82+dxJuL1HHSRpxI= github.com/olekukonko/ll v0.0.9/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g= -github.com/olekukonko/tablewriter v1.0.9 h1:XGwRsYLC2bY7bNd93Dk51bcPZksWZmLYuaTHR0FqfL8= -github.com/olekukonko/tablewriter v1.0.9/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= +github.com/olekukonko/tablewriter v1.1.0 h1:N0LHrshF4T39KvI96fn6GT8HEjXRXYNDrDjKFDB7RIY= +github.com/olekukonko/tablewriter v1.1.0/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= -github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -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/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= -go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= -go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= -go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= -go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= -go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= -go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= -go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= +go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= +go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= +go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= +go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= +go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= -golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= +golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= +golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= -golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/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= diff --git a/contrib/drivers/sqlitecgo/go.mod b/contrib/drivers/sqlitecgo/go.mod index 40c55e592..140467a0d 100644 --- a/contrib/drivers/sqlitecgo/go.mod +++ b/contrib/drivers/sqlitecgo/go.mod @@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/drivers/sqlitecgo/v2 go 1.23.0 require ( - github.com/gogf/gf/v2 v2.9.3 + github.com/gogf/gf/v2 v2.9.5 github.com/mattn/go-sqlite3 v1.14.17 ) @@ -19,21 +19,21 @@ require ( github.com/gorilla/websocket v1.5.3 // indirect github.com/grokify/html-strip-tags-go v0.1.0 // indirect github.com/magiconair/properties v1.8.10 // indirect - github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/olekukonko/errors v1.1.0 // indirect github.com/olekukonko/ll v0.0.9 // indirect - github.com/olekukonko/tablewriter v1.0.9 // indirect - github.com/rivo/uniseg v0.4.7 // indirect + github.com/olekukonko/tablewriter v1.1.0 // indirect + github.com/rivo/uniseg v0.2.0 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect - go.opentelemetry.io/otel v1.37.0 // indirect - go.opentelemetry.io/otel/metric v1.37.0 // indirect - go.opentelemetry.io/otel/sdk v1.37.0 // indirect - go.opentelemetry.io/otel/trace v1.37.0 // indirect - golang.org/x/net v0.43.0 // indirect + go.opentelemetry.io/otel v1.38.0 // indirect + go.opentelemetry.io/otel/metric v1.38.0 // indirect + go.opentelemetry.io/otel/sdk v1.38.0 // indirect + go.opentelemetry.io/otel/trace v1.38.0 // indirect + golang.org/x/net v0.40.0 // indirect golang.org/x/sys v0.35.0 // indirect - golang.org/x/text v0.28.0 // indirect + golang.org/x/text v0.25.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/contrib/drivers/sqlitecgo/go.sum b/contrib/drivers/sqlitecgo/go.sum index 4d74cd45e..82c3579fe 100644 --- a/contrib/drivers/sqlitecgo/go.sum +++ b/contrib/drivers/sqlitecgo/go.sum @@ -29,8 +29,9 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= -github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= @@ -41,36 +42,38 @@ github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5 github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y= github.com/olekukonko/ll v0.0.9 h1:Y+1YqDfVkqMWuEQMclsF9HUR5+a82+dxJuL1HHSRpxI= github.com/olekukonko/ll v0.0.9/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g= -github.com/olekukonko/tablewriter v1.0.9 h1:XGwRsYLC2bY7bNd93Dk51bcPZksWZmLYuaTHR0FqfL8= -github.com/olekukonko/tablewriter v1.0.9/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= +github.com/olekukonko/tablewriter v1.1.0 h1:N0LHrshF4T39KvI96fn6GT8HEjXRXYNDrDjKFDB7RIY= +github.com/olekukonko/tablewriter v1.1.0/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= -github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -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/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= -go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= -go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= -go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= -go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= -go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= -go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= -go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= +go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= +go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= +go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= +go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= +go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= -golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= +golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= +golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= -golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/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= diff --git a/contrib/metric/otelmetric/go.mod b/contrib/metric/otelmetric/go.mod index e2be75687..8e8059e4c 100644 --- a/contrib/metric/otelmetric/go.mod +++ b/contrib/metric/otelmetric/go.mod @@ -3,14 +3,14 @@ module github.com/gogf/gf/contrib/metric/otelmetric/v2 go 1.23.0 require ( - github.com/gogf/gf/v2 v2.9.3 - github.com/prometheus/client_golang v1.23.0 - go.opentelemetry.io/contrib/instrumentation/runtime v0.62.0 - go.opentelemetry.io/otel v1.37.0 - go.opentelemetry.io/otel/exporters/prometheus v0.46.0 - go.opentelemetry.io/otel/metric v1.37.0 - go.opentelemetry.io/otel/sdk v1.37.0 - go.opentelemetry.io/otel/sdk/metric v1.37.0 + github.com/gogf/gf/v2 v2.9.5 + github.com/prometheus/client_golang v1.23.2 + go.opentelemetry.io/contrib/instrumentation/runtime v0.63.0 + go.opentelemetry.io/otel v1.38.0 + go.opentelemetry.io/otel/exporters/prometheus v0.60.0 + go.opentelemetry.io/otel/metric v1.38.0 + go.opentelemetry.io/otel/sdk v1.38.0 + go.opentelemetry.io/otel/sdk/metric v1.38.0 ) require ( @@ -25,21 +25,24 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/google/uuid v1.6.0 // indirect github.com/gorilla/websocket v1.5.3 // indirect + github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc // indirect github.com/grokify/html-strip-tags-go v0.1.0 // indirect github.com/magiconair/properties v1.8.10 // indirect - github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/olekukonko/errors v1.1.0 // indirect github.com/olekukonko/ll v0.0.9 // indirect - github.com/olekukonko/tablewriter v1.0.9 // indirect + github.com/olekukonko/tablewriter v1.1.0 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.65.0 // indirect + github.com/prometheus/common v0.66.1 // indirect + github.com/prometheus/otlptranslator v0.0.2 // indirect github.com/prometheus/procfs v0.17.0 // indirect - github.com/rivo/uniseg v0.4.7 // indirect + github.com/rivo/uniseg v0.2.0 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect - go.opentelemetry.io/otel/trace v1.37.0 // indirect + go.opentelemetry.io/otel/trace v1.38.0 // indirect + go.yaml.in/yaml/v2 v2.4.2 // indirect golang.org/x/net v0.43.0 // indirect golang.org/x/sys v0.35.0 // indirect golang.org/x/text v0.28.0 // indirect diff --git a/contrib/metric/otelmetric/go.sum b/contrib/metric/otelmetric/go.sum index d6fe5b4a0..bbe5fd86b 100644 --- a/contrib/metric/otelmetric/go.sum +++ b/contrib/metric/otelmetric/go.sum @@ -25,6 +25,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc h1:GN2Lv3MGO7AS6PrRoT6yV5+wkrOpcszoIsO4+4ds248= +github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc/go.mod h1:+JKpmjMGhpgPL+rXZ5nsZieVzvarn86asRlBg4uNGnk= github.com/grokify/html-strip-tags-go v0.1.0 h1:03UrQLjAny8xci+R+qjCce/MYnpNXCtgzltlQbOBae4= github.com/grokify/html-strip-tags-go v0.1.0/go.mod h1:ZdzgfHEzAfz9X6Xe5eBLVblWIxXfYSQ40S/VKrAOGpc= github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= @@ -37,8 +39,9 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0 github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= -github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= @@ -49,45 +52,49 @@ github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5 github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y= github.com/olekukonko/ll v0.0.9 h1:Y+1YqDfVkqMWuEQMclsF9HUR5+a82+dxJuL1HHSRpxI= github.com/olekukonko/ll v0.0.9/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g= -github.com/olekukonko/tablewriter v1.0.9 h1:XGwRsYLC2bY7bNd93Dk51bcPZksWZmLYuaTHR0FqfL8= -github.com/olekukonko/tablewriter v1.0.9/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= +github.com/olekukonko/tablewriter v1.1.0 h1:N0LHrshF4T39KvI96fn6GT8HEjXRXYNDrDjKFDB7RIY= +github.com/olekukonko/tablewriter v1.1.0/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v1.23.0 h1:ust4zpdl9r4trLY/gSjlm07PuiBq2ynaXXlptpfy8Uc= -github.com/prometheus/client_golang v1.23.0/go.mod h1:i/o0R9ByOnHX0McrTMTyhYvKE4haaf2mW08I+jGAjEE= +github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= +github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= -github.com/prometheus/common v0.65.0 h1:QDwzd+G1twt//Kwj/Ww6E9FQq1iVMmODnILtW1t2VzE= -github.com/prometheus/common v0.65.0/go.mod h1:0gZns+BLRQ3V6NdaerOhMbwwRbNh9hkGINtQAsP5GS8= +github.com/prometheus/common v0.66.1 h1:h5E0h5/Y8niHc5DlaLlWLArTQI7tMrsfQjHV+d9ZoGs= +github.com/prometheus/common v0.66.1/go.mod h1:gcaUsgf3KfRSwHY4dIMXLPV0K/Wg1oZ8+SbZk/HH/dA= +github.com/prometheus/otlptranslator v0.0.2 h1:+1CdeLVrRQ6Psmhnobldo0kTp96Rj80DRXRd5OSnMEQ= +github.com/prometheus/otlptranslator v0.0.2/go.mod h1:P8AwMgdD7XEr6QRUJ2QWLpiAZTgTE2UYgjlu3svompI= github.com/prometheus/procfs v0.17.0 h1:FuLQ+05u4ZI+SS/w9+BWEM2TXiHKsUQ9TADiRH7DuK0= github.com/prometheus/procfs v0.17.0/go.mod h1:oPQLaDAMRbA+u8H5Pbfq+dl3VDAvHxMUOVhe0wYB2zw= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= -github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -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/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/contrib/instrumentation/runtime v0.62.0 h1:ZIt0ya9/y4WyRIzfLC8hQRRsWg0J9M9GyaGtIMiElZI= -go.opentelemetry.io/contrib/instrumentation/runtime v0.62.0/go.mod h1:F1aJ9VuiKWOlWwKdTYDUp1aoS0HzQxg38/VLxKmhm5U= -go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= -go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= -go.opentelemetry.io/otel/exporters/prometheus v0.46.0 h1:I8WIFXR351FoLJYuloU4EgXbtNX2URfU/85pUPheIEQ= -go.opentelemetry.io/otel/exporters/prometheus v0.46.0/go.mod h1:ztwVUHe5DTR/1v7PeuGRnU5Bbd4QKYwApWmuutKsJSs= -go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= -go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= -go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= -go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= -go.opentelemetry.io/otel/sdk/metric v1.37.0 h1:90lI228XrB9jCMuSdA0673aubgRobVZFhbjxHHspCPc= -go.opentelemetry.io/otel/sdk/metric v1.37.0/go.mod h1:cNen4ZWfiD37l5NhS+Keb5RXVWZWpRE+9WyVCpbo5ps= -go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= -go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= +go.opentelemetry.io/contrib/instrumentation/runtime v0.63.0 h1:PeBoRj6af6xMI7qCupwFvTbbnd49V7n5YpG6pg8iDYQ= +go.opentelemetry.io/contrib/instrumentation/runtime v0.63.0/go.mod h1:ingqBCtMCe8I4vpz/UVzCW6sxoqgZB37nao91mLQ3Bw= +go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/exporters/prometheus v0.60.0 h1:cGtQxGvZbnrWdC2GyjZi0PDKVSLWP/Jocix3QWfXtbo= +go.opentelemetry.io/otel/exporters/prometheus v0.60.0/go.mod h1:hkd1EekxNo69PTV4OWFGZcKQiIqg0RfuWExcPKFvepk= +go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= +go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= +go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= +go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= +go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI= +go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU= golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= diff --git a/contrib/metric/otelmetric/otelmetric_z_unit_http_test.go b/contrib/metric/otelmetric/otelmetric_z_unit_http_test.go index 325a9a8ab..fd65ee1fa 100644 --- a/contrib/metric/otelmetric/otelmetric_z_unit_http_test.go +++ b/contrib/metric/otelmetric/otelmetric_z_unit_http_test.go @@ -86,9 +86,9 @@ func Test_HTTP_Server(t *testing.T) { fmt.Sprintf(`server_port="%d"`, s.GetListenedPort()), expectContent, ) - //fmt.Println(metricsContent) + // fmt.Println(metricsContent) for _, line := range gstr.SplitAndTrim(expectContent, "\n") { - //fmt.Println(line) + // fmt.Println(line) t.Assert(gstr.Contains(metricsContent, line), true) } }) diff --git a/contrib/metric/otelmetric/testdata/http.prometheus.metrics.txt b/contrib/metric/otelmetric/testdata/http.prometheus.metrics.txt index 60d51c0d5..db4c828de 100644 --- a/contrib/metric/otelmetric/testdata/http.prometheus.metrics.txt +++ b/contrib/metric/otelmetric/testdata/http.prometheus.metrics.txt @@ -1,141 +1,141 @@ # HELP http_client_connection_duration Measures the connection establish duration of client requests. # TYPE http_client_connection_duration histogram -http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="1"} -http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="5"} -http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="10"} -http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="25"} -http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="50"} -http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="75"} -http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="100"} -http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="250"} -http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="500"} -http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="750"} -http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="1000"} -http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="2500"} -http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="5000"} -http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="7500"} -http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="10000"} -http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="30000"} -http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="60000"} -http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="+Inf"} -http_client_connection_duration_sum{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730"} -http_client_connection_duration_count{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730"} 9 +http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="1"} +http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="5"} +http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="10"} +http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="25"} +http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="50"} +http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="75"} +http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="100"} +http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="250"} +http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="500"} +http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="750"} +http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="1000"} +http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="2500"} +http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="5000"} +http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="7500"} +http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="10000"} +http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="30000"} +http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="60000"} +http_client_connection_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="+Inf"} +http_client_connection_duration_sum{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730"} +http_client_connection_duration_count{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730"} 9 # HELP http_client_request_active Number of active client requests. # TYPE http_client_request_active gauge -http_client_request_active{http_request_method="DELETE",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 0 -http_client_request_active{http_request_method="GET",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 1 -http_client_request_active{http_request_method="POST",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 0 -http_client_request_active{http_request_method="PUT",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 0 +http_client_request_active{http_request_method="DELETE",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 0 +http_client_request_active{http_request_method="GET",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 1 +http_client_request_active{http_request_method="POST",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 0 +http_client_request_active{http_request_method="PUT",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 0 # HELP http_client_request_body_size Outgoing request bytes total. # TYPE http_client_request_body_size counter -http_client_request_body_size{http_request_method="POST",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 7 -http_client_request_body_size{http_request_method="PUT",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 7 +http_client_request_body_size{http_request_method="POST",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 7 +http_client_request_body_size{http_request_method="PUT",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 7 # HELP http_client_request_duration Measures the duration of client requests. # TYPE http_client_request_duration histogram -http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="1"} -http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="5"} -http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="10"} -http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="25"} -http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="50"} -http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="75"} -http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="100"} -http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="250"} -http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="500"} -http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="750"} -http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="1000"} -http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="2500"} -http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="5000"} -http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="7500"} -http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="10000"} -http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="30000"} -http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="60000"} -http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="+Inf"} -http_client_request_duration_sum{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730"} -http_client_request_duration_count{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730"} 8 +http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="1"} +http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="5"} +http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="10"} +http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="25"} +http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="50"} +http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="75"} +http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="100"} +http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="250"} +http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="500"} +http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="750"} +http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="1000"} +http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="2500"} +http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="5000"} +http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="7500"} +http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="10000"} +http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="30000"} +http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="60000"} +http_client_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="+Inf"} +http_client_request_duration_sum{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730"} +http_client_request_duration_count{otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730"} 8 # HELP http_client_request_duration_total Total execution duration of request. # TYPE http_client_request_duration_total counter -http_client_request_duration_total{http_request_method="DELETE",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} -http_client_request_duration_total{http_request_method="GET",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} -http_client_request_duration_total{http_request_method="POST",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} -http_client_request_duration_total{http_request_method="PUT",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} +http_client_request_duration_total{http_request_method="DELETE",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} +http_client_request_duration_total{http_request_method="GET",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} +http_client_request_duration_total{http_request_method="POST",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} +http_client_request_duration_total{http_request_method="PUT",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} # HELP http_client_request_total Total processed request number. # TYPE http_client_request_total counter -http_client_request_total{http_request_method="DELETE",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 2 -http_client_request_total{http_request_method="GET",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 2 -http_client_request_total{http_request_method="POST",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 2 -http_client_request_total{http_request_method="PUT",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 2 +http_client_request_total{http_request_method="DELETE",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 2 +http_client_request_total{http_request_method="GET",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 2 +http_client_request_total{http_request_method="POST",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 2 +http_client_request_total{http_request_method="PUT",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/gclient.Client",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 2 # HELP http_server_request_active Number of active server requests. # TYPE http_server_request_active gauge -http_server_request_active{http_request_method="DELETE",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 0 -http_server_request_active{http_request_method="DELETE",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 0 -http_server_request_active{http_request_method="GET",http_route="/metrics",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 1 -http_server_request_active{http_request_method="GET",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 0 -http_server_request_active{http_request_method="GET",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 0 -http_server_request_active{http_request_method="POST",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 0 -http_server_request_active{http_request_method="POST",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 0 -http_server_request_active{http_request_method="PUT",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 0 -http_server_request_active{http_request_method="PUT",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 0 +http_server_request_active{http_request_method="DELETE",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 0 +http_server_request_active{http_request_method="DELETE",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 0 +http_server_request_active{http_request_method="GET",http_route="/metrics",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 1 +http_server_request_active{http_request_method="GET",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 0 +http_server_request_active{http_request_method="GET",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 0 +http_server_request_active{http_request_method="POST",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 0 +http_server_request_active{http_request_method="POST",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 0 +http_server_request_active{http_request_method="PUT",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 0 +http_server_request_active{http_request_method="PUT",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 0 # HELP http_server_request_body_size Incoming request bytes total. # TYPE http_server_request_body_size counter -http_server_request_body_size{http_request_method="DELETE",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 0 -http_server_request_body_size{http_request_method="DELETE",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 0 -http_server_request_body_size{http_request_method="GET",http_route="/metrics",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 0 -http_server_request_body_size{http_request_method="GET",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 0 -http_server_request_body_size{http_request_method="GET",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 0 -http_server_request_body_size{http_request_method="POST",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 4 -http_server_request_body_size{http_request_method="POST",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 3 -http_server_request_body_size{http_request_method="PUT",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 4 -http_server_request_body_size{http_request_method="PUT",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 3 +http_server_request_body_size{http_request_method="DELETE",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 0 +http_server_request_body_size{http_request_method="DELETE",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 0 +http_server_request_body_size{http_request_method="GET",http_route="/metrics",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 0 +http_server_request_body_size{http_request_method="GET",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 0 +http_server_request_body_size{http_request_method="GET",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 0 +http_server_request_body_size{http_request_method="POST",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 4 +http_server_request_body_size{http_request_method="POST",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 3 +http_server_request_body_size{http_request_method="PUT",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 4 +http_server_request_body_size{http_request_method="PUT",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 3 # HELP http_server_request_duration Measures the duration of inbound request. # TYPE http_server_request_duration histogram -http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="1"} -http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="5"} -http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="10"} -http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="25"} -http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="50"} -http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="75"} -http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="100"} -http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="250"} -http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="500"} -http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="750"} -http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="1000"} -http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="2500"} -http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="5000"} -http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="7500"} -http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="10000"} -http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="30000"} -http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="60000"} -http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="+Inf"} -http_server_request_duration_sum{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730"} -http_server_request_duration_count{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730"} +http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="1"} +http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="5"} +http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="10"} +http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="25"} +http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="50"} +http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="75"} +http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="100"} +http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="250"} +http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="500"} +http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="750"} +http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="1000"} +http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="2500"} +http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="5000"} +http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="7500"} +http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="10000"} +http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="30000"} +http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="60000"} +http_server_request_duration_bucket{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",le="+Inf"} +http_server_request_duration_sum{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730"} +http_server_request_duration_count{otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730"} # HELP http_server_request_duration_total Total execution duration of request. # TYPE http_server_request_duration_total counter -http_server_request_duration_total{error_code="0",http_request_method="DELETE",http_response_status_code="200",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} -http_server_request_duration_total{error_code="0",http_request_method="DELETE",http_response_status_code="200",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} -http_server_request_duration_total{error_code="0",http_request_method="GET",http_response_status_code="200",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} -http_server_request_duration_total{error_code="0",http_request_method="GET",http_response_status_code="200",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} -http_server_request_duration_total{error_code="0",http_request_method="POST",http_response_status_code="200",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} -http_server_request_duration_total{error_code="0",http_request_method="POST",http_response_status_code="200",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} -http_server_request_duration_total{error_code="0",http_request_method="PUT",http_response_status_code="200",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} -http_server_request_duration_total{error_code="0",http_request_method="PUT",http_response_status_code="200",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} +http_server_request_duration_total{error_code="0",http_request_method="DELETE",http_response_status_code="200",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} +http_server_request_duration_total{error_code="0",http_request_method="DELETE",http_response_status_code="200",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} +http_server_request_duration_total{error_code="0",http_request_method="GET",http_response_status_code="200",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} +http_server_request_duration_total{error_code="0",http_request_method="GET",http_response_status_code="200",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} +http_server_request_duration_total{error_code="0",http_request_method="POST",http_response_status_code="200",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} +http_server_request_duration_total{error_code="0",http_request_method="POST",http_response_status_code="200",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} +http_server_request_duration_total{error_code="0",http_request_method="PUT",http_response_status_code="200",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} +http_server_request_duration_total{error_code="0",http_request_method="PUT",http_response_status_code="200",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} # HELP http_server_request_total Total processed request number. # TYPE http_server_request_total counter -http_server_request_total{error_code="0",http_request_method="DELETE",http_response_status_code="200",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 1 -http_server_request_total{error_code="0",http_request_method="DELETE",http_response_status_code="200",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 1 -http_server_request_total{error_code="0",http_request_method="GET",http_response_status_code="200",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 1 -http_server_request_total{error_code="0",http_request_method="GET",http_response_status_code="200",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 1 -http_server_request_total{error_code="0",http_request_method="POST",http_response_status_code="200",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 1 -http_server_request_total{error_code="0",http_request_method="POST",http_response_status_code="200",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 1 -http_server_request_total{error_code="0",http_request_method="PUT",http_response_status_code="200",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 1 -http_server_request_total{error_code="0",http_request_method="PUT",http_response_status_code="200",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 1 +http_server_request_total{error_code="0",http_request_method="DELETE",http_response_status_code="200",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 1 +http_server_request_total{error_code="0",http_request_method="DELETE",http_response_status_code="200",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 1 +http_server_request_total{error_code="0",http_request_method="GET",http_response_status_code="200",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 1 +http_server_request_total{error_code="0",http_request_method="GET",http_response_status_code="200",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 1 +http_server_request_total{error_code="0",http_request_method="POST",http_response_status_code="200",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 1 +http_server_request_total{error_code="0",http_request_method="POST",http_response_status_code="200",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 1 +http_server_request_total{error_code="0",http_request_method="PUT",http_response_status_code="200",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 1 +http_server_request_total{error_code="0",http_request_method="PUT",http_response_status_code="200",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 1 # HELP http_server_response_body_size Response bytes total. # TYPE http_server_response_body_size counter -http_server_response_body_size{error_code="0",http_request_method="DELETE",http_response_status_code="200",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 5 -http_server_response_body_size{error_code="0",http_request_method="DELETE",http_response_status_code="200",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 4 -http_server_response_body_size{error_code="0",http_request_method="GET",http_response_status_code="200",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 5 -http_server_response_body_size{error_code="0",http_request_method="GET",http_response_status_code="200",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 4 -http_server_response_body_size{error_code="0",http_request_method="POST",http_response_status_code="200",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 5 -http_server_response_body_size{error_code="0",http_request_method="POST",http_response_status_code="200",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 4 -http_server_response_body_size{error_code="0",http_request_method="PUT",http_response_status_code="200",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 5 -http_server_response_body_size{error_code="0",http_request_method="PUT",http_response_status_code="200",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 4 +http_server_response_body_size{error_code="0",http_request_method="DELETE",http_response_status_code="200",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 5 +http_server_response_body_size{error_code="0",http_request_method="DELETE",http_response_status_code="200",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 4 +http_server_response_body_size{error_code="0",http_request_method="GET",http_response_status_code="200",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 5 +http_server_response_body_size{error_code="0",http_request_method="GET",http_response_status_code="200",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 4 +http_server_response_body_size{error_code="0",http_request_method="POST",http_response_status_code="200",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 5 +http_server_response_body_size{error_code="0",http_request_method="POST",http_response_status_code="200",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 4 +http_server_response_body_size{error_code="0",http_request_method="PUT",http_response_status_code="200",http_route="/order/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 5 +http_server_response_body_size{error_code="0",http_request_method="PUT",http_response_status_code="200",http_route="/user/:id",network_protocol_version="1.1",otel_scope_name="github.com/gogf/gf/v2/net/ghttp.Server",otel_scope_schema_url="",otel_scope_version="v2.6.4",server_address="127.0.0.1",server_port="62730",url_schema="http"} 4 diff --git a/contrib/nosql/redis/go.mod b/contrib/nosql/redis/go.mod index f45516ce9..31b15fef8 100644 --- a/contrib/nosql/redis/go.mod +++ b/contrib/nosql/redis/go.mod @@ -3,10 +3,10 @@ module github.com/gogf/gf/contrib/nosql/redis/v2 go 1.23.0 require ( - github.com/gogf/gf/v2 v2.9.3 + github.com/gogf/gf/v2 v2.9.5 github.com/redis/go-redis/v9 v9.12.1 - go.opentelemetry.io/otel v1.37.0 - go.opentelemetry.io/otel/trace v1.37.0 + go.opentelemetry.io/otel v1.38.0 + go.opentelemetry.io/otel/trace v1.38.0 ) require ( @@ -23,19 +23,19 @@ require ( github.com/gorilla/websocket v1.5.3 // indirect github.com/grokify/html-strip-tags-go v0.1.0 // indirect github.com/magiconair/properties v1.8.10 // indirect - github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/olekukonko/errors v1.1.0 // indirect github.com/olekukonko/ll v0.0.9 // indirect - github.com/olekukonko/tablewriter v1.0.9 // indirect - github.com/rivo/uniseg v0.4.7 // indirect + github.com/olekukonko/tablewriter v1.1.0 // indirect + github.com/rivo/uniseg v0.2.0 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect - go.opentelemetry.io/otel/metric v1.37.0 // indirect - go.opentelemetry.io/otel/sdk v1.37.0 // indirect - golang.org/x/net v0.43.0 // indirect + go.opentelemetry.io/otel/metric v1.38.0 // indirect + go.opentelemetry.io/otel/sdk v1.38.0 // indirect + golang.org/x/net v0.40.0 // indirect golang.org/x/sys v0.35.0 // indirect - golang.org/x/text v0.28.0 // indirect + golang.org/x/text v0.25.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/contrib/nosql/redis/go.sum b/contrib/nosql/redis/go.sum index 454242f8d..19af5056f 100644 --- a/contrib/nosql/redis/go.sum +++ b/contrib/nosql/redis/go.sum @@ -37,8 +37,9 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= -github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= @@ -47,38 +48,40 @@ github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5 github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y= github.com/olekukonko/ll v0.0.9 h1:Y+1YqDfVkqMWuEQMclsF9HUR5+a82+dxJuL1HHSRpxI= github.com/olekukonko/ll v0.0.9/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g= -github.com/olekukonko/tablewriter v1.0.9 h1:XGwRsYLC2bY7bNd93Dk51bcPZksWZmLYuaTHR0FqfL8= -github.com/olekukonko/tablewriter v1.0.9/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= +github.com/olekukonko/tablewriter v1.1.0 h1:N0LHrshF4T39KvI96fn6GT8HEjXRXYNDrDjKFDB7RIY= +github.com/olekukonko/tablewriter v1.1.0/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/redis/go-redis/v9 v9.12.1 h1:k5iquqv27aBtnTm2tIkROUDp8JBXhXZIVu1InSgvovg= github.com/redis/go-redis/v9 v9.12.1/go.mod h1:huWgSWd8mW6+m0VPhJjSSQ+d6Nh1VICQ6Q5lHuCH/Iw= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= -github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -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/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= -go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= -go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= -go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= -go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= -go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= -go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= -go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= +go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= +go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= +go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= +go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= +go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= -golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= +golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= +golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= -golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/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= diff --git a/contrib/registry/consul/go.mod b/contrib/registry/consul/go.mod index 65307cec6..6db28d2b4 100644 --- a/contrib/registry/consul/go.mod +++ b/contrib/registry/consul/go.mod @@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/registry/consul/v2 go 1.23.0 require ( - github.com/gogf/gf/v2 v2.9.3 + github.com/gogf/gf/v2 v2.9.5 github.com/hashicorp/consul/api v1.26.1 ) @@ -26,18 +26,18 @@ require ( github.com/hashicorp/golang-lru v0.5.4 // indirect github.com/hashicorp/serf v0.10.1 // indirect github.com/magiconair/properties v1.8.10 // indirect - github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect - go.opentelemetry.io/otel v1.37.0 // indirect - go.opentelemetry.io/otel/metric v1.37.0 // indirect - go.opentelemetry.io/otel/sdk v1.37.0 // indirect - go.opentelemetry.io/otel/trace v1.37.0 // indirect + go.opentelemetry.io/otel v1.38.0 // indirect + go.opentelemetry.io/otel/metric v1.38.0 // indirect + go.opentelemetry.io/otel/sdk v1.38.0 // indirect + go.opentelemetry.io/otel/trace v1.38.0 // indirect golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 // indirect golang.org/x/sys v0.35.0 // indirect - golang.org/x/text v0.28.0 // indirect + golang.org/x/text v0.25.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/contrib/registry/consul/go.sum b/contrib/registry/consul/go.sum index 7d019b92d..4f976720c 100644 --- a/contrib/registry/consul/go.sum +++ b/contrib/registry/consul/go.sum @@ -124,13 +124,14 @@ github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVc github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= -github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= -github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= @@ -154,8 +155,8 @@ github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5 github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y= github.com/olekukonko/ll v0.0.9 h1:Y+1YqDfVkqMWuEQMclsF9HUR5+a82+dxJuL1HHSRpxI= github.com/olekukonko/ll v0.0.9/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g= -github.com/olekukonko/tablewriter v1.0.9 h1:XGwRsYLC2bY7bNd93Dk51bcPZksWZmLYuaTHR0FqfL8= -github.com/olekukonko/tablewriter v1.0.9/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= +github.com/olekukonko/tablewriter v1.1.0 h1:N0LHrshF4T39KvI96fn6GT8HEjXRXYNDrDjKFDB7RIY= +github.com/olekukonko/tablewriter v1.1.0/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= @@ -179,10 +180,10 @@ github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8b github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= -github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= -github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= @@ -196,19 +197,21 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= -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/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= -go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= -go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= -go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= -go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= -go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= -go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= -go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= +go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= +go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= +go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= +go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= +go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -223,8 +226,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190923162816-aa69164e4478/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-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8= -golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= -golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= +golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= +golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -249,6 +252,7 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= @@ -257,8 +261,8 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= -golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/contrib/registry/etcd/go.mod b/contrib/registry/etcd/go.mod index c71220a79..66a585f73 100644 --- a/contrib/registry/etcd/go.mod +++ b/contrib/registry/etcd/go.mod @@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/registry/etcd/v2 go 1.23.0 require ( - github.com/gogf/gf/v2 v2.9.3 + github.com/gogf/gf/v2 v2.9.5 go.etcd.io/etcd/client/v3 v3.5.17 google.golang.org/grpc v1.59.0 ) @@ -24,30 +24,30 @@ require ( github.com/gorilla/websocket v1.5.3 // indirect github.com/grokify/html-strip-tags-go v0.1.0 // indirect github.com/magiconair/properties v1.8.10 // indirect - github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/olekukonko/errors v1.1.0 // indirect github.com/olekukonko/ll v0.0.9 // indirect - github.com/olekukonko/tablewriter v1.0.9 // indirect - github.com/rivo/uniseg v0.4.7 // indirect + github.com/olekukonko/tablewriter v1.1.0 // indirect + github.com/rivo/uniseg v0.2.0 // indirect go.etcd.io/etcd/api/v3 v3.5.17 // indirect go.etcd.io/etcd/client/pkg/v3 v3.5.17 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect - go.opentelemetry.io/otel v1.37.0 // indirect - go.opentelemetry.io/otel/metric v1.37.0 // indirect - go.opentelemetry.io/otel/sdk v1.37.0 // indirect - go.opentelemetry.io/otel/trace v1.37.0 // indirect + go.opentelemetry.io/otel v1.38.0 // indirect + go.opentelemetry.io/otel/metric v1.38.0 // indirect + go.opentelemetry.io/otel/sdk v1.38.0 // indirect + go.opentelemetry.io/otel/trace v1.38.0 // indirect go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect - go.uber.org/zap v1.21.0 // indirect - golang.org/x/net v0.43.0 // indirect + go.uber.org/zap v1.17.0 // indirect + golang.org/x/net v0.40.0 // indirect golang.org/x/sys v0.35.0 // indirect - golang.org/x/text v0.28.0 // indirect + golang.org/x/text v0.25.0 // indirect google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/protobuf v1.34.2 // indirect + google.golang.org/protobuf v1.33.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/contrib/registry/etcd/go.sum b/contrib/registry/etcd/go.sum index 5c3624741..081071f21 100644 --- a/contrib/registry/etcd/go.sum +++ b/contrib/registry/etcd/go.sum @@ -1,7 +1,5 @@ github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg= github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= -github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= -github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/clbanning/mxj/v2 v2.7.0 h1:WA/La7UGCanFe5NpHF0Q3DNtnCsVoxbPKuyBNHWRyME= github.com/clbanning/mxj/v2 v2.7.0/go.mod h1:hNiWqW14h+kc+MdF9C6/YoRfjEJoR3ou6tn/Qo+ve2s= github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= @@ -37,17 +35,15 @@ github.com/grokify/html-strip-tags-go v0.1.0 h1:03UrQLjAny8xci+R+qjCce/MYnpNXCtg github.com/grokify/html-strip-tags-go v0.1.0/go.mod h1:ZdzgfHEzAfz9X6Xe5eBLVblWIxXfYSQ40S/VKrAOGpc= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -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/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/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= -github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= @@ -56,25 +52,23 @@ github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5 github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y= github.com/olekukonko/ll v0.0.9 h1:Y+1YqDfVkqMWuEQMclsF9HUR5+a82+dxJuL1HHSRpxI= github.com/olekukonko/ll v0.0.9/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g= -github.com/olekukonko/tablewriter v1.0.9 h1:XGwRsYLC2bY7bNd93Dk51bcPZksWZmLYuaTHR0FqfL8= -github.com/olekukonko/tablewriter v1.0.9/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= +github.com/olekukonko/tablewriter v1.1.0 h1:N0LHrshF4T39KvI96fn6GT8HEjXRXYNDrDjKFDB7RIY= +github.com/olekukonko/tablewriter v1.1.0/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= -github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.7.0/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/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.etcd.io/etcd/api/v3 v3.5.17 h1:cQB8eb8bxwuxOilBpMJAEo8fAONyrdXTHUNcMd8yT1w= go.etcd.io/etcd/api/v3 v3.5.17/go.mod h1:d1hvkRuXkts6PmaYk2Vrgqbv7H4ADfAKhyJqHNLJCB4= go.etcd.io/etcd/client/pkg/v3 v3.5.17 h1:XxnDXAWq2pnxqx76ljWwiQ9jylbpC4rvkAeRVOUKKVw= @@ -83,62 +77,53 @@ go.etcd.io/etcd/client/v3 v3.5.17 h1:o48sINNeWz5+pjy/Z0+HKpj/xSnBkuVhVvXkjEXbqZY go.etcd.io/etcd/client/v3 v3.5.17/go.mod h1:j2d4eXTHWkT2ClBgnnEPm/Wuu7jsqku41v9DZ3OtjQo= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= -go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= -go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= -go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= -go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= -go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= -go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= -go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= +go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= +go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= +go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= +go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= +go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= -go.uber.org/zap v1.21.0 h1:WefMeulhovoZ2sYXz7st6K0sLj7bBhpiFaud4r4zST8= -go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw= +go.uber.org/zap v1.17.0 h1:MTjgFu6ZLKvY6Pvaqk97GlxNBuMpV4Hy/3P6tRGlI2U= +go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -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= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= -golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= +golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= +golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= 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-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 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-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= -golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -151,10 +136,9 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1: google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -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.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/contrib/registry/file/go.mod b/contrib/registry/file/go.mod index 0076c980c..7b8cc0662 100644 --- a/contrib/registry/file/go.mod +++ b/contrib/registry/file/go.mod @@ -2,7 +2,7 @@ module github.com/gogf/gf/contrib/registry/file/v2 go 1.23.0 -require github.com/gogf/gf/v2 v2.9.3 +require github.com/gogf/gf/v2 v2.9.5 require ( github.com/BurntSushi/toml v1.5.0 // indirect @@ -16,21 +16,21 @@ require ( github.com/gorilla/websocket v1.5.3 // indirect github.com/grokify/html-strip-tags-go v0.1.0 // indirect github.com/magiconair/properties v1.8.10 // indirect - github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/olekukonko/errors v1.1.0 // indirect github.com/olekukonko/ll v0.0.9 // indirect - github.com/olekukonko/tablewriter v1.0.9 // indirect - github.com/rivo/uniseg v0.4.7 // indirect + github.com/olekukonko/tablewriter v1.1.0 // indirect + github.com/rivo/uniseg v0.2.0 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect - go.opentelemetry.io/otel v1.37.0 // indirect - go.opentelemetry.io/otel/metric v1.37.0 // indirect - go.opentelemetry.io/otel/sdk v1.37.0 // indirect - go.opentelemetry.io/otel/trace v1.37.0 // indirect - golang.org/x/net v0.43.0 // indirect + go.opentelemetry.io/otel v1.38.0 // indirect + go.opentelemetry.io/otel/metric v1.38.0 // indirect + go.opentelemetry.io/otel/sdk v1.38.0 // indirect + go.opentelemetry.io/otel/trace v1.38.0 // indirect + golang.org/x/net v0.40.0 // indirect golang.org/x/sys v0.35.0 // indirect - golang.org/x/text v0.28.0 // indirect + golang.org/x/text v0.25.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/contrib/registry/file/go.sum b/contrib/registry/file/go.sum index e58d3957d..c73eb0c2e 100644 --- a/contrib/registry/file/go.sum +++ b/contrib/registry/file/go.sum @@ -29,8 +29,9 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= -github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= @@ -39,36 +40,38 @@ github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5 github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y= github.com/olekukonko/ll v0.0.9 h1:Y+1YqDfVkqMWuEQMclsF9HUR5+a82+dxJuL1HHSRpxI= github.com/olekukonko/ll v0.0.9/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g= -github.com/olekukonko/tablewriter v1.0.9 h1:XGwRsYLC2bY7bNd93Dk51bcPZksWZmLYuaTHR0FqfL8= -github.com/olekukonko/tablewriter v1.0.9/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= +github.com/olekukonko/tablewriter v1.1.0 h1:N0LHrshF4T39KvI96fn6GT8HEjXRXYNDrDjKFDB7RIY= +github.com/olekukonko/tablewriter v1.1.0/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= -github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -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/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= -go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= -go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= -go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= -go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= -go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= -go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= -go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= +go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= +go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= +go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= +go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= +go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= -golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= +golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= +golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= -golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/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= diff --git a/contrib/registry/nacos/go.mod b/contrib/registry/nacos/go.mod index b252cddfe..432716acf 100644 --- a/contrib/registry/nacos/go.mod +++ b/contrib/registry/nacos/go.mod @@ -3,22 +3,38 @@ module github.com/gogf/gf/contrib/registry/nacos/v2 go 1.23.0 require ( - github.com/gogf/gf/v2 v2.9.2 - github.com/nacos-group/nacos-sdk-go/v2 v2.2.7 + github.com/gogf/gf/v2 v2.9.5 + github.com/nacos-group/nacos-sdk-go/v2 v2.3.3 ) require ( github.com/BurntSushi/toml v1.5.0 // indirect - github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 // indirect - github.com/alibabacloud-go/tea v1.1.17 // indirect + github.com/alibabacloud-go/alibabacloud-gateway-pop v0.0.6 // indirect + github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.5 // indirect + github.com/alibabacloud-go/darabonba-array v0.1.0 // indirect + github.com/alibabacloud-go/darabonba-encode-util v0.0.2 // indirect + github.com/alibabacloud-go/darabonba-map v0.0.2 // indirect + github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.10 // indirect + github.com/alibabacloud-go/darabonba-signature-util v0.0.7 // indirect + github.com/alibabacloud-go/darabonba-string v1.0.2 // indirect + github.com/alibabacloud-go/debug v1.0.1 // indirect + github.com/alibabacloud-go/endpoint-util v1.1.0 // indirect + github.com/alibabacloud-go/kms-20160120/v3 v3.2.3 // indirect + github.com/alibabacloud-go/openapi-util v0.1.0 // indirect + github.com/alibabacloud-go/tea v1.2.2 // indirect github.com/alibabacloud-go/tea-utils v1.4.4 // indirect + github.com/alibabacloud-go/tea-utils/v2 v2.0.7 // indirect + github.com/alibabacloud-go/tea-xml v1.1.3 // indirect github.com/aliyun/alibaba-cloud-sdk-go v1.61.1800 // indirect - github.com/aliyun/alibabacloud-dkms-gcs-go-sdk v0.2.2 // indirect - github.com/aliyun/alibabacloud-dkms-transfer-go-sdk v0.1.7 // indirect + github.com/aliyun/alibabacloud-dkms-gcs-go-sdk v0.5.1 // indirect + github.com/aliyun/alibabacloud-dkms-transfer-go-sdk v0.1.8 // indirect + github.com/aliyun/aliyun-secretsmanager-client-go v1.1.5 // indirect + github.com/aliyun/credentials-go v1.4.3 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/buger/jsonparser v1.1.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/clbanning/mxj/v2 v2.7.0 // indirect + github.com/deckarep/golang-set v1.7.1 // indirect github.com/emirpasic/gods v1.18.1 // indirect github.com/fatih/color v1.18.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect @@ -32,39 +48,41 @@ require ( github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/magiconair/properties v1.8.10 // indirect - github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/olekukonko/errors v1.1.0 // indirect github.com/olekukonko/ll v0.0.9 // indirect - github.com/olekukonko/tablewriter v1.0.9 // indirect + github.com/olekukonko/tablewriter v1.1.0 // indirect + github.com/orcaman/concurrent-map v0.0.0-20210501183033-44dafcb38ecc // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect - github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect - github.com/prometheus/procfs v0.15.1 // indirect - github.com/rivo/uniseg v0.4.7 // indirect + github.com/prometheus/client_golang v1.12.2 // indirect + github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/common v0.32.1 // indirect + github.com/prometheus/procfs v0.7.3 // indirect + github.com/rivo/uniseg v0.2.0 // indirect + github.com/tjfoc/gmsm v1.4.1 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect - go.opentelemetry.io/otel v1.37.0 // indirect - go.opentelemetry.io/otel/metric v1.37.0 // indirect - go.opentelemetry.io/otel/sdk v1.37.0 // indirect - go.opentelemetry.io/otel/trace v1.37.0 // indirect + go.opentelemetry.io/otel v1.38.0 // indirect + go.opentelemetry.io/otel/metric v1.38.0 // indirect + go.opentelemetry.io/otel/sdk v1.38.0 // indirect + go.opentelemetry.io/otel/trace v1.38.0 // indirect go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect go.uber.org/zap v1.21.0 // indirect - golang.org/x/crypto v0.41.0 // indirect - golang.org/x/net v0.43.0 // indirect - golang.org/x/sync v0.16.0 // indirect + golang.org/x/crypto v0.38.0 // indirect + golang.org/x/net v0.40.0 // indirect + golang.org/x/sync v0.14.0 // indirect golang.org/x/sys v0.35.0 // indirect - golang.org/x/text v0.28.0 // indirect + golang.org/x/text v0.25.0 // indirect golang.org/x/time v0.1.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/grpc v1.59.0 // indirect - google.golang.org/protobuf v1.34.2 // indirect - gopkg.in/ini.v1 v1.66.2 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/grpc v1.67.3 // indirect + google.golang.org/protobuf v1.36.5 // indirect + gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/contrib/registry/nacos/go.sum b/contrib/registry/nacos/go.sum index 620cad6a5..6c5e5a63c 100644 --- a/contrib/registry/nacos/go.sum +++ b/contrib/registry/nacos/go.sum @@ -1,65 +1,245 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg= github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= -github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 h1:NqugFkGxx1TXSh/pBcU00Y6bljgDPaFdh5MUSeJ7e50= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/alibabacloud-go/alibabacloud-gateway-pop v0.0.6 h1:eIf+iGJxdU4U9ypaUfbtOWCsZSbTb8AUHvyPrxu6mAA= +github.com/alibabacloud-go/alibabacloud-gateway-pop v0.0.6/go.mod h1:4EUIoxs/do24zMOGGqYVWgw0s9NtiylnJglOeEB5UJo= +github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.4/go.mod h1:sCavSAvdzOjul4cEqeVtvlSaSScfNsTQ+46HwlTL1hc= +github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.5 h1:zE8vH9C7JiZLNJJQ5OwjU9mSi4T9ef9u3BURT6LCLC8= +github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.5/go.mod h1:tWnyE9AjF8J8qqLk645oUmVUnFybApTQWklQmi5tY6g= +github.com/alibabacloud-go/darabonba-array v0.1.0 h1:vR8s7b1fWAQIjEjWnuF0JiKsCvclSRTfDzZHTYqfufY= +github.com/alibabacloud-go/darabonba-array v0.1.0/go.mod h1:BLKxr0brnggqOJPqT09DFJ8g3fsDshapUD3C3aOEFaI= +github.com/alibabacloud-go/darabonba-encode-util v0.0.2 h1:1uJGrbsGEVqWcWxrS9MyC2NG0Ax+GpOM5gtupki31XE= +github.com/alibabacloud-go/darabonba-encode-util v0.0.2/go.mod h1:JiW9higWHYXm7F4PKuMgEUETNZasrDM6vqVr/Can7H8= +github.com/alibabacloud-go/darabonba-map v0.0.2 h1:qvPnGB4+dJbJIxOOfawxzF3hzMnIpjmafa0qOTp6udc= +github.com/alibabacloud-go/darabonba-map v0.0.2/go.mod h1:28AJaX8FOE/ym8OUFWga+MtEzBunJwQGceGQlvaPGPc= +github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.9/go.mod h1:bb+Io8Sn2RuM3/Rpme6ll86jMyFSrD1bxeV/+v61KeU= +github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.10 h1:GEYkMApgpKEVDn6z12DcH1EGYpDYRB8JxsazM4Rywak= +github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.10/go.mod h1:26a14FGhZVELuz2cc2AolvW4RHmIO3/HRwsdHhaIPDE= +github.com/alibabacloud-go/darabonba-signature-util v0.0.7 h1:UzCnKvsjPFzApvODDNEYqBHMFt1w98wC7FOo0InLyxg= +github.com/alibabacloud-go/darabonba-signature-util v0.0.7/go.mod h1:oUzCYV2fcCH797xKdL6BDH8ADIHlzrtKVjeRtunBNTQ= +github.com/alibabacloud-go/darabonba-string v1.0.2 h1:E714wms5ibdzCqGeYJ9JCFywE5nDyvIXIIQbZVFkkqo= +github.com/alibabacloud-go/darabonba-string v1.0.2/go.mod h1:93cTfV3vuPhhEwGGpKKqhVW4jLe7tDpo3LUM0i0g6mA= github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68/go.mod h1:6pb/Qy8c+lqua8cFpEy7g39NRRqOWc3rOwAy8m5Y2BY= +github.com/alibabacloud-go/debug v1.0.0/go.mod h1:8gfgZCCAC3+SCzjWtY053FrOcd4/qlH6IHTI4QyICOc= +github.com/alibabacloud-go/debug v1.0.1 h1:MsW9SmUtbb1Fnt3ieC6NNZi6aEwrXfDksD4QA6GSbPg= +github.com/alibabacloud-go/debug v1.0.1/go.mod h1:8gfgZCCAC3+SCzjWtY053FrOcd4/qlH6IHTI4QyICOc= +github.com/alibabacloud-go/endpoint-util v1.1.0 h1:r/4D3VSw888XGaeNpP994zDUaxdgTSHBbVfZlzf6b5Q= +github.com/alibabacloud-go/endpoint-util v1.1.0/go.mod h1:O5FuCALmCKs2Ff7JFJMudHs0I5EBgecXXxZRyswlEjE= +github.com/alibabacloud-go/kms-20160120/v3 v3.2.3 h1:vamGcYQFwXVqR6RWcrVTTqlIXZVsYjaA7pZbx+Xw6zw= +github.com/alibabacloud-go/kms-20160120/v3 v3.2.3/go.mod h1:3rIyughsFDLie1ut9gQJXkWkMg/NfXBCk+OtXnPu3lw= +github.com/alibabacloud-go/openapi-util v0.1.0 h1:0z75cIULkDrdEhkLWgi9tnLe+KhAFE/r5Pb3312/eAY= +github.com/alibabacloud-go/openapi-util v0.1.0/go.mod h1:sQuElr4ywwFRlCCberQwKRFhRzIyG4QTP/P4y1CJ6Ws= github.com/alibabacloud-go/tea v1.1.0/go.mod h1:IkGyUSX4Ba1V+k4pCtJUc6jDpZLFph9QMy2VUPTwukg= -github.com/alibabacloud-go/tea v1.1.17 h1:05R5DnaJXe9sCNIe8KUgWHC/z6w/VZIwczgUwzRnul8= +github.com/alibabacloud-go/tea v1.1.7/go.mod h1:/tmnEaQMyb4Ky1/5D+SE1BAsa5zj/KeGOFfwYm3N/p4= +github.com/alibabacloud-go/tea v1.1.8/go.mod h1:/tmnEaQMyb4Ky1/5D+SE1BAsa5zj/KeGOFfwYm3N/p4= +github.com/alibabacloud-go/tea v1.1.11/go.mod h1:/tmnEaQMyb4Ky1/5D+SE1BAsa5zj/KeGOFfwYm3N/p4= github.com/alibabacloud-go/tea v1.1.17/go.mod h1:nXxjm6CIFkBhwW4FQkNrolwbfon8Svy6cujmKFUq98A= +github.com/alibabacloud-go/tea v1.1.20/go.mod h1:nXxjm6CIFkBhwW4FQkNrolwbfon8Svy6cujmKFUq98A= +github.com/alibabacloud-go/tea v1.2.1/go.mod h1:qbzof29bM/IFhLMtJPrgTGK3eauV5J2wSyEUo4OEmnA= +github.com/alibabacloud-go/tea v1.2.2 h1:aTsR6Rl3ANWPfqeQugPglfurloyBJY85eFy7Gc1+8oU= +github.com/alibabacloud-go/tea v1.2.2/go.mod h1:CF3vOzEMAG+bR4WOql8gc2G9H3EkH3ZLAQdpmpXMgwk= +github.com/alibabacloud-go/tea-utils v1.3.1/go.mod h1:EI/o33aBfj3hETm4RLiAxF/ThQdSngxrpF8rKUDJjPE= github.com/alibabacloud-go/tea-utils v1.4.4 h1:lxCDvNCdTo9FaXKKq45+4vGETQUKNOW/qKTcX9Sk53o= github.com/alibabacloud-go/tea-utils v1.4.4/go.mod h1:KNcT0oXlZZxOXINnZBs6YvgOd5aYp9U67G+E3R8fcQw= +github.com/alibabacloud-go/tea-utils/v2 v2.0.3/go.mod h1:sj1PbjPodAVTqGTA3olprfeeqqmwD0A5OQz94o9EuXQ= +github.com/alibabacloud-go/tea-utils/v2 v2.0.5/go.mod h1:dL6vbUT35E4F4bFTHL845eUloqaerYBYPsdWR2/jhe4= +github.com/alibabacloud-go/tea-utils/v2 v2.0.6/go.mod h1:qxn986l+q33J5VkialKMqT/TTs3E+U9MJpd001iWQ9I= +github.com/alibabacloud-go/tea-utils/v2 v2.0.7 h1:WDx5qW3Xa5ZgJ1c8NfqJkF6w+AU5wB8835UdhPr6Ax0= +github.com/alibabacloud-go/tea-utils/v2 v2.0.7/go.mod h1:qxn986l+q33J5VkialKMqT/TTs3E+U9MJpd001iWQ9I= +github.com/alibabacloud-go/tea-xml v1.1.3 h1:7LYnm+JbOq2B+T/B0fHC4Ies4/FofC4zHzYtqw7dgt0= +github.com/alibabacloud-go/tea-xml v1.1.3/go.mod h1:Rq08vgCcCAjHyRi/M7xlHKUykZCEtyBy9+DPF6GgEu8= github.com/aliyun/alibaba-cloud-sdk-go v1.61.1800 h1:ie/8RxBOfKZWcrbYSJi2Z8uX8TcOlSMwPlEJh83OeOw= github.com/aliyun/alibaba-cloud-sdk-go v1.61.1800/go.mod h1:RcDobYh8k5VP6TNybz9m++gL3ijVI5wueVr0EM10VsU= -github.com/aliyun/alibabacloud-dkms-gcs-go-sdk v0.2.2 h1:rWkH6D2XlXb/Y+tNAQROxBzp3a0p92ni+pXcaHBe/WI= -github.com/aliyun/alibabacloud-dkms-gcs-go-sdk v0.2.2/go.mod h1:GDtq+Kw+v0fO+j5BrrWiUHbBq7L+hfpzpPfXKOZMFE0= -github.com/aliyun/alibabacloud-dkms-transfer-go-sdk v0.1.7 h1:olLiPI2iM8Hqq6vKnSxpM3awCrm9/BeOgHpzQkOYnI4= -github.com/aliyun/alibabacloud-dkms-transfer-go-sdk v0.1.7/go.mod h1:oDg1j4kFxnhgftaiLJABkGeSvuEvSF5Lo6UmRAMruX4= +github.com/aliyun/alibabacloud-dkms-gcs-go-sdk v0.5.1 h1:nJYyoFP+aqGKgPs9JeZgS1rWQ4NndNR0Zfhh161ZltU= +github.com/aliyun/alibabacloud-dkms-gcs-go-sdk v0.5.1/go.mod h1:WzGOmFFTlUzXM03CJnHWMQ85UN6QGpOXZocCjwkiyOg= +github.com/aliyun/alibabacloud-dkms-transfer-go-sdk v0.1.8 h1:QeUdR7JF7iNCvO/81EhxEr3wDwxk4YBoYZOq6E0AjHI= +github.com/aliyun/alibabacloud-dkms-transfer-go-sdk v0.1.8/go.mod h1:xP0KIZry6i7oGPF24vhAPr1Q8vLZRcMcxtft5xDKwCU= +github.com/aliyun/aliyun-secretsmanager-client-go v1.1.5 h1:8S0mtD101RDYa0LXwdoqgN0RxdMmmJYjq8g2mk7/lQ4= +github.com/aliyun/aliyun-secretsmanager-client-go v1.1.5/go.mod h1:M19fxYz3gpm0ETnoKweYyYtqrtnVtrpKFpwsghbw+cQ= +github.com/aliyun/credentials-go v1.1.2/go.mod h1:ozcZaMR5kLM7pwtCMEpVmQ242suV6qTJya2bDq4X1Tw= +github.com/aliyun/credentials-go v1.3.1/go.mod h1:8jKYhQuDawt8x2+fusqa1Y6mPxemTsBEN04dgcAcYz0= +github.com/aliyun/credentials-go v1.3.6/go.mod h1:1LxUuX7L5YrZUWzBrRyk0SwSdH4OmPrib8NVePL3fxM= +github.com/aliyun/credentials-go v1.3.10/go.mod h1:Jm6d+xIgwJVLVWT561vy67ZRP4lPTQxMbEYRuT2Ti1U= +github.com/aliyun/credentials-go v1.4.3 h1:N3iHyvHRMyOwY1+0qBLSf3hb5JFiOujVSVuEpgeGttY= +github.com/aliyun/credentials-go v1.4.3/go.mod h1:Jm6d+xIgwJVLVWT561vy67ZRP4lPTQxMbEYRuT2Ti1U= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs= github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/clbanning/mxj/v2 v2.5.5/go.mod h1:hNiWqW14h+kc+MdF9C6/YoRfjEJoR3ou6tn/Qo+ve2s= github.com/clbanning/mxj/v2 v2.7.0 h1:WA/La7UGCanFe5NpHF0Q3DNtnCsVoxbPKuyBNHWRyME= github.com/clbanning/mxj/v2 v2.7.0/go.mod h1:hNiWqW14h+kc+MdF9C6/YoRfjEJoR3ou6tn/Qo+ve2s= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/deckarep/golang-set v1.7.1 h1:SCQV0S6gTtp6itiFrTqI+pfmJ4LN85S1YzhDf9rTHJQ= +github.com/deckarep/golang-set v1.7.1/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/goji/httpauth v0.0.0-20160601135302-2da839ab0f4d/go.mod h1:nnjvkQ9ptGaCkuDUx6wNykzzlUixGxvkme+H/lnzb+A= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +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/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= +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= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grokify/html-strip-tags-go v0.1.0 h1:03UrQLjAny8xci+R+qjCce/MYnpNXCtgzltlQbOBae4= github.com/grokify/html-strip-tags-go v0.1.0/go.mod h1:ZdzgfHEzAfz9X6Xe5eBLVblWIxXfYSQ40S/VKrAOGpc= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= 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= @@ -69,12 +249,15 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= -github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -82,51 +265,95 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= -github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/nacos-group/nacos-sdk-go/v2 v2.2.7 h1:wCC1f3/VzIR1WD30YKeJGZAOchYCK/35mLC8qWt6Q6o= -github.com/nacos-group/nacos-sdk-go/v2 v2.2.7/go.mod h1:VYlyDPlQchPC31PmfBustu81vsOkdpCuO5k0dRdQcFc= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nacos-group/nacos-sdk-go/v2 v2.3.3 h1:lvkBZcYkKENLVR1ubO+vGxTP2L4VtVSArLvYZKuu4Pk= +github.com/nacos-group/nacos-sdk-go/v2 v2.3.3/go.mod h1:ygUBdt7eGeYBt6Lz2HO3wx7crKXk25Mp80568emGMWU= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5sM= github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y= github.com/olekukonko/ll v0.0.9 h1:Y+1YqDfVkqMWuEQMclsF9HUR5+a82+dxJuL1HHSRpxI= github.com/olekukonko/ll v0.0.9/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g= -github.com/olekukonko/tablewriter v1.0.9 h1:XGwRsYLC2bY7bNd93Dk51bcPZksWZmLYuaTHR0FqfL8= -github.com/olekukonko/tablewriter v1.0.9/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= +github.com/olekukonko/tablewriter v1.1.0 h1:N0LHrshF4T39KvI96fn6GT8HEjXRXYNDrDjKFDB7RIY= +github.com/olekukonko/tablewriter v1.1.0/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= +github.com/orcaman/concurrent-map v0.0.0-20210501183033-44dafcb38ecc h1:Ak86L+yDSOzKFa7WM5bf5itSOo1e3Xh8bm5YCMUXIjQ= +github.com/orcaman/concurrent-map v0.0.0-20210501183033-44dafcb38ecc/go.mod h1:Lu3tH6HLW3feq74c2GC+jIMS/K2CFcDWnWD9XkenwhI= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 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/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= -github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= -github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= -github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= -github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.12.2 h1:51L9cDoUHVrXx4zWYlcLQIZ+d+VXHgqnYKkIuq4g/34= +github.com/prometheus/client_golang v1.12.2/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/common v0.32.1 h1:hWIdL3N2HoUx3B8j3YN9mWor0qhY/NlEKZEaXxuIRh4= +github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= +github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= -github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/assertions v1.1.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.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/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/tjfoc/gmsm v1.3.2/go.mod h1:HaUcFuY0auTiaHB9MHFGCPx5IaLhTUd2atbCFBQXn9w= +github.com/tjfoc/gmsm v1.4.1 h1:aMe1GlZb+0bLjn+cKTPEvvn9oUEBlJitaZiiBwsbgho= +github.com/tjfoc/gmsm v1.4.1/go.mod h1:j4INPkHWMrhJb38G+J6W4Tw0AbuN8Thu3PbdVYhVcTE= +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.30/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +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= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= -go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= -go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= -go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= -go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= -go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= -go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= -go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= +go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= +go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= +go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= +go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= +go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= @@ -136,70 +363,366 @@ go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/zap v1.21.0 h1:WefMeulhovoZ2sYXz7st6K0sLj7bBhpiFaud4r4zST8= go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191219195013-becbf705a915/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4= -golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= +golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8= +golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 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= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= -golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= +golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= +golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 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-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw= -golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ= +golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200509044756-6aff5f38e54f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.9.0/go.mod h1:M6DEAAIenWoTxdKrOltXcmDY3rSplQUkrvaDU5FcQyo= +golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= +golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= +golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= +golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= -golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.1.0 h1:xYY+Bajn2a7VBmTM5GikTmnK8ZuX8YgnQCqZpbBNtmA= golang.org/x/time v0.1.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200509030707-2212a7e161a5/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= -google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= -google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.67.3 h1:OgPcDAFKHnH8X3O4WcO4XUc8GRDeKsKReqbQtiCj7N8= +google.golang.org/grpc v1.67.3/go.mod h1:YGaHCc6Oap+FzBJTZLBzkGSYt/cvGPFTPxkn7QfSU8s= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM= +google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/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/ini.v1 v1.66.2 h1:XfR1dOYubytKy4Shzc2LHrrGhU0lDCfDGG1yLPmpgsI= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/ini.v1 v1.56.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= +gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/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= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/contrib/registry/polaris/go.mod b/contrib/registry/polaris/go.mod index a89802073..e3a8714ee 100644 --- a/contrib/registry/polaris/go.mod +++ b/contrib/registry/polaris/go.mod @@ -3,60 +3,60 @@ module github.com/gogf/gf/contrib/registry/polaris/v2 go 1.23.0 require ( - github.com/gogf/gf/v2 v2.9.3 + github.com/gogf/gf/v2 v2.9.5 github.com/polarismesh/polaris-go v1.6.1 ) require ( github.com/BurntSushi/toml v1.5.0 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/clbanning/mxj/v2 v2.7.0 // indirect - github.com/dlclark/regexp2 v1.11.2 // indirect + github.com/dlclark/regexp2 v1.7.0 // indirect github.com/emirpasic/gods v1.18.1 // indirect github.com/fatih/color v1.18.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/protobuf v1.5.4 // indirect + github.com/golang/protobuf v1.5.2 // indirect github.com/google/uuid v1.6.0 // indirect github.com/gorilla/websocket v1.5.3 // indirect github.com/grokify/html-strip-tags-go v0.1.0 // indirect - github.com/hashicorp/errwrap v1.1.0 // indirect + github.com/hashicorp/errwrap v1.0.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/magiconair/properties v1.8.10 // indirect - github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/natefinch/lumberjack v2.0.0+incompatible // indirect github.com/olekukonko/errors v1.1.0 // indirect github.com/olekukonko/ll v0.0.9 // indirect - github.com/olekukonko/tablewriter v1.0.9 // indirect + github.com/olekukonko/tablewriter v1.1.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/polarismesh/specification v1.5.5-alpha.1 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect - github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect - github.com/prometheus/procfs v0.15.1 // indirect - github.com/rivo/uniseg v0.4.7 // indirect + github.com/prometheus/client_golang v1.12.2 // indirect + github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/common v0.32.1 // indirect + github.com/prometheus/procfs v0.7.3 // indirect + github.com/rivo/uniseg v0.2.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect - go.opentelemetry.io/otel v1.37.0 // indirect - go.opentelemetry.io/otel/metric v1.37.0 // indirect - go.opentelemetry.io/otel/sdk v1.37.0 // indirect - go.opentelemetry.io/otel/trace v1.37.0 // indirect + go.opentelemetry.io/otel v1.38.0 // indirect + go.opentelemetry.io/otel/metric v1.38.0 // indirect + go.opentelemetry.io/otel/sdk v1.38.0 // indirect + go.opentelemetry.io/otel/trace v1.38.0 // indirect go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect go.uber.org/zap v1.21.0 // indirect - golang.org/x/net v0.43.0 // indirect + golang.org/x/net v0.40.0 // indirect golang.org/x/sys v0.35.0 // indirect - golang.org/x/text v0.28.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/grpc v1.59.0 // indirect - google.golang.org/protobuf v1.34.2 // indirect + golang.org/x/text v0.25.0 // indirect + google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a // indirect + google.golang.org/grpc v1.51.0 // indirect + google.golang.org/protobuf v1.28.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/contrib/registry/polaris/go.sum b/contrib/registry/polaris/go.sum index 1be90b589..2eec6a1b5 100644 --- a/contrib/registry/polaris/go.sum +++ b/contrib/registry/polaris/go.sum @@ -188,9 +188,8 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= -github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= @@ -209,9 +208,8 @@ github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWH github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dlclark/regexp2 v1.7.0 h1:7lJfhqlPssTb1WQx4yvTHN0uElPEv52sbaECrAQxjAo= github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= -github.com/dlclark/regexp2 v1.11.2 h1:/u628IuisSTwri5/UKloiIsH8+qF2Pu7xEQX+yIKg68= -github.com/dlclark/regexp2 v1.11.2/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -274,9 +272,8 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= -github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/gonum/blas v0.0.0-20181208220705-f22b278b28ac/go.mod h1:P32wAyui1PQ58Oce/KYkOqQv8cVw1zAapXOl+dRFGbc= github.com/gonum/floats v0.0.0-20181209220543-c233463c7e82/go.mod h1:PxC8OnwL11+aosOB5+iEPoV3picfs8tUpkVd0pDo+Kg= @@ -344,9 +341,8 @@ github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad github.com/grokify/html-strip-tags-go v0.1.0 h1:03UrQLjAny8xci+R+qjCce/MYnpNXCtgzltlQbOBae4= github.com/grokify/html-strip-tags-go v0.1.0/go.mod h1:ZdzgfHEzAfz9X6Xe5eBLVblWIxXfYSQ40S/VKrAOGpc= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= -github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= @@ -377,12 +373,14 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= -github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= @@ -392,8 +390,6 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= -github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/natefinch/lumberjack v2.0.0+incompatible h1:4QJd3OLAMgj7ph+yZTuX13Ld4UpgHp07nNdFX7mqFfM= @@ -402,8 +398,8 @@ github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5 github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y= github.com/olekukonko/ll v0.0.9 h1:Y+1YqDfVkqMWuEQMclsF9HUR5+a82+dxJuL1HHSRpxI= github.com/olekukonko/ll v0.0.9/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g= -github.com/olekukonko/tablewriter v1.0.9 h1:XGwRsYLC2bY7bNd93Dk51bcPZksWZmLYuaTHR0FqfL8= -github.com/olekukonko/tablewriter v1.0.9/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= +github.com/olekukonko/tablewriter v1.1.0 h1:N0LHrshF4T39KvI96fn6GT8HEjXRXYNDrDjKFDB7RIY= +github.com/olekukonko/tablewriter v1.1.0/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -418,35 +414,30 @@ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.12.2 h1:51L9cDoUHVrXx4zWYlcLQIZ+d+VXHgqnYKkIuq4g/34= github.com/prometheus/client_golang v1.12.2/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= -github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/common v0.32.1 h1:hWIdL3N2HoUx3B8j3YN9mWor0qhY/NlEKZEaXxuIRh4= github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= -github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= -github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= @@ -468,8 +459,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -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/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= 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= @@ -485,14 +476,16 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= -go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= -go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= -go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= -go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= -go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= -go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= -go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= +go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= +go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= +go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= +go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= +go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= @@ -595,8 +588,8 @@ golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= -golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= +golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= +golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -704,6 +697,7 @@ golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= @@ -721,8 +715,8 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= -golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -936,9 +930,8 @@ google.golang.org/genproto v0.0.0-20220919141832-68c03719ef51/go.mod h1:0Nb8Qy+S google.golang.org/genproto v0.0.0-20220920201722-2b89144ce006/go.mod h1:ht8XFiar2npT/g4vkk7O0WYS1sHOHbdujxbEp7CJWbw= google.golang.org/genproto v0.0.0-20220926165614-551eb538f295/go.mod h1:woMGP53BroOrRY3xTxlbr8Y3eB/nzAvvFM83q7kG2OI= google.golang.org/genproto v0.0.0-20220926220553-6981cbe3cfce/go.mod h1:woMGP53BroOrRY3xTxlbr8Y3eB/nzAvvFM83q7kG2OI= +google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a h1:GH6UPn3ixhWcKDhpnEC55S75cerLPdpp3hrhfKYjZgw= google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -973,9 +966,8 @@ google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= -google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= -google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -991,9 +983,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/contrib/registry/zookeeper/go.mod b/contrib/registry/zookeeper/go.mod index 4843ad5f0..fea1bcd7c 100644 --- a/contrib/registry/zookeeper/go.mod +++ b/contrib/registry/zookeeper/go.mod @@ -4,7 +4,7 @@ go 1.23.0 require ( github.com/go-zookeeper/zk v1.0.3 - github.com/gogf/gf/v2 v2.9.3 + github.com/gogf/gf/v2 v2.9.5 golang.org/x/sync v0.16.0 ) @@ -20,21 +20,21 @@ require ( github.com/gorilla/websocket v1.5.3 // indirect github.com/grokify/html-strip-tags-go v0.1.0 // indirect github.com/magiconair/properties v1.8.10 // indirect - github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/olekukonko/errors v1.1.0 // indirect github.com/olekukonko/ll v0.0.9 // indirect - github.com/olekukonko/tablewriter v1.0.9 // indirect - github.com/rivo/uniseg v0.4.7 // indirect + github.com/olekukonko/tablewriter v1.1.0 // indirect + github.com/rivo/uniseg v0.2.0 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect - go.opentelemetry.io/otel v1.37.0 // indirect - go.opentelemetry.io/otel/metric v1.37.0 // indirect - go.opentelemetry.io/otel/sdk v1.37.0 // indirect - go.opentelemetry.io/otel/trace v1.37.0 // indirect - golang.org/x/net v0.43.0 // indirect + go.opentelemetry.io/otel v1.38.0 // indirect + go.opentelemetry.io/otel/metric v1.38.0 // indirect + go.opentelemetry.io/otel/sdk v1.38.0 // indirect + go.opentelemetry.io/otel/trace v1.38.0 // indirect + golang.org/x/net v0.40.0 // indirect golang.org/x/sys v0.35.0 // indirect - golang.org/x/text v0.28.0 // indirect + golang.org/x/text v0.25.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/contrib/registry/zookeeper/go.sum b/contrib/registry/zookeeper/go.sum index fbb09cd60..169a32626 100644 --- a/contrib/registry/zookeeper/go.sum +++ b/contrib/registry/zookeeper/go.sum @@ -31,8 +31,9 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= -github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= @@ -41,38 +42,40 @@ github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5 github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y= github.com/olekukonko/ll v0.0.9 h1:Y+1YqDfVkqMWuEQMclsF9HUR5+a82+dxJuL1HHSRpxI= github.com/olekukonko/ll v0.0.9/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g= -github.com/olekukonko/tablewriter v1.0.9 h1:XGwRsYLC2bY7bNd93Dk51bcPZksWZmLYuaTHR0FqfL8= -github.com/olekukonko/tablewriter v1.0.9/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= +github.com/olekukonko/tablewriter v1.1.0 h1:N0LHrshF4T39KvI96fn6GT8HEjXRXYNDrDjKFDB7RIY= +github.com/olekukonko/tablewriter v1.1.0/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= -github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -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/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= -go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= -go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= -go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= -go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= -go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= -go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= -go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= +go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= +go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= +go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= +go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= +go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= -golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= +golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= +golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw= golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= -golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/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= diff --git a/contrib/registry/zookeeper/zookeeper.go b/contrib/registry/zookeeper/zookeeper.go index be4b59c8c..67f78bb38 100644 --- a/contrib/registry/zookeeper/zookeeper.go +++ b/contrib/registry/zookeeper/zookeeper.go @@ -17,7 +17,7 @@ import ( "github.com/gogf/gf/v2/net/gsvc" ) -var _ gsvc.Registry = &Registry{} +var _ gsvc.Registry = (*Registry)(nil) // Content for custom service Marshal/Unmarshal. type Content struct { diff --git a/contrib/rpc/grpcx/go.mod b/contrib/rpc/grpcx/go.mod index 1385108a0..626370ce0 100644 --- a/contrib/rpc/grpcx/go.mod +++ b/contrib/rpc/grpcx/go.mod @@ -3,10 +3,10 @@ module github.com/gogf/gf/contrib/rpc/grpcx/v2 go 1.23.0 require ( - github.com/gogf/gf/contrib/registry/file/v2 v2.9.3 - github.com/gogf/gf/v2 v2.9.3 - go.opentelemetry.io/otel v1.37.0 - go.opentelemetry.io/otel/trace v1.37.0 + github.com/gogf/gf/contrib/registry/file/v2 v2.9.5 + github.com/gogf/gf/v2 v2.9.5 + go.opentelemetry.io/otel v1.38.0 + go.opentelemetry.io/otel/trace v1.38.0 google.golang.org/grpc v1.64.1 google.golang.org/protobuf v1.34.2 ) @@ -23,19 +23,19 @@ require ( github.com/gorilla/websocket v1.5.3 // indirect github.com/grokify/html-strip-tags-go v0.1.0 // indirect github.com/magiconair/properties v1.8.10 // indirect - github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/olekukonko/errors v1.1.0 // indirect github.com/olekukonko/ll v0.0.9 // indirect - github.com/olekukonko/tablewriter v1.0.9 // indirect - github.com/rivo/uniseg v0.4.7 // indirect + github.com/olekukonko/tablewriter v1.1.0 // indirect + github.com/rivo/uniseg v0.2.0 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect - go.opentelemetry.io/otel/metric v1.37.0 // indirect - go.opentelemetry.io/otel/sdk v1.37.0 // indirect - golang.org/x/net v0.43.0 // indirect + go.opentelemetry.io/otel/metric v1.38.0 // indirect + go.opentelemetry.io/otel/sdk v1.38.0 // indirect + golang.org/x/net v0.40.0 // indirect golang.org/x/sys v0.35.0 // indirect - golang.org/x/text v0.28.0 // indirect + golang.org/x/text v0.25.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/contrib/rpc/grpcx/go.sum b/contrib/rpc/grpcx/go.sum index f1925e19a..04f1d3535 100644 --- a/contrib/rpc/grpcx/go.sum +++ b/contrib/rpc/grpcx/go.sum @@ -29,8 +29,9 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= -github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= @@ -39,36 +40,38 @@ github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5 github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y= github.com/olekukonko/ll v0.0.9 h1:Y+1YqDfVkqMWuEQMclsF9HUR5+a82+dxJuL1HHSRpxI= github.com/olekukonko/ll v0.0.9/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g= -github.com/olekukonko/tablewriter v1.0.9 h1:XGwRsYLC2bY7bNd93Dk51bcPZksWZmLYuaTHR0FqfL8= -github.com/olekukonko/tablewriter v1.0.9/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= +github.com/olekukonko/tablewriter v1.1.0 h1:N0LHrshF4T39KvI96fn6GT8HEjXRXYNDrDjKFDB7RIY= +github.com/olekukonko/tablewriter v1.1.0/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= -github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -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/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= -go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= -go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= -go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= -go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= -go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= -go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= -go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= +go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= +go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= +go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= +go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= +go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= -golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= +golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= +golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= -golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 h1:NnYq6UN9ReLM9/Y01KWNOWyI5xQ9kbIms5GGJVwS/Yc= google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= google.golang.org/grpc v1.64.1 h1:LKtvyfbX3UGVPFcGqJ9ItpVWW6oN/2XqTxfAnwRRXiA= diff --git a/contrib/sdk/httpclient/go.mod b/contrib/sdk/httpclient/go.mod index e7a6a1dca..cb72173e1 100644 --- a/contrib/sdk/httpclient/go.mod +++ b/contrib/sdk/httpclient/go.mod @@ -2,7 +2,7 @@ module github.com/gogf/gf/contrib/sdk/httpclient/v2 go 1.23.0 -require github.com/gogf/gf/v2 v2.9.3 +require github.com/gogf/gf/v2 v2.9.5 require ( github.com/BurntSushi/toml v1.5.0 // indirect @@ -16,21 +16,21 @@ require ( github.com/gorilla/websocket v1.5.3 // indirect github.com/grokify/html-strip-tags-go v0.1.0 // indirect github.com/magiconair/properties v1.8.10 // indirect - github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/olekukonko/errors v1.1.0 // indirect github.com/olekukonko/ll v0.0.9 // indirect - github.com/olekukonko/tablewriter v1.0.9 // indirect - github.com/rivo/uniseg v0.4.7 // indirect + github.com/olekukonko/tablewriter v1.1.0 // indirect + github.com/rivo/uniseg v0.2.0 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect - go.opentelemetry.io/otel v1.37.0 // indirect - go.opentelemetry.io/otel/metric v1.37.0 // indirect - go.opentelemetry.io/otel/sdk v1.37.0 // indirect - go.opentelemetry.io/otel/trace v1.37.0 // indirect - golang.org/x/net v0.43.0 // indirect + go.opentelemetry.io/otel v1.38.0 // indirect + go.opentelemetry.io/otel/metric v1.38.0 // indirect + go.opentelemetry.io/otel/sdk v1.38.0 // indirect + go.opentelemetry.io/otel/trace v1.38.0 // indirect + golang.org/x/net v0.40.0 // indirect golang.org/x/sys v0.35.0 // indirect - golang.org/x/text v0.28.0 // indirect + golang.org/x/text v0.25.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/contrib/sdk/httpclient/go.sum b/contrib/sdk/httpclient/go.sum index e58d3957d..c73eb0c2e 100644 --- a/contrib/sdk/httpclient/go.sum +++ b/contrib/sdk/httpclient/go.sum @@ -29,8 +29,9 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= -github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= @@ -39,36 +40,38 @@ github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5 github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y= github.com/olekukonko/ll v0.0.9 h1:Y+1YqDfVkqMWuEQMclsF9HUR5+a82+dxJuL1HHSRpxI= github.com/olekukonko/ll v0.0.9/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g= -github.com/olekukonko/tablewriter v1.0.9 h1:XGwRsYLC2bY7bNd93Dk51bcPZksWZmLYuaTHR0FqfL8= -github.com/olekukonko/tablewriter v1.0.9/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= +github.com/olekukonko/tablewriter v1.1.0 h1:N0LHrshF4T39KvI96fn6GT8HEjXRXYNDrDjKFDB7RIY= +github.com/olekukonko/tablewriter v1.1.0/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= -github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -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/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= -go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= -go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= -go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= -go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= -go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= -go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= -go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= +go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= +go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= +go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= +go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= +go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= -golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= +golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= +golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= -golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/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= diff --git a/contrib/trace/otlpgrpc/go.mod b/contrib/trace/otlpgrpc/go.mod index b9e076b0d..e84bef7cc 100644 --- a/contrib/trace/otlpgrpc/go.mod +++ b/contrib/trace/otlpgrpc/go.mod @@ -3,17 +3,17 @@ module github.com/gogf/gf/contrib/trace/otlpgrpc/v2 go 1.23.0 require ( - github.com/gogf/gf/v2 v2.9.3 - go.opentelemetry.io/otel v1.37.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.37.0 - go.opentelemetry.io/otel/sdk v1.37.0 + github.com/gogf/gf/v2 v2.9.5 + go.opentelemetry.io/otel v1.38.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0 + go.opentelemetry.io/otel/sdk v1.38.0 google.golang.org/grpc v1.75.0 ) require ( github.com/BurntSushi/toml v1.5.0 // indirect - github.com/cenkalti/backoff/v5 v5.0.2 // indirect + github.com/cenkalti/backoff/v5 v5.0.3 // indirect github.com/clbanning/mxj/v2 v2.7.0 // indirect github.com/emirpasic/gods v1.18.1 // indirect github.com/fatih/color v1.18.0 // indirect @@ -23,24 +23,24 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/gorilla/websocket v1.5.3 // indirect github.com/grokify/html-strip-tags-go v0.1.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect github.com/magiconair/properties v1.8.10 // indirect - github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/olekukonko/errors v1.1.0 // indirect github.com/olekukonko/ll v0.0.9 // indirect - github.com/olekukonko/tablewriter v1.0.9 // indirect - github.com/rivo/uniseg v0.4.7 // indirect + github.com/olekukonko/tablewriter v1.1.0 // indirect + github.com/rivo/uniseg v0.2.0 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect - go.opentelemetry.io/otel/metric v1.37.0 // indirect - go.opentelemetry.io/otel/trace v1.37.0 // indirect + go.opentelemetry.io/otel/metric v1.38.0 // indirect + go.opentelemetry.io/otel/trace v1.38.0 // indirect go.opentelemetry.io/proto/otlp v1.7.1 // indirect golang.org/x/net v0.43.0 // indirect golang.org/x/sys v0.35.0 // indirect golang.org/x/text v0.28.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20250818200422-3122310a409c // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20250811230008-5f3141c8851a // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5 // indirect google.golang.org/protobuf v1.36.8 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/contrib/trace/otlpgrpc/go.sum b/contrib/trace/otlpgrpc/go.sum index 57edf0932..1765d0eed 100644 --- a/contrib/trace/otlpgrpc/go.sum +++ b/contrib/trace/otlpgrpc/go.sum @@ -1,7 +1,7 @@ github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg= github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= -github.com/cenkalti/backoff/v5 v5.0.2 h1:rIfFVxEf1QsI7E1ZHfp/B4DF/6QBAUhmgkxc0H7Zss8= -github.com/cenkalti/backoff/v5 v5.0.2/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= +github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM= +github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= github.com/clbanning/mxj/v2 v2.7.0 h1:WA/La7UGCanFe5NpHF0Q3DNtnCsVoxbPKuyBNHWRyME= github.com/clbanning/mxj/v2 v2.7.0/go.mod h1:hNiWqW14h+kc+MdF9C6/YoRfjEJoR3ou6tn/Qo+ve2s= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -27,16 +27,17 @@ github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aN github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grokify/html-strip-tags-go v0.1.0 h1:03UrQLjAny8xci+R+qjCce/MYnpNXCtgzltlQbOBae4= github.com/grokify/html-strip-tags-go v0.1.0/go.mod h1:ZdzgfHEzAfz9X6Xe5eBLVblWIxXfYSQ40S/VKrAOGpc= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 h1:X5VWvz21y3gzm9Nw/kaUeku/1+uBhcekkmy4IkffJww= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1/go.mod h1:Zanoh4+gvIgluNqcfMVTJueD4wSS5hT7zTt4Mrutd90= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 h1:8Tjv8EJ+pM1xP8mK6egEbD1OgnVTyacbefKhmbLhIhU= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2/go.mod h1:pkJQ2tZHJ0aFOVEEot6oZmaVEZcRme73eIFmhiVuRWs= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= -github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= @@ -45,39 +46,39 @@ github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5 github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y= github.com/olekukonko/ll v0.0.9 h1:Y+1YqDfVkqMWuEQMclsF9HUR5+a82+dxJuL1HHSRpxI= github.com/olekukonko/ll v0.0.9/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g= -github.com/olekukonko/tablewriter v1.0.9 h1:XGwRsYLC2bY7bNd93Dk51bcPZksWZmLYuaTHR0FqfL8= -github.com/olekukonko/tablewriter v1.0.9/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= +github.com/olekukonko/tablewriter v1.1.0 h1:N0LHrshF4T39KvI96fn6GT8HEjXRXYNDrDjKFDB7RIY= +github.com/olekukonko/tablewriter v1.1.0/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= -github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -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/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= -go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0 h1:Ahq7pZmv87yiyn3jeFz/LekZmPLLdKejuO3NcK9MssM= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0/go.mod h1:MJTqhM0im3mRLw1i8uGHnCvUEeS7VwRyxlLC78PA18M= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.37.0 h1:EtFWSnwW9hGObjkIdmlnWSydO+Qs8OwzfzXLUPg4xOc= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.37.0/go.mod h1:QjUEoiGCPkvFZ/MjK6ZZfNOS6mfVEVKYE99dFhuN2LI= -go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= -go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= -go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= -go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= -go.opentelemetry.io/otel/sdk/metric v1.37.0 h1:90lI228XrB9jCMuSdA0673aubgRobVZFhbjxHHspCPc= -go.opentelemetry.io/otel/sdk/metric v1.37.0/go.mod h1:cNen4ZWfiD37l5NhS+Keb5RXVWZWpRE+9WyVCpbo5ps= -go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= -go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= +go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 h1:GqRJVj7UmLjCVyVJ3ZFLdPRmhDUp2zFmQe3RHIOsw24= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0/go.mod h1:ri3aaHSmCTVYu2AWv44YMauwAQc0aqI9gHKIcSbI1pU= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0 h1:lwI4Dc5leUqENgGuQImwLo4WnuXFPetmPpkLi2IrX54= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0/go.mod h1:Kz/oCE7z5wuyhPxsXDuaPteSWqjSBD5YaSdbxZYGbGk= +go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= +go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= +go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= +go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= +go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= go.opentelemetry.io/proto/otlp v1.7.1 h1:gTOMpGDb0WTBOP8JaO72iL3auEZhVmAQg4ipjOVAtj4= go.opentelemetry.io/proto/otlp v1.7.1/go.mod h1:b2rVh6rfI/s2pHWNlB7ILJcRALpcNDzKhACevjI+ZnE= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= @@ -85,10 +86,10 @@ golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= -google.golang.org/genproto/googleapis/api v0.0.0-20250818200422-3122310a409c h1:AtEkQdl5b6zsybXcbz00j1LwNodDuH6hVifIaNqk7NQ= -google.golang.org/genproto/googleapis/api v0.0.0-20250818200422-3122310a409c/go.mod h1:ea2MjsO70ssTfCjiwHgI0ZFqcw45Ksuk2ckf9G468GA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250811230008-5f3141c8851a h1:tPE/Kp+x9dMSwUm/uM0JKK0IfdiJkwAbSMSeZBXXJXc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250811230008-5f3141c8851a/go.mod h1:gw1tLEfykwDz2ET4a12jcXt4couGAm7IwsVaTy0Sflo= +google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5 h1:BIRfGDEjiHRrk0QKZe3Xv2ieMhtgRGeLcZQ0mIVn4EY= +google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5/go.mod h1:j3QtIyytwqGr1JUDtYXwtMXWPKsEa5LtzIFN1Wn5WvE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5 h1:eaY8u2EuxbRv7c3NiGK0/NedzVsCcV6hDuU5qPX5EGE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5/go.mod h1:M4/wBTSeyLxupu3W3tJtOgB14jILAS/XWPSSa3TAlJc= google.golang.org/grpc v1.75.0 h1:+TW+dqTd2Biwe6KKfhE5JpiYIBWq865PhKGSXiivqt4= google.golang.org/grpc v1.75.0/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ= google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc= diff --git a/contrib/trace/otlphttp/go.mod b/contrib/trace/otlphttp/go.mod index c80200196..f06198df2 100644 --- a/contrib/trace/otlphttp/go.mod +++ b/contrib/trace/otlphttp/go.mod @@ -3,16 +3,16 @@ module github.com/gogf/gf/contrib/trace/otlphttp/v2 go 1.23.0 require ( - github.com/gogf/gf/v2 v2.9.3 - go.opentelemetry.io/otel v1.37.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.37.0 - go.opentelemetry.io/otel/sdk v1.37.0 + github.com/gogf/gf/v2 v2.9.5 + go.opentelemetry.io/otel v1.38.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0 + go.opentelemetry.io/otel/sdk v1.38.0 ) require ( github.com/BurntSushi/toml v1.5.0 // indirect - github.com/cenkalti/backoff/v5 v5.0.2 // indirect + github.com/cenkalti/backoff/v5 v5.0.3 // indirect github.com/clbanning/mxj/v2 v2.7.0 // indirect github.com/emirpasic/gods v1.18.1 // indirect github.com/fatih/color v1.18.0 // indirect @@ -22,25 +22,25 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/gorilla/websocket v1.5.3 // indirect github.com/grokify/html-strip-tags-go v0.1.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect github.com/magiconair/properties v1.8.10 // indirect - github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/olekukonko/errors v1.1.0 // indirect github.com/olekukonko/ll v0.0.9 // indirect - github.com/olekukonko/tablewriter v1.0.9 // indirect - github.com/rivo/uniseg v0.4.7 // indirect + github.com/olekukonko/tablewriter v1.1.0 // indirect + github.com/rivo/uniseg v0.2.0 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect - go.opentelemetry.io/otel/metric v1.37.0 // indirect - go.opentelemetry.io/otel/trace v1.37.0 // indirect + go.opentelemetry.io/otel/metric v1.38.0 // indirect + go.opentelemetry.io/otel/trace v1.38.0 // indirect go.opentelemetry.io/proto/otlp v1.7.1 // indirect golang.org/x/net v0.43.0 // indirect golang.org/x/sys v0.35.0 // indirect golang.org/x/text v0.28.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20250728155136-f173205681a0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20250728155136-f173205681a0 // indirect - google.golang.org/grpc v1.74.2 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5 // indirect + google.golang.org/grpc v1.75.0 // indirect google.golang.org/protobuf v1.36.8 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/contrib/trace/otlphttp/go.sum b/contrib/trace/otlphttp/go.sum index 7c0717f94..dc1fdc323 100644 --- a/contrib/trace/otlphttp/go.sum +++ b/contrib/trace/otlphttp/go.sum @@ -1,7 +1,7 @@ github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg= github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= -github.com/cenkalti/backoff/v5 v5.0.2 h1:rIfFVxEf1QsI7E1ZHfp/B4DF/6QBAUhmgkxc0H7Zss8= -github.com/cenkalti/backoff/v5 v5.0.2/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= +github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM= +github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= github.com/clbanning/mxj/v2 v2.7.0 h1:WA/La7UGCanFe5NpHF0Q3DNtnCsVoxbPKuyBNHWRyME= github.com/clbanning/mxj/v2 v2.7.0/go.mod h1:hNiWqW14h+kc+MdF9C6/YoRfjEJoR3ou6tn/Qo+ve2s= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -27,16 +27,17 @@ github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aN github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grokify/html-strip-tags-go v0.1.0 h1:03UrQLjAny8xci+R+qjCce/MYnpNXCtgzltlQbOBae4= github.com/grokify/html-strip-tags-go v0.1.0/go.mod h1:ZdzgfHEzAfz9X6Xe5eBLVblWIxXfYSQ40S/VKrAOGpc= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 h1:X5VWvz21y3gzm9Nw/kaUeku/1+uBhcekkmy4IkffJww= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1/go.mod h1:Zanoh4+gvIgluNqcfMVTJueD4wSS5hT7zTt4Mrutd90= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 h1:8Tjv8EJ+pM1xP8mK6egEbD1OgnVTyacbefKhmbLhIhU= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2/go.mod h1:pkJQ2tZHJ0aFOVEEot6oZmaVEZcRme73eIFmhiVuRWs= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= -github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= @@ -45,50 +46,52 @@ github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5 github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y= github.com/olekukonko/ll v0.0.9 h1:Y+1YqDfVkqMWuEQMclsF9HUR5+a82+dxJuL1HHSRpxI= github.com/olekukonko/ll v0.0.9/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g= -github.com/olekukonko/tablewriter v1.0.9 h1:XGwRsYLC2bY7bNd93Dk51bcPZksWZmLYuaTHR0FqfL8= -github.com/olekukonko/tablewriter v1.0.9/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= +github.com/olekukonko/tablewriter v1.1.0 h1:N0LHrshF4T39KvI96fn6GT8HEjXRXYNDrDjKFDB7RIY= +github.com/olekukonko/tablewriter v1.1.0/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= -github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -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/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= -go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0 h1:Ahq7pZmv87yiyn3jeFz/LekZmPLLdKejuO3NcK9MssM= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0/go.mod h1:MJTqhM0im3mRLw1i8uGHnCvUEeS7VwRyxlLC78PA18M= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.37.0 h1:bDMKF3RUSxshZ5OjOTi8rsHGaPKsAt76FaqgvIUySLc= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.37.0/go.mod h1:dDT67G/IkA46Mr2l9Uj7HsQVwsjASyV9SjGofsiUZDA= -go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= -go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= -go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= -go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= -go.opentelemetry.io/otel/sdk/metric v1.36.0 h1:r0ntwwGosWGaa0CrSt8cuNuTcccMXERFwHX4dThiPis= -go.opentelemetry.io/otel/sdk/metric v1.36.0/go.mod h1:qTNOhFDfKRwX0yXOqJYegL5WRaW376QbB7P4Pb0qva4= -go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= -go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= +go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 h1:GqRJVj7UmLjCVyVJ3ZFLdPRmhDUp2zFmQe3RHIOsw24= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0/go.mod h1:ri3aaHSmCTVYu2AWv44YMauwAQc0aqI9gHKIcSbI1pU= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0 h1:aTL7F04bJHUlztTsNGJ2l+6he8c+y/b//eR0jjjemT4= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0/go.mod h1:kldtb7jDTeol0l3ewcmd8SDvx3EmIE7lyvqbasU3QC4= +go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= +go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= +go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= +go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= +go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= go.opentelemetry.io/proto/otlp v1.7.1 h1:gTOMpGDb0WTBOP8JaO72iL3auEZhVmAQg4ipjOVAtj4= go.opentelemetry.io/proto/otlp v1.7.1/go.mod h1:b2rVh6rfI/s2pHWNlB7ILJcRALpcNDzKhACevjI+ZnE= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= -google.golang.org/genproto/googleapis/api v0.0.0-20250728155136-f173205681a0 h1:0UOBWO4dC+e51ui0NFKSPbkHHiQ4TmrEfEZMLDyRmY8= -google.golang.org/genproto/googleapis/api v0.0.0-20250728155136-f173205681a0/go.mod h1:8ytArBbtOy2xfht+y2fqKd5DRDJRUQhqbyEnQ4bDChs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250728155136-f173205681a0 h1:MAKi5q709QWfnkkpNQ0M12hYJ1+e8qYVDyowc4U1XZM= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250728155136-f173205681a0/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A= -google.golang.org/grpc v1.74.2 h1:WoosgB65DlWVC9FqI82dGsZhWFNBSLjQ84bjROOpMu4= -google.golang.org/grpc v1.74.2/go.mod h1:CtQ+BGjaAIXHs/5YS3i473GqwBBa1zGQNevxdeBEXrM= +gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= +gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= +google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5 h1:BIRfGDEjiHRrk0QKZe3Xv2ieMhtgRGeLcZQ0mIVn4EY= +google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5/go.mod h1:j3QtIyytwqGr1JUDtYXwtMXWPKsEa5LtzIFN1Wn5WvE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5 h1:eaY8u2EuxbRv7c3NiGK0/NedzVsCcV6hDuU5qPX5EGE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5/go.mod h1:M4/wBTSeyLxupu3W3tJtOgB14jILAS/XWPSSa3TAlJc= +google.golang.org/grpc v1.75.0 h1:+TW+dqTd2Biwe6KKfhE5JpiYIBWq865PhKGSXiivqt4= +google.golang.org/grpc v1.75.0/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ= google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc= google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/database/gdb/gdb.go b/database/gdb/gdb.go index d5925efd2..f4260b052 100644 --- a/database/gdb/gdb.go +++ b/database/gdb/gdb.go @@ -787,28 +787,29 @@ const ( type LocalType string const ( - LocalTypeUndefined LocalType = "" - LocalTypeString LocalType = "string" - LocalTypeTime LocalType = "time" - LocalTypeDate LocalType = "date" - LocalTypeDatetime LocalType = "datetime" - LocalTypeInt LocalType = "int" - LocalTypeUint LocalType = "uint" - LocalTypeInt64 LocalType = "int64" - LocalTypeUint64 LocalType = "uint64" - LocalTypeBigInt LocalType = "bigint" - LocalTypeIntSlice LocalType = "[]int" - LocalTypeInt64Slice LocalType = "[]int64" - LocalTypeUint64Slice LocalType = "[]uint64" - LocalTypeStringSlice LocalType = "[]string" - LocalTypeInt64Bytes LocalType = "int64-bytes" - LocalTypeUint64Bytes LocalType = "uint64-bytes" - LocalTypeFloat32 LocalType = "float32" - LocalTypeFloat64 LocalType = "float64" - LocalTypeBytes LocalType = "[]byte" - LocalTypeBool LocalType = "bool" - LocalTypeJson LocalType = "json" - LocalTypeJsonb LocalType = "jsonb" + LocalTypeUndefined LocalType = "" + LocalTypeString LocalType = "string" + LocalTypeTime LocalType = "time" + LocalTypeDate LocalType = "date" + LocalTypeDatetime LocalType = "datetime" + LocalTypeInt LocalType = "int" + LocalTypeUint LocalType = "uint" + LocalTypeInt64 LocalType = "int64" + LocalTypeUint64 LocalType = "uint64" + LocalTypeBigInt LocalType = "bigint" + LocalTypeIntSlice LocalType = "[]int" + LocalTypeInt64Slice LocalType = "[]int64" + LocalTypeUint64Slice LocalType = "[]uint64" + LocalTypeStringSlice LocalType = "[]string" + LocalTypeFloat64Slice LocalType = "[]float64" + LocalTypeInt64Bytes LocalType = "int64-bytes" + LocalTypeUint64Bytes LocalType = "uint64-bytes" + LocalTypeFloat32 LocalType = "float32" + LocalTypeFloat64 LocalType = "float64" + LocalTypeBytes LocalType = "[]byte" + LocalTypeBool LocalType = "bool" + LocalTypeJson LocalType = "json" + LocalTypeJsonb LocalType = "jsonb" ) const ( diff --git a/database/gdb/gdb_core.go b/database/gdb/gdb_core.go index c335f7f20..d34c58ed3 100644 --- a/database/gdb/gdb_core.go +++ b/database/gdb/gdb_core.go @@ -757,6 +757,30 @@ func (c *Core) GetInnerMemCache() *gcache.Cache { return c.innerMemCache } +func (c *Core) SetTableFields(ctx context.Context, table string, fields map[string]*TableField, schema ...string) error { + if table == "" { + return gerror.NewCode(gcode.CodeInvalidParameter, "table name cannot be empty") + } + charL, charR := c.db.GetChars() + table = gstr.Trim(table, charL+charR) + if gstr.Contains(table, " ") { + return gerror.NewCode( + gcode.CodeInvalidParameter, + "function TableFields supports only single table operations", + ) + } + var ( + innerMemCache = c.GetInnerMemCache() + // prefix:group@schema#table + cacheKey = genTableFieldsCacheKey( + c.db.GetGroup(), + gutil.GetOrDefaultStr(c.db.GetSchema(), schema...), + table, + ) + ) + return innerMemCache.Set(ctx, cacheKey, fields, gcache.DurationNoExpire) +} + // GetTablesWithCache retrieves and returns the table names of current database with cache. func (c *Core) GetTablesWithCache() ([]string, error) { var ( diff --git a/database/gdb/gdb_model_fields.go b/database/gdb/gdb_model_fields.go index 04ad3638e..3b9d5698e 100644 --- a/database/gdb/gdb_model_fields.go +++ b/database/gdb/gdb_model_fields.go @@ -45,8 +45,9 @@ func (m *Model) FieldsPrefix(prefixOrAlias string, fieldNamesOrMapStruct ...any) if len(fields) == 0 { return m } + prefixOrAlias = m.QuoteWord(prefixOrAlias) for i, field := range fields { - fields[i] = prefixOrAlias + "." + gconv.String(field) + fields[i] = fmt.Sprintf("%s.%s", prefixOrAlias, m.QuoteWord(gconv.String(field))) } model := m.getModel() return model.appendToFields(fields...) @@ -81,14 +82,21 @@ func (m *Model) doFieldsEx(table string, fieldNamesOrMapStruct ...any) *Model { } // FieldsExPrefix performs as function FieldsEx but add extra prefix for each field. +// Note that this function must be used together with FieldsPrefix, otherwise it will be invalid. func (m *Model) FieldsExPrefix(prefixOrAlias string, fieldNamesOrMapStruct ...any) *Model { - model := m.doFieldsEx( + fields := m.filterFieldsFrom( m.getTableNameByPrefixOrAlias(prefixOrAlias), fieldNamesOrMapStruct..., ) - for i, field := range model.fieldsEx { - model.fieldsEx[i] = prefixOrAlias + "." + gconv.String(field) + if len(fields) == 0 { + return m } + prefixOrAlias = m.QuoteWord(prefixOrAlias) + for i, field := range fields { + fields[i] = fmt.Sprintf("%s.%s", prefixOrAlias, m.QuoteWord(gconv.String(field))) + } + model := m.getModel() + model.fieldsEx = append(model.fieldsEx, fields...) return model } @@ -96,7 +104,7 @@ func (m *Model) FieldsExPrefix(prefixOrAlias string, fieldNamesOrMapStruct ...an func (m *Model) FieldCount(column string, as ...string) *Model { asStr := "" if len(as) > 0 && as[0] != "" { - asStr = fmt.Sprintf(` AS %s`, m.db.GetCore().QuoteWord(as[0])) + asStr = fmt.Sprintf(` AS %s`, m.QuoteWord(as[0])) } model := m.getModel() return model.appendToFields( @@ -108,7 +116,7 @@ func (m *Model) FieldCount(column string, as ...string) *Model { func (m *Model) FieldSum(column string, as ...string) *Model { asStr := "" if len(as) > 0 && as[0] != "" { - asStr = fmt.Sprintf(` AS %s`, m.db.GetCore().QuoteWord(as[0])) + asStr = fmt.Sprintf(` AS %s`, m.QuoteWord(as[0])) } model := m.getModel() return model.appendToFields( @@ -120,7 +128,7 @@ func (m *Model) FieldSum(column string, as ...string) *Model { func (m *Model) FieldMin(column string, as ...string) *Model { asStr := "" if len(as) > 0 && as[0] != "" { - asStr = fmt.Sprintf(` AS %s`, m.db.GetCore().QuoteWord(as[0])) + asStr = fmt.Sprintf(` AS %s`, m.QuoteWord(as[0])) } model := m.getModel() return model.appendToFields( @@ -132,7 +140,7 @@ func (m *Model) FieldMin(column string, as ...string) *Model { func (m *Model) FieldMax(column string, as ...string) *Model { asStr := "" if len(as) > 0 && as[0] != "" { - asStr = fmt.Sprintf(` AS %s`, m.db.GetCore().QuoteWord(as[0])) + asStr = fmt.Sprintf(` AS %s`, m.QuoteWord(as[0])) } model := m.getModel() return model.appendToFields( @@ -144,7 +152,7 @@ func (m *Model) FieldMax(column string, as ...string) *Model { func (m *Model) FieldAvg(column string, as ...string) *Model { asStr := "" if len(as) > 0 && as[0] != "" { - asStr = fmt.Sprintf(` AS %s`, m.db.GetCore().QuoteWord(as[0])) + asStr = fmt.Sprintf(` AS %s`, m.QuoteWord(as[0])) } model := m.getModel() return model.appendToFields( diff --git a/database/gdb/gdb_model_select.go b/database/gdb/gdb_model_select.go index 2e3f72570..96b6324ab 100644 --- a/database/gdb/gdb_model_select.go +++ b/database/gdb/gdb_model_select.go @@ -752,7 +752,7 @@ func (m *Model) getHolderAndArgsAsSubModel(ctx context.Context) (holder string, func (m *Model) getAutoPrefix() string { autoPrefix := "" if gstr.Contains(m.tables, " JOIN ") { - autoPrefix = m.db.GetCore().QuoteWord( + autoPrefix = m.QuoteWord( m.db.GetCore().guessPrimaryTableName(m.tablesInit), ) } @@ -762,7 +762,6 @@ func (m *Model) getAutoPrefix() string { func (m *Model) getFieldsAsStr() string { var ( fieldsStr string - core = m.db.GetCore() ) for _, v := range m.fields { field := gconv.String(v) @@ -773,7 +772,7 @@ func (m *Model) getFieldsAsStr() string { switch v.(type) { case Raw, *Raw: default: - field = core.QuoteString(field) + field = m.QuoteWord(field) } } if fieldsStr != "" { @@ -829,7 +828,7 @@ func (m *Model) getFieldsFiltered() string { if len(newFields) > 0 { newFields += "," } - newFields += m.db.GetCore().QuoteWord(k) + newFields += m.QuoteWord(k) } return newFields } diff --git a/encoding/gjson/gjson_api.go b/encoding/gjson/gjson_api.go index 63c75ee28..f00c9e3c8 100644 --- a/encoding/gjson/gjson_api.go +++ b/encoding/gjson/gjson_api.go @@ -142,6 +142,8 @@ func (j *Json) Contains(pattern string) bool { // The target value by `pattern` should be type of slice or map. // It returns -1 if the target value is not found, or its type is invalid. func (j *Json) Len(pattern string) int { + j.mu.RLock() + defer j.mu.RUnlock() p := j.getPointerByPattern(pattern) if p != nil { switch (*p).(type) { diff --git a/encoding/gjson/gjson_api_new_load.go b/encoding/gjson/gjson_api_new_load.go index 761584b8b..c89c72658 100644 --- a/encoding/gjson/gjson_api_new_load.go +++ b/encoding/gjson/gjson_api_new_load.go @@ -76,13 +76,23 @@ func NewWithOptions(data any, options Options) *Json { pointedData = gconv.Interfaces(data) case reflect.Map: - pointedData = gconv.MapDeep(data, options.Tags) + pointedData = gconv.Map(data, gconv.MapOption{ + Deep: true, + OmitEmpty: false, + Tags: []string{options.Tags}, + ContinueOnError: true, + }) case reflect.Struct: if v, ok := data.(iVal); ok { return NewWithOptions(v.Val(), options) } - pointedData = gconv.MapDeep(data, options.Tags) + pointedData = gconv.Map(data, gconv.MapOption{ + Deep: true, + OmitEmpty: false, + Tags: []string{options.Tags}, + ContinueOnError: true, + }) default: pointedData = data diff --git a/encoding/gjson/gjson_api_new_load_path.go b/encoding/gjson/gjson_api_new_load_path.go index 7cdab5d86..45aaa97cb 100644 --- a/encoding/gjson/gjson_api_new_load_path.go +++ b/encoding/gjson/gjson_api_new_load_path.go @@ -9,6 +9,7 @@ package gjson import "github.com/gogf/gf/v2/os/gfile" // Load loads content from specified file `path`, and creates a Json object from its content. +// // Deprecated: use LoadPath instead. func Load(path string, safe ...bool) (*Json, error) { var isSafe bool diff --git a/encoding/gyaml/gyaml.go b/encoding/gyaml/gyaml.go index 720ca569c..b5316714f 100644 --- a/encoding/gyaml/gyaml.go +++ b/encoding/gyaml/gyaml.go @@ -57,7 +57,12 @@ func Decode(content []byte) (map[string]any, error) { err = gerror.Wrap(err, `yaml.Unmarshal failed`) return nil, err } - return gconv.MapDeep(result), nil + return gconv.Map(result, + gconv.MapOption{ + Deep: true, + OmitEmpty: false, + ContinueOnError: true, + }), nil } // DecodeTo parses `content` into `result`. diff --git a/errors/gerror/gerror_api_option.go b/errors/gerror/gerror_api_option.go index 4ac7f1d93..2da7de8b6 100644 --- a/errors/gerror/gerror_api_option.go +++ b/errors/gerror/gerror_api_option.go @@ -31,6 +31,7 @@ func NewWithOption(option Option) error { } // NewOption creates and returns a custom error with Option. +// // Deprecated: use NewWithOption instead. func NewOption(option Option) error { return NewWithOption(option) diff --git a/errors/gerror/gerror_api_stack.go b/errors/gerror/gerror_api_stack.go index 5caa51172..36b7c37be 100644 --- a/errors/gerror/gerror_api_stack.go +++ b/errors/gerror/gerror_api_stack.go @@ -117,6 +117,7 @@ func As(err error, target any) bool { // HasError performs as Is. // This function is designed and implemented early before errors.Is of go stdlib. +// // Deprecated: use Is instead. func HasError(err, target error) bool { return errors.Is(err, target) diff --git a/go.mod b/go.mod index de9b455f0..2af383f24 100644 --- a/go.mod +++ b/go.mod @@ -11,12 +11,12 @@ require ( github.com/gorilla/websocket v1.5.3 github.com/grokify/html-strip-tags-go v0.1.0 github.com/magiconair/properties v1.8.10 - github.com/olekukonko/tablewriter v1.0.9 - go.opentelemetry.io/otel v1.37.0 - go.opentelemetry.io/otel/sdk v1.37.0 - go.opentelemetry.io/otel/trace v1.37.0 - golang.org/x/net v0.43.0 - golang.org/x/text v0.28.0 + github.com/olekukonko/tablewriter v1.1.0 + go.opentelemetry.io/otel v1.38.0 + go.opentelemetry.io/otel/sdk v1.38.0 + go.opentelemetry.io/otel/trace v1.38.0 + golang.org/x/net v0.40.0 + golang.org/x/text v0.25.0 gopkg.in/yaml.v3 v3.0.1 ) @@ -24,14 +24,13 @@ require ( github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/olekukonko/errors v1.1.0 // indirect github.com/olekukonko/ll v0.0.9 // indirect - github.com/rivo/uniseg v0.4.7 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect + github.com/rivo/uniseg v0.2.0 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect - go.opentelemetry.io/otel/metric v1.37.0 // indirect + go.opentelemetry.io/otel/metric v1.38.0 // indirect golang.org/x/sys v0.35.0 // indirect ) diff --git a/go.sum b/go.sum index e58d3957d..c73eb0c2e 100644 --- a/go.sum +++ b/go.sum @@ -29,8 +29,9 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= -github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= @@ -39,36 +40,38 @@ github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5 github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y= github.com/olekukonko/ll v0.0.9 h1:Y+1YqDfVkqMWuEQMclsF9HUR5+a82+dxJuL1HHSRpxI= github.com/olekukonko/ll v0.0.9/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g= -github.com/olekukonko/tablewriter v1.0.9 h1:XGwRsYLC2bY7bNd93Dk51bcPZksWZmLYuaTHR0FqfL8= -github.com/olekukonko/tablewriter v1.0.9/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= +github.com/olekukonko/tablewriter v1.1.0 h1:N0LHrshF4T39KvI96fn6GT8HEjXRXYNDrDjKFDB7RIY= +github.com/olekukonko/tablewriter v1.1.0/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= -github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -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/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= -go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= -go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= -go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= -go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= -go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= -go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= -go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= +go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= +go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= +go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= +go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= +go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= -golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= +golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= +golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= -golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/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= diff --git a/internal/errors/errors.go b/internal/errors/errors.go index b1f83aa5e..eaadd2351 100644 --- a/internal/errors/errors.go +++ b/internal/errors/errors.go @@ -16,6 +16,7 @@ type StackMode string const ( // commandEnvKeyForBrief is the command environment name for switch key for brief error stack. + // // Deprecated: use commandEnvKeyForStackMode instead. commandEnvKeyForBrief = "gf.gerror.brief" diff --git a/internal/utils/utils_str.go b/internal/utils/utils_str.go index 37cc0318c..6a8290f0d 100644 --- a/internal/utils/utils_str.go +++ b/internal/utils/utils_str.go @@ -9,6 +9,7 @@ package utils import ( "bytes" "strings" + "unicode" ) // DefaultTrimChars are the characters which are stripped by Trim* functions in default. @@ -167,3 +168,13 @@ func StripSlashes(str string) string { } return buf.String() } + +// IsASCII checks whether given string is ASCII characters. +func IsASCII(s string) bool { + for i := 0; i < len(s); i++ { + if s[i] > unicode.MaxASCII { + return false + } + } + return true +} diff --git a/internal/utils/utils_z_unit_test.go b/internal/utils/utils_z_unit_test.go index 40b228e38..f59d9081f 100644 --- a/internal/utils/utils_z_unit_test.go +++ b/internal/utils/utils_z_unit_test.go @@ -128,3 +128,13 @@ func Test_IsNumeric(t *testing.T) { t.Assert(utils.IsNumeric("+.1"), false) }) } + +func TestIsASCII(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + t.AssertEQ(utils.IsASCII("test"), true) + t.AssertEQ(utils.IsASCII("测试"), false) + t.AssertEQ(utils.IsASCII("テスト"), false) + t.AssertEQ(utils.IsASCII("테스트"), false) + t.AssertEQ(utils.IsASCII("😁😭❤️😓"), false) + }) +} diff --git a/net/gclient/gclient_request.go b/net/gclient/gclient_request.go index be63859a0..8375f30cf 100644 --- a/net/gclient/gclient_request.go +++ b/net/gclient/gclient_request.go @@ -10,6 +10,7 @@ import ( "bytes" "context" "io" + "mime" "mime/multipart" "net/http" "os" @@ -172,7 +173,12 @@ func (c *Client) prepareRequest(ctx context.Context, method, url string, data .. allowFileUploading = true ) if len(data) > 0 { - switch c.header[httpHeaderContentType] { + mediaType, _, err := mime.ParseMediaType(c.header[httpHeaderContentType]) + if err != nil { + // Fallback: use the raw header value if parsing fails. + mediaType = c.header[httpHeaderContentType] + } + switch mediaType { case httpHeaderContentTypeJson: switch data[0].(type) { case string, []byte: @@ -206,7 +212,12 @@ func (c *Client) prepareRequest(ctx context.Context, method, url string, data .. if method == http.MethodGet { var bodyBuffer *bytes.Buffer if params != "" { - switch c.header[httpHeaderContentType] { + mediaType, _, err := mime.ParseMediaType(c.header[httpHeaderContentType]) + if err != nil { + // Fallback: use the raw header value if parsing fails. + mediaType = c.header[httpHeaderContentType] + } + switch mediaType { case httpHeaderContentTypeJson, httpHeaderContentTypeXml: diff --git a/net/ghttp/ghttp_response.go b/net/ghttp/ghttp_response.go index b4e2d7ea3..12dae0cac 100644 --- a/net/ghttp/ghttp_response.go +++ b/net/ghttp/ghttp_response.go @@ -14,6 +14,7 @@ import ( "net/url" "time" + "github.com/gogf/gf/v2/internal/utils" "github.com/gogf/gf/v2/net/ghttp/internal/response" "github.com/gogf/gf/v2/net/gtrace" "github.com/gogf/gf/v2/os/gfile" @@ -89,7 +90,12 @@ func (r *Response) ServeFileDownload(path string, name ...string) { } r.Header().Set("Content-Type", "application/force-download") r.Header().Set("Accept-Ranges", "bytes") - r.Header().Set("Content-Disposition", fmt.Sprintf(`attachment;filename=%s`, url.QueryEscape(downloadName))) + if utils.IsASCII(downloadName) { + r.Header().Set("Content-Disposition", fmt.Sprintf(`attachment;filename=%s`, url.QueryEscape(downloadName))) + } else { + r.Header().Set("Content-Disposition", fmt.Sprintf(`attachment;filename*=UTF-8''%s`, url.QueryEscape(downloadName))) + } + r.Header().Set("Access-Control-Expose-Headers", "Content-Disposition") r.Server.serveFile(r.Request, serveFile) } diff --git a/net/ghttp/ghttp_response_view.go b/net/ghttp/ghttp_response_view.go index ff780f123..35346f76c 100644 --- a/net/ghttp/ghttp_response_view.go +++ b/net/ghttp/ghttp_response_view.go @@ -85,7 +85,12 @@ func (r *Response) buildInVars(params ...map[string]any) map[string]any { gutil.MapMerge(m, params[0]) } // Retrieve custom template variables from request object. - sessionMap := gconv.MapDeep(r.Request.Session.MustData()) + sessionMap := gconv.Map(r.Request.Session.MustData(), + gconv.MapOption{ + Deep: true, + OmitEmpty: false, + ContinueOnError: true, + }) gutil.MapMerge(m, map[string]any{ "Form": r.Request.GetFormMap(), "Query": r.Request.GetQueryMap(), diff --git a/net/ghttp/ghttp_z_unit_feature_middleware_basic_test.go b/net/ghttp/ghttp_z_unit_feature_middleware_basic_test.go index 67c5d2749..07c68e9b3 100644 --- a/net/ghttp/ghttp_z_unit_feature_middleware_basic_test.go +++ b/net/ghttp/ghttp_z_unit_feature_middleware_basic_test.go @@ -821,7 +821,7 @@ type testTracerProvider struct { noop.TracerProvider } -var _ trace.TracerProvider = &testTracerProvider{} +var _ trace.TracerProvider = (*testTracerProvider)(nil) func (*testTracerProvider) Tracer(_ string, _ ...trace.TracerOption) trace.Tracer { return noop.NewTracerProvider().Tracer("") diff --git a/net/ghttp/ghttp_z_unit_feature_response_test.go b/net/ghttp/ghttp_z_unit_feature_response_test.go index e97c5ba9a..35097351b 100644 --- a/net/ghttp/ghttp_z_unit_feature_response_test.go +++ b/net/ghttp/ghttp_z_unit_feature_response_test.go @@ -9,6 +9,7 @@ package ghttp_test import ( "fmt" "net/http" + "net/url" "strings" "testing" "time" @@ -81,6 +82,17 @@ func Test_Response_ServeFileDownload(t *testing.T) { client.GetContent(ctx, "/ServeFileDownload", "filePath=files/server.key"), "BEGIN RSA PRIVATE KEY"), true) + + resp, err := client.Get(ctx, "/ServeFileDownload", "filePath="+srcPath) + t.AssertNil(err) + t.Assert(resp.ReadAllString(), "file1.txt: This file is for uploading unit test case.") + t.Assert(resp.Header.Get("Content-Disposition"), "attachment;filename=file1.txt") + + srcPath = gtest.DataPath("upload", "中文.txt") + resp, err = client.Get(ctx, "/ServeFileDownload", "filePath="+srcPath) + t.AssertNil(err) + t.Assert(resp.ReadAllString(), "中文.txt: This file is for uploading unit test case.") + t.Assert(resp.Header.Get("Content-Disposition"), "attachment;filename*=UTF-8''"+url.QueryEscape("中文.txt")) }) } diff --git a/net/ghttp/testdata/upload/中文.txt b/net/ghttp/testdata/upload/中文.txt new file mode 100644 index 000000000..e4a17e8fe --- /dev/null +++ b/net/ghttp/testdata/upload/中文.txt @@ -0,0 +1 @@ +中文.txt: This file is for uploading unit test case. \ No newline at end of file diff --git a/net/gipv4/gipv4_convert.go b/net/gipv4/gipv4_convert.go index 30d2e9392..df39a2f56 100644 --- a/net/gipv4/gipv4_convert.go +++ b/net/gipv4/gipv4_convert.go @@ -47,12 +47,14 @@ func LongToIpLittleEndian(long uint32) string { } // Ip2long converts ip address to an uint32 integer. +// // Deprecated: Use IpToLongBigEndian instead. func Ip2long(ip string) uint32 { return IpToLongBigEndian(ip) } // Long2ip converts an uint32 integer ip address to its string type address. +// // Deprecated: Use LongToIpBigEndian instead. func Long2ip(long uint32) string { return LongToIpBigEndian(long) diff --git a/net/goai/goai.go b/net/goai/goai.go index 51f8f53f4..2705c48d4 100644 --- a/net/goai/goai.go +++ b/net/goai/goai.go @@ -207,6 +207,7 @@ func (oai *OpenApiV3) golangTypeToSchemaName(t reflect.Type) string { for t.Kind() == reflect.Pointer { t = t.Elem() } + schemaName = gstr.Replace(schemaName, `/`, `.`) if pkgPath = t.PkgPath(); pkgPath != "" && pkgPath != "." { if !oai.Config.IgnorePkgPath { schemaName = gstr.Replace(pkgPath, `/`, `.`) + gstr.SubStrFrom(schemaName, ".") @@ -216,6 +217,8 @@ func (oai *OpenApiV3) golangTypeToSchemaName(t reflect.Type) string { ` `: ``, `{`: ``, `}`: ``, + `[`: `.`, + `]`: `.`, }) return schemaName } diff --git a/net/goai/goai_z_unit_generic_type_test.go b/net/goai/goai_z_unit_generic_type_test.go new file mode 100644 index 000000000..5371da9a7 --- /dev/null +++ b/net/goai/goai_z_unit_generic_type_test.go @@ -0,0 +1,244 @@ +// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://github.com/gogf/gf. + +package goai_test + +import ( + "context" + "strings" + "testing" + + "github.com/gogf/gf/v2/net/goai" + "github.com/gogf/gf/v2/test/gtest" + "github.com/gogf/gf/v2/util/gmeta" +) + +// TestOpenApiV3_GenericType tests the schema name generation for generic types +// This test validates the PR fix for swagger $ref replace that handles Go generics +// Specifically testing that [ and ] characters in type names are replaced with dots +func TestOpenApiV3_GenericType(t *testing.T) { + // Define a generic type wrapper + type GenericItem[T any] struct { + Value T `dc:"Generic value"` + } + + type StringItem = GenericItem[string] + + type IntItem = GenericItem[int] + + type Req struct { + gmeta.Meta `path:"/generic" method:"POST" tags:"default"` + StringData StringItem `dc:"String generic type"` + IntData IntItem `dc:"Int generic type"` + } + + type Res struct { + gmeta.Meta `description:"Generic Response"` + Data string `dc:"Response data"` + } + + f := func(ctx context.Context, req *Req) (res *Res, err error) { + return + } + + gtest.C(t, func(t *gtest.T) { + var ( + err error + oai = goai.New() + ) + err = oai.Add(goai.AddInput{ + Path: "/generic", + Object: f, + }) + t.AssertNil(err) + + // Verify that schema names are properly generated without special characters + schemas := oai.Components.Schemas.Map() + t.AssertGT(len(schemas), 0) + + // Check that bracket characters [ and ] have been replaced with dots + // According to PR fix: `[`: `.`, `]`: `.` + for schemaName := range schemas { + // Should not contain [ or ] characters after replacement + t.Assert(!strings.Contains(schemaName, "["), true) + t.Assert(!strings.Contains(schemaName, "]"), true) + } + }) +} + +// TestOpenApiV3_SchemaNameReplacement tests the special character replacement in schema names +// This verifies the core PR change which replaces: +// - [ with . +// - ] with . +// - { with empty string +// - } with empty string +// - spaces with empty string +func TestOpenApiV3_SchemaNameReplacement(t *testing.T) { + type SimpleReq struct { + gmeta.Meta `path:"/test" method:"POST"` + Name string `dc:"Name field"` + } + + type SimpleRes struct { + gmeta.Meta `description:"Simple Response"` + Status string `dc:"Status field"` + } + + f := func(ctx context.Context, req *SimpleReq) (res *SimpleRes, err error) { + return + } + + gtest.C(t, func(t *gtest.T) { + var ( + err error + oai = goai.New() + ) + err = oai.Add(goai.AddInput{ + Path: "/test", + Object: f, + }) + t.AssertNil(err) + + // Get schema names and verify they are properly formatted + schemas := oai.Components.Schemas.Map() + for schemaName := range schemas { + // Verify special characters have been replaced: + // - [ should be replaced with . + // - ] should be replaced with . + // - { should be replaced with empty + // - } should be replaced with empty + // - spaces should be replaced with empty + t.Assert(!strings.Contains(schemaName, "["), true) + t.Assert(!strings.Contains(schemaName, "]"), true) + t.Assert(!strings.Contains(schemaName, "{"), true) + t.Assert(!strings.Contains(schemaName, "}"), true) + } + }) +} + +// TestOpenApiV3_ComplexGenericType tests more complex generic types +// This specifically tests handling of map types and nested generic structures +func TestOpenApiV3_ComplexGenericType(t *testing.T) { + type MapWrapper struct { + gmeta.Meta `path:"/mapwrapper" method:"POST"` + Data map[string]string `dc:"Map data"` + } + + type Res struct { + gmeta.Meta `description:"Map Response"` + Result string `dc:"Result"` + } + + f := func(ctx context.Context, req *MapWrapper) (res *Res, err error) { + return + } + + gtest.C(t, func(t *gtest.T) { + var ( + err error + oai = goai.New() + ) + err = oai.Add(goai.AddInput{ + Path: "/mapwrapper", + Object: f, + }) + t.AssertNil(err) + + // Verify schema generation completes without errors + schemas := oai.Components.Schemas.Map() + t.AssertGT(len(schemas), 0) + + // All schema names should be valid (no bracket characters) + for schemaName := range schemas { + t.Assert(!strings.Contains(schemaName, "["), true) + t.Assert(!strings.Contains(schemaName, "]"), true) + } + }) +} + +// TestOpenApiV3_PathWithSpecialChars tests path parameters with special handling +// This ensures the PR changes don't affect regular parameter handling +func TestOpenApiV3_PathWithSpecialChars(t *testing.T) { + type GetDetailReq struct { + gmeta.Meta `path:"/detail" method:"GET"` + ResourceId string `json:"resourceId" in:"query" dc:"Resource identifier"` + Type string `json:"type" in:"query" dc:"Resource type"` + } + + type DetailRes struct { + gmeta.Meta `description:"Detail Response"` + Content string `dc:"Detail content"` + } + + f := func(ctx context.Context, req *GetDetailReq) (res *DetailRes, err error) { + return + } + + gtest.C(t, func(t *gtest.T) { + var ( + err error + oai = goai.New() + ) + err = oai.Add(goai.AddInput{ + Path: "/detail", + Object: f, + }) + t.AssertNil(err) + + // Verify all schemas are properly named + schemas := oai.Components.Schemas.Map() + for schemaName := range schemas { + // Should not contain special characters that were supposed to be replaced + t.Assert(!strings.Contains(schemaName, "["), true) + t.Assert(!strings.Contains(schemaName, "]"), true) + } + }) +} + +// TestOpenApiV3_SliceOfGenericTypes tests slice of generic types +// This validates that slices containing generics are properly handled +func TestOpenApiV3_SliceOfGenericTypes(t *testing.T) { + type Item[T any] struct { + Value T `dc:"Item value"` + } + + type StringItem = Item[string] + + type SliceReq struct { + gmeta.Meta `path:"/slice" method:"POST"` + Items []StringItem `dc:"Slice of generic items"` + } + + type SliceRes struct { + gmeta.Meta `description:"Slice Response"` + Count int `dc:"Item count"` + } + + f := func(ctx context.Context, req *SliceReq) (res *SliceRes, err error) { + return + } + + gtest.C(t, func(t *gtest.T) { + var ( + err error + oai = goai.New() + ) + err = oai.Add(goai.AddInput{ + Path: "/slice", + Object: f, + }) + t.AssertNil(err) + + schemas := oai.Components.Schemas.Map() + t.AssertGT(len(schemas), 0) + + // Verify no bracket characters in schema names + for schemaName := range schemas { + t.Assert(!strings.Contains(schemaName, "["), true) + t.Assert(!strings.Contains(schemaName, "]"), true) + } + }) +} diff --git a/net/gudp/gudp_func.go b/net/gudp/gudp_func.go index 32e4e8a05..b289dd7bb 100644 --- a/net/gudp/gudp_func.go +++ b/net/gudp/gudp_func.go @@ -72,6 +72,7 @@ func SendRecv(address string, data []byte, receive int, retry ...Retry) ([]byte, } // MustGetFreePort performs as GetFreePort, but it panics if any error occurs. +// // Deprecated: the port might be used soon after they were returned, please use `:0` as the listening // address which asks system to assign a free port instead. func MustGetFreePort() (port int) { @@ -83,6 +84,7 @@ func MustGetFreePort() (port int) { } // GetFreePort retrieves and returns a port that is free. +// // Deprecated: the port might be used soon after they were returned, please use `:0` as the listening // address which asks system to assign a free port instead. func GetFreePort() (port int, err error) { @@ -112,6 +114,7 @@ func GetFreePort() (port int, err error) { } // GetFreePorts retrieves and returns specified number of ports that are free. +// // Deprecated: the ports might be used soon after they were returned, please use `:0` as the listening // address which asks system to assign a free port instead. func GetFreePorts(count int) (ports []int, err error) { diff --git a/os/gcache/gcache.go b/os/gcache/gcache.go index 51a4b411e..9412838a8 100644 --- a/os/gcache/gcache.go +++ b/os/gcache/gcache.go @@ -11,6 +11,7 @@ package gcache import ( "context" + "sync" "time" "github.com/gogf/gf/v2/container/gvar" @@ -22,15 +23,17 @@ type Func = func(ctx context.Context) (value any, err error) // DurationNoExpire represents the cache key-value pair that never expires. const DurationNoExpire = time.Duration(0) -// Default cache object. -var defaultCache = New() +// defaultCache returns the lazily-initialized default cache instance using sync.OnceValue. +var defaultCache = sync.OnceValue(func() *Cache { + return New() +}) // Set sets cache with `key`-`value` pair, which is expired after `duration`. // // It does not expire if `duration` == 0. // It deletes the keys of `data` if `duration` < 0 or given `value` is nil. func Set(ctx context.Context, key any, value any, duration time.Duration) error { - return defaultCache.Set(ctx, key, value, duration) + return defaultCache().Set(ctx, key, value, duration) } // SetMap batch sets cache with key-value pairs by `data` map, which is expired after `duration`. @@ -38,7 +41,7 @@ func Set(ctx context.Context, key any, value any, duration time.Duration) error // It does not expire if `duration` == 0. // It deletes the keys of `data` if `duration` < 0 or given `value` is nil. func SetMap(ctx context.Context, data map[any]any, duration time.Duration) error { - return defaultCache.SetMap(ctx, data, duration) + return defaultCache().SetMap(ctx, data, duration) } // SetIfNotExist sets cache with `key`-`value` pair which is expired after `duration` @@ -48,7 +51,7 @@ func SetMap(ctx context.Context, data map[any]any, duration time.Duration) error // It does not expire if `duration` == 0. // It deletes the `key` if `duration` < 0 or given `value` is nil. func SetIfNotExist(ctx context.Context, key any, value any, duration time.Duration) (bool, error) { - return defaultCache.SetIfNotExist(ctx, key, value, duration) + return defaultCache().SetIfNotExist(ctx, key, value, duration) } // SetIfNotExistFunc sets `key` with result of function `f` and returns true @@ -60,7 +63,7 @@ func SetIfNotExist(ctx context.Context, key any, value any, duration time.Durati // It does not expire if `duration` == 0. // It deletes the `key` if `duration` < 0 or given `value` is nil. func SetIfNotExistFunc(ctx context.Context, key any, f Func, duration time.Duration) (bool, error) { - return defaultCache.SetIfNotExistFunc(ctx, key, f, duration) + return defaultCache().SetIfNotExistFunc(ctx, key, f, duration) } // SetIfNotExistFuncLock sets `key` with result of function `f` and returns true @@ -72,14 +75,14 @@ func SetIfNotExistFunc(ctx context.Context, key any, f Func, duration time.Durat // Note that it differs from function `SetIfNotExistFunc` is that the function `f` is executed within // writing mutex lock for concurrent safety purpose. func SetIfNotExistFuncLock(ctx context.Context, key any, f Func, duration time.Duration) (bool, error) { - return defaultCache.SetIfNotExistFuncLock(ctx, key, f, duration) + return defaultCache().SetIfNotExistFuncLock(ctx, key, f, duration) } // Get retrieves and returns the associated value of given `key`. // It returns nil if it does not exist, or its value is nil, or it's expired. // If you would like to check if the `key` exists in the cache, it's better using function Contains. func Get(ctx context.Context, key any) (*gvar.Var, error) { - return defaultCache.Get(ctx, key) + return defaultCache().Get(ctx, key) } // GetOrSet retrieves and returns the value of `key`, or sets `key`-`value` pair and @@ -90,7 +93,7 @@ func Get(ctx context.Context, key any) (*gvar.Var, error) { // It deletes the `key` if `duration` < 0 or given `value` is nil, but it does nothing // if `value` is a function and the function result is nil. func GetOrSet(ctx context.Context, key any, value any, duration time.Duration) (*gvar.Var, error) { - return defaultCache.GetOrSet(ctx, key, value, duration) + return defaultCache().GetOrSet(ctx, key, value, duration) } // GetOrSetFunc retrieves and returns the value of `key`, or sets `key` with result of @@ -101,7 +104,7 @@ func GetOrSet(ctx context.Context, key any, value any, duration time.Duration) ( // It deletes the `key` if `duration` < 0 or given `value` is nil, but it does nothing // if `value` is a function and the function result is nil. func GetOrSetFunc(ctx context.Context, key any, f Func, duration time.Duration) (*gvar.Var, error) { - return defaultCache.GetOrSetFunc(ctx, key, f, duration) + return defaultCache().GetOrSetFunc(ctx, key, f, duration) } // GetOrSetFuncLock retrieves and returns the value of `key`, or sets `key` with result of @@ -115,12 +118,12 @@ func GetOrSetFunc(ctx context.Context, key any, f Func, duration time.Duration) // Note that it differs from function `GetOrSetFunc` is that the function `f` is executed within // writing mutex lock for concurrent safety purpose. func GetOrSetFuncLock(ctx context.Context, key any, f Func, duration time.Duration) (*gvar.Var, error) { - return defaultCache.GetOrSetFuncLock(ctx, key, f, duration) + return defaultCache().GetOrSetFuncLock(ctx, key, f, duration) } // Contains checks and returns true if `key` exists in the cache, or else returns false. func Contains(ctx context.Context, key any) (bool, error) { - return defaultCache.Contains(ctx, key) + return defaultCache().Contains(ctx, key) } // GetExpire retrieves and returns the expiration of `key` in the cache. @@ -129,18 +132,18 @@ func Contains(ctx context.Context, key any) (bool, error) { // It returns 0 if the `key` does not expire. // It returns -1 if the `key` does not exist in the cache. func GetExpire(ctx context.Context, key any) (time.Duration, error) { - return defaultCache.GetExpire(ctx, key) + return defaultCache().GetExpire(ctx, key) } // Remove deletes one or more keys from cache, and returns its value. // If multiple keys are given, it returns the value of the last deleted item. func Remove(ctx context.Context, keys ...any) (value *gvar.Var, err error) { - return defaultCache.Remove(ctx, keys...) + return defaultCache().Remove(ctx, keys...) } // Removes deletes `keys` in the cache. func Removes(ctx context.Context, keys []any) error { - return defaultCache.Removes(ctx, keys) + return defaultCache().Removes(ctx, keys) } // Update updates the value of `key` without changing its expiration and returns the old value. @@ -149,7 +152,7 @@ func Removes(ctx context.Context, keys []any) error { // It deletes the `key` if given `value` is nil. // It does nothing if `key` does not exist in the cache. func Update(ctx context.Context, key any, value any) (oldValue *gvar.Var, exist bool, err error) { - return defaultCache.Update(ctx, key, value) + return defaultCache().Update(ctx, key, value) } // UpdateExpire updates the expiration of `key` and returns the old expiration duration value. @@ -157,87 +160,87 @@ func Update(ctx context.Context, key any, value any) (oldValue *gvar.Var, exist // It returns -1 and does nothing if the `key` does not exist in the cache. // It deletes the `key` if `duration` < 0. func UpdateExpire(ctx context.Context, key any, duration time.Duration) (oldDuration time.Duration, err error) { - return defaultCache.UpdateExpire(ctx, key, duration) + return defaultCache().UpdateExpire(ctx, key, duration) } // Size returns the number of items in the cache. func Size(ctx context.Context) (int, error) { - return defaultCache.Size(ctx) + return defaultCache().Size(ctx) } // Data returns a copy of all key-value pairs in the cache as map type. // Note that this function may lead lots of memory usage, you can implement this function // if necessary. func Data(ctx context.Context) (map[any]any, error) { - return defaultCache.Data(ctx) + return defaultCache().Data(ctx) } // Keys returns all keys in the cache as slice. func Keys(ctx context.Context) ([]any, error) { - return defaultCache.Keys(ctx) + return defaultCache().Keys(ctx) } // KeyStrings returns all keys in the cache as string slice. func KeyStrings(ctx context.Context) ([]string, error) { - return defaultCache.KeyStrings(ctx) + return defaultCache().KeyStrings(ctx) } // Values returns all values in the cache as slice. func Values(ctx context.Context) ([]any, error) { - return defaultCache.Values(ctx) + return defaultCache().Values(ctx) } // MustGet acts like Get, but it panics if any error occurs. func MustGet(ctx context.Context, key any) *gvar.Var { - return defaultCache.MustGet(ctx, key) + return defaultCache().MustGet(ctx, key) } // MustGetOrSet acts like GetOrSet, but it panics if any error occurs. func MustGetOrSet(ctx context.Context, key any, value any, duration time.Duration) *gvar.Var { - return defaultCache.MustGetOrSet(ctx, key, value, duration) + return defaultCache().MustGetOrSet(ctx, key, value, duration) } // MustGetOrSetFunc acts like GetOrSetFunc, but it panics if any error occurs. func MustGetOrSetFunc(ctx context.Context, key any, f Func, duration time.Duration) *gvar.Var { - return defaultCache.MustGetOrSetFunc(ctx, key, f, duration) + return defaultCache().MustGetOrSetFunc(ctx, key, f, duration) } // MustGetOrSetFuncLock acts like GetOrSetFuncLock, but it panics if any error occurs. func MustGetOrSetFuncLock(ctx context.Context, key any, f Func, duration time.Duration) *gvar.Var { - return defaultCache.MustGetOrSetFuncLock(ctx, key, f, duration) + return defaultCache().MustGetOrSetFuncLock(ctx, key, f, duration) } // MustContains acts like Contains, but it panics if any error occurs. func MustContains(ctx context.Context, key any) bool { - return defaultCache.MustContains(ctx, key) + return defaultCache().MustContains(ctx, key) } // MustGetExpire acts like GetExpire, but it panics if any error occurs. func MustGetExpire(ctx context.Context, key any) time.Duration { - return defaultCache.MustGetExpire(ctx, key) + return defaultCache().MustGetExpire(ctx, key) } // MustSize acts like Size, but it panics if any error occurs. func MustSize(ctx context.Context) int { - return defaultCache.MustSize(ctx) + return defaultCache().MustSize(ctx) } // MustData acts like Data, but it panics if any error occurs. func MustData(ctx context.Context) map[any]any { - return defaultCache.MustData(ctx) + return defaultCache().MustData(ctx) } // MustKeys acts like Keys, but it panics if any error occurs. func MustKeys(ctx context.Context) []any { - return defaultCache.MustKeys(ctx) + return defaultCache().MustKeys(ctx) } // MustKeyStrings acts like KeyStrings, but it panics if any error occurs. func MustKeyStrings(ctx context.Context) []string { - return defaultCache.MustKeyStrings(ctx) + return defaultCache().MustKeyStrings(ctx) } // MustValues acts like Values, but it panics if any error occurs. func MustValues(ctx context.Context) []any { - return defaultCache.MustValues(ctx) + return defaultCache().MustValues(ctx) } diff --git a/os/gcache/gcache_adapter_memory.go b/os/gcache/gcache_adapter_memory.go index a205c5220..49daf7290 100644 --- a/os/gcache/gcache_adapter_memory.go +++ b/os/gcache/gcache_adapter_memory.go @@ -29,6 +29,8 @@ type AdapterMemory struct { closed *gtype.Bool // closed controls the cache closed or not. } +var _ Adapter = (*AdapterMemory)(nil) + // Internal event item. type adapterMemoryEvent struct { k any // Key. diff --git a/os/gcache/gcache_adapter_redis.go b/os/gcache/gcache_adapter_redis.go index e0b876912..0669c5072 100644 --- a/os/gcache/gcache_adapter_redis.go +++ b/os/gcache/gcache_adapter_redis.go @@ -20,7 +20,9 @@ type AdapterRedis struct { redis *gredis.Redis } -// NewAdapterRedis creates and returns a new memory cache object. +var _ Adapter = (*AdapterRedis)(nil) + +// NewAdapterRedis creates and returns a new Redis cache adapter. func NewAdapterRedis(redis *gredis.Redis) *AdapterRedis { return &AdapterRedis{ redis: redis, diff --git a/os/gcache/gcache_z_bench_test.go b/os/gcache/gcache_z_bench_test.go index 3ab6b9b4f..00f6e68af 100644 --- a/os/gcache/gcache_z_bench_test.go +++ b/os/gcache/gcache_z_bench_test.go @@ -10,7 +10,9 @@ package gcache_test import ( "context" + "sync" "testing" + "time" "github.com/gogf/gf/v2/os/gcache" ) @@ -79,3 +81,65 @@ func Benchmark_CacheLruRemove(b *testing.B) { } }) } + +var oldDefaultCache = gcache.New() +var newDefaultCache = sync.OnceValue(func() *gcache.Cache { + return gcache.New() +}) + +func BenchmarkOldImplementation(b *testing.B) { + ctx := context.Background() + b.ResetTimer() + for i := 0; i < b.N; i++ { + _ = oldDefaultCache.Set(ctx, "key", "value", time.Minute) + } +} + +func BenchmarkNewImplementation(b *testing.B) { + ctx := context.Background() + newDefaultCache() + b.ResetTimer() + for i := 0; i < b.N; i++ { + _ = newDefaultCache().Set(ctx, "key", "value", time.Minute) + } +} + +func BenchmarkOldGet(b *testing.B) { + ctx := context.Background() + oldDefaultCache.Set(ctx, "test_key", "test_value", time.Minute) + + b.ResetTimer() + for i := 0; i < b.N; i++ { + _, _ = oldDefaultCache.Get(ctx, "test_key") + } +} + +func BenchmarkNewGet(b *testing.B) { + ctx := context.Background() + newDefaultCache().Set(ctx, "test_key", "test_value", time.Minute) + + b.ResetTimer() + for i := 0; i < b.N; i++ { + _, _ = newDefaultCache().Get(ctx, "test_key") + } +} + +func BenchmarkOldConcurrent(b *testing.B) { + ctx := context.Background() + + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + _ = oldDefaultCache.Set(ctx, "key", "value", time.Minute) + } + }) +} + +func BenchmarkNewConcurrent(b *testing.B) { + ctx := context.Background() + + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + _ = newDefaultCache().Set(ctx, "key", "value", time.Minute) + } + }) +} diff --git a/os/gcache/gcache_z_unit_test.go b/os/gcache/gcache_z_unit_test.go index 55a3e48c5..24d14cbdc 100644 --- a/os/gcache/gcache_z_unit_test.go +++ b/os/gcache/gcache_z_unit_test.go @@ -453,11 +453,7 @@ func TestCache_SetConcurrency(t *testing.T) { }) } }() - select { - case <-time.After(2 * time.Second): - // t.Log("first part end") - } - + time.Sleep(2 * time.Second) go func() { for { pool.Add(ctx, func(ctx context.Context) { @@ -465,10 +461,7 @@ func TestCache_SetConcurrency(t *testing.T) { }) } }() - select { - case <-time.After(2 * time.Second): - // t.Log("second part end") - } + time.Sleep(2 * time.Second) }) } diff --git a/os/gcfg/gcfg_adaper.go b/os/gcfg/gcfg_adaper.go index a73afc7a0..df68e2013 100644 --- a/os/gcfg/gcfg_adaper.go +++ b/os/gcfg/gcfg_adaper.go @@ -28,3 +28,13 @@ type Adapter interface { // you can implement this function if necessary. Data(ctx context.Context) (data map[string]any, err error) } + +// WatcherAdapter is the interface for configuration watcher. +type WatcherAdapter interface { + // AddWatcher adds a watcher function for specified `pattern` and `resource`. + AddWatcher(name string, fn func(ctx context.Context)) + // RemoveWatcher removes the watcher function for specified `pattern` and `resource`. + RemoveWatcher(name string) + // GetWatcherNames returns all watcher names. + GetWatcherNames() []string +} diff --git a/os/gcfg/gcfg_adapter_content.go b/os/gcfg/gcfg_adapter_content.go index 166c27374..217207fb9 100644 --- a/os/gcfg/gcfg_adapter_content.go +++ b/os/gcfg/gcfg_adapter_content.go @@ -14,17 +14,25 @@ import ( "github.com/gogf/gf/v2/errors/gerror" ) +var ( + // Compile-time checking for interface implementation. + _ Adapter = (*AdapterContent)(nil) + _ WatcherAdapter = (*AdapterContent)(nil) +) + // AdapterContent implements interface Adapter using content. // The configuration content supports the coding types as package `gjson`. type AdapterContent struct { - jsonVar *gvar.Var // The pared JSON object for configuration content, type: *gjson.Json. + jsonVar *gvar.Var // The pared JSON object for configuration content, type: *gjson.Json. + watchers *WatcherRegistry // Watchers for watching file changes. } // NewAdapterContent returns a new configuration management object using custom content. // The parameter `content` specifies the default configuration content for reading. func NewAdapterContent(content ...string) (*AdapterContent, error) { a := &AdapterContent{ - jsonVar: gvar.New(nil, true), + jsonVar: gvar.New(nil, true), + watchers: NewWatcherRegistry(), } if len(content) > 0 { if err := a.SetContent(content[0]); err != nil { @@ -42,6 +50,8 @@ func (a *AdapterContent) SetContent(content string) error { return gerror.Wrap(err, `load configuration content failed`) } a.jsonVar.Set(j) + adapterCtx := NewAdapterContentCtx().WithOperation(OperationSet).WithContent(content) + a.notifyWatchers(adapterCtx.Ctx) return nil } @@ -74,3 +84,23 @@ func (a *AdapterContent) Data(ctx context.Context) (data map[string]any, err err } return a.jsonVar.Val().(*gjson.Json).Var().Map(), nil } + +// AddWatcher adds a watcher for the specified configuration file. +func (a *AdapterContent) AddWatcher(name string, fn func(ctx context.Context)) { + a.watchers.Add(name, fn) +} + +// RemoveWatcher removes the watcher for the specified configuration file. +func (a *AdapterContent) RemoveWatcher(name string) { + a.watchers.Remove(name) +} + +// GetWatcherNames returns all watcher names. +func (a *AdapterContent) GetWatcherNames() []string { + return a.watchers.GetNames() +} + +// notifyWatchers notifies all watchers. +func (a *AdapterContent) notifyWatchers(ctx context.Context) { + a.watchers.Notify(ctx) +} diff --git a/os/gcfg/gcfg_adapter_content_ctx.go b/os/gcfg/gcfg_adapter_content_ctx.go new file mode 100644 index 000000000..c263a396a --- /dev/null +++ b/os/gcfg/gcfg_adapter_content_ctx.go @@ -0,0 +1,74 @@ +// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://github.com/gogf/gf. + +// Package gcfg provides reading, caching and managing for configuration. +package gcfg + +import ( + "context" +) + +// AdapterContentCtx is the context for AdapterContent. +type AdapterContentCtx struct { + // Ctx is the context with configuration values + Ctx context.Context +} + +// NewAdapterContentCtxWithCtx creates and returns a new AdapterContentCtx with the given context. +func NewAdapterContentCtxWithCtx(ctx context.Context) *AdapterContentCtx { + if ctx == nil { + ctx = context.Background() + } + return &AdapterContentCtx{Ctx: ctx} +} + +// NewAdapterContentCtx creates and returns a new AdapterContentCtx. +// If ctx is provided, it uses that context, otherwise it creates a background context. +func NewAdapterContentCtx(ctx ...context.Context) *AdapterContentCtx { + if len(ctx) > 0 { + return NewAdapterContentCtxWithCtx(ctx[0]) + } + return NewAdapterContentCtxWithCtx(context.Background()) +} + +// GetAdapterContentCtx creates and returns an AdapterContentCtx with the given context. +func GetAdapterContentCtx(ctx context.Context) *AdapterContentCtx { + return NewAdapterContentCtxWithCtx(ctx) +} + +// WithOperation sets the operation in the context and returns the updated AdapterContentCtx. +func (a *AdapterContentCtx) WithOperation(operation OperationType) *AdapterContentCtx { + a.Ctx = context.WithValue(a.Ctx, ContextKeyOperation, operation) + return a +} + +// WithContent sets the content in the context and returns the updated AdapterContentCtx. +func (a *AdapterContentCtx) WithContent(content string) *AdapterContentCtx { + a.Ctx = context.WithValue(a.Ctx, ContextKeyContent, content) + return a +} + +// GetOperation retrieves the operation from the context. +// Returns empty string if not found. +func (a *AdapterContentCtx) GetOperation() OperationType { + if v := a.Ctx.Value(ContextKeyOperation); v != nil { + if s, ok := v.(OperationType); ok { + return s + } + } + return "" +} + +// GetContent retrieves the content from the context. +// Returns empty string if not found. +func (a *AdapterContentCtx) GetContent() string { + if v := a.Ctx.Value(ContextKeyContent); v != nil { + if s, ok := v.(string); ok { + return s + } + } + return "" +} diff --git a/os/gcfg/gcfg_adapter_file.go b/os/gcfg/gcfg_adapter_file.go index 2114bb7dd..6c0548968 100644 --- a/os/gcfg/gcfg_adapter_file.go +++ b/os/gcfg/gcfg_adapter_file.go @@ -11,6 +11,7 @@ import ( "github.com/gogf/gf/v2/container/garray" "github.com/gogf/gf/v2/container/gmap" + "github.com/gogf/gf/v2/container/gtype" "github.com/gogf/gf/v2/container/gvar" "github.com/gogf/gf/v2/encoding/gjson" "github.com/gogf/gf/v2/errors/gerror" @@ -23,12 +24,19 @@ import ( "github.com/gogf/gf/v2/util/gutil" ) +var ( + // Compile-time checking for interface implementation. + _ Adapter = (*AdapterFile)(nil) + _ WatcherAdapter = (*AdapterFile)(nil) +) + // AdapterFile implements interface Adapter using file. type AdapterFile struct { - defaultFileNameOrPath string // Default configuration file name or file path. + defaultFileNameOrPath *gtype.String // Default configuration file name or file path. searchPaths *garray.StrArray // Searching the path array. jsonMap *gmap.StrAnyMap // The pared JSON objects for configuration files. violenceCheck bool // Whether it does violence check in value index searching. It affects the performance when set true(false in default). + watchers *WatcherRegistry // Watchers for watching file changes. } const ( @@ -67,9 +75,10 @@ func NewAdapterFile(fileNameOrPath ...string) (*AdapterFile, error) { } } config := &AdapterFile{ - defaultFileNameOrPath: usedFileNameOrPath, + defaultFileNameOrPath: gtype.NewString(usedFileNameOrPath), searchPaths: garray.NewStrArray(true), jsonMap: gmap.NewStrAnyMap(true), + watchers: NewWatcherRegistry(), } // Customized dir path from env/cmd. if customPath := command.GetOptWithEnv(commandEnvKeyForPath); customPath != "" { @@ -121,12 +130,12 @@ func (a *AdapterFile) SetViolenceCheck(check bool) { // SetFileName sets the default configuration file name. func (a *AdapterFile) SetFileName(fileNameOrPath string) { - a.defaultFileNameOrPath = fileNameOrPath + a.defaultFileNameOrPath.Set(fileNameOrPath) } // GetFileName returns the default configuration file name. func (a *AdapterFile) GetFileName() string { - return a.defaultFileNameOrPath + return a.defaultFileNameOrPath.String() } // Get retrieves and returns value by specified `pattern`. @@ -159,8 +168,17 @@ func (a *AdapterFile) Set(pattern string, value any) error { return err } if j != nil { - return j.Set(pattern, value) + err = j.Set(pattern, value) + if err != nil { + return err + } } + fileName := a.GetFileName() + filePath, _ := a.GetFilePath(fileName) + fileType := gfile.ExtName(fileName) + adapterCtx := NewAdapterFileCtx().WithOperation(OperationSet).WithKey(pattern).WithValue(value). + WithFileName(fileName).WithFilePath(filePath).WithFileType(fileType) + a.notifyWatchers(adapterCtx.Ctx) return nil } @@ -189,6 +207,11 @@ func (a *AdapterFile) MustGet(ctx context.Context, pattern string) *gvar.Var { // which will force reload configuration content from the file. func (a *AdapterFile) Clear() { a.jsonMap.Clear() + fileName := a.GetFileName() + filePath, _ := a.GetFilePath(fileName) + fileType := gfile.ExtName(fileName) + adapterFileCtx := NewAdapterFileCtx().WithOperation(OperationClear).WithFileName(fileName).WithFilePath(filePath).WithFileType(fileType) + a.notifyWatchers(adapterFileCtx.Ctx) } // Dump prints current JSON object with more manually readable. @@ -200,7 +223,7 @@ func (a *AdapterFile) Dump() { // Available checks and returns whether configuration of given `file` is available. func (a *AdapterFile) Available(ctx context.Context, fileName ...string) bool { - checkFileName := gutil.GetOrDefaultStr(a.defaultFileNameOrPath, fileName...) + checkFileName := gutil.GetOrDefaultStr(a.defaultFileNameOrPath.String(), fileName...) // Custom configuration content exists. if a.GetContent(checkFileName) != "" { return true @@ -228,13 +251,9 @@ func (a *AdapterFile) autoCheckAndAddMainPkgPathToSearchPaths() { // getJson returns a *gjson.Json object for the specified `file` content. // It would print error if file reading fails. It returns nil if any error occurs. func (a *AdapterFile) getJson(fileNameOrPath ...string) (configJson *gjson.Json, err error) { - var ( - usedFileNameOrPath = a.defaultFileNameOrPath - ) + usedFileNameOrPath := a.GetFileName() if len(fileNameOrPath) > 0 && fileNameOrPath[0] != "" { usedFileNameOrPath = fileNameOrPath[0] - } else { - usedFileNameOrPath = a.defaultFileNameOrPath } // It uses JSON map to cache specified configuration file content. result := a.jsonMap.GetOrSetFuncLock(usedFileNameOrPath, func() any { @@ -280,6 +299,23 @@ func (a *AdapterFile) getJson(fileNameOrPath ...string) (configJson *gjson.Json, if filePath != "" && !gres.Contains(filePath) { _, err = gfsnotify.Add(filePath, func(event *gfsnotify.Event) { a.jsonMap.Remove(usedFileNameOrPath) + if event.IsWrite() || event.IsRemove() || event.IsCreate() || event.IsRename() || event.IsChmod() { + fileType := gfile.ExtName(usedFileNameOrPath) + adapterCtx := NewAdapterFileCtx().WithFileName(usedFileNameOrPath).WithFilePath(filePath).WithFileType(fileType) + switch { + case event.IsWrite(): + adapterCtx.WithOperation(OperationWrite) + case event.IsRemove(): + adapterCtx.WithOperation(OperationRemove) + case event.IsCreate(): + adapterCtx.WithOperation(OperationCreate) + case event.IsRename(): + adapterCtx.WithOperation(OperationRename) + case event.IsChmod(): + adapterCtx.WithOperation(OperationChmod) + } + a.notifyWatchers(adapterCtx.Ctx) + } }) if err != nil { return nil @@ -292,3 +328,23 @@ func (a *AdapterFile) getJson(fileNameOrPath ...string) (configJson *gjson.Json, } return } + +// AddWatcher adds a watcher for the specified configuration file. +func (a *AdapterFile) AddWatcher(name string, fn func(ctx context.Context)) { + a.watchers.Add(name, fn) +} + +// RemoveWatcher removes the watcher for the specified configuration file. +func (a *AdapterFile) RemoveWatcher(name string) { + a.watchers.Remove(name) +} + +// GetWatcherNames returns all watcher names. +func (a *AdapterFile) GetWatcherNames() []string { + return a.watchers.GetNames() +} + +// notifyWatchers notifies all watchers. +func (a *AdapterFile) notifyWatchers(ctx context.Context) { + a.watchers.Notify(ctx) +} diff --git a/os/gcfg/gcfg_adapter_file_content.go b/os/gcfg/gcfg_adapter_file_content.go index 834d7a197..0ee43c7f1 100644 --- a/os/gcfg/gcfg_adapter_file_content.go +++ b/os/gcfg/gcfg_adapter_file_content.go @@ -32,6 +32,8 @@ func (a *AdapterFile) SetContent(content string, fileNameOrPath ...string) { } customConfigContentMap.Set(usedFileNameOrPath, content) }) + adapterCtx := NewAdapterFileCtx().WithFileName(usedFileNameOrPath).WithOperation(OperationSet).WithContent(content) + a.notifyWatchers(adapterCtx.Ctx) } // GetContent returns customized configuration content for specified `file`. @@ -64,7 +66,8 @@ func (a *AdapterFile) RemoveContent(fileNameOrPath ...string) { customConfigContentMap.Remove(usedFileNameOrPath) } }) - + adapterCtx := NewAdapterFileCtx().WithFileName(usedFileNameOrPath).WithOperation(OperationRemove) + a.notifyWatchers(adapterCtx.Ctx) intlog.Printf(context.TODO(), `RemoveContent: %s`, usedFileNameOrPath) } @@ -81,5 +84,7 @@ func (a *AdapterFile) ClearContent() { } } }) + adapterCtx := NewAdapterFileCtx().WithOperation(OperationClear) + a.notifyWatchers(adapterCtx.Ctx) intlog.Print(context.TODO(), `RemoveConfig`) } diff --git a/os/gcfg/gcfg_adapter_file_ctx.go b/os/gcfg/gcfg_adapter_file_ctx.go new file mode 100644 index 000000000..202205b6c --- /dev/null +++ b/os/gcfg/gcfg_adapter_file_ctx.go @@ -0,0 +1,157 @@ +// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://github.com/gogf/gf. + +// Package gcfg provides reading, caching and managing for configuration. +package gcfg + +import ( + "context" + + "github.com/gogf/gf/v2/container/gvar" +) + +// AdapterFileCtx is the context for AdapterFile. +type AdapterFileCtx struct { + // Ctx is the context with configuration values + Ctx context.Context +} + +// NewAdapterFileCtxWithCtx creates and returns a new AdapterFileCtx with the given context. +func NewAdapterFileCtxWithCtx(ctx context.Context) *AdapterFileCtx { + if ctx == nil { + ctx = context.Background() + } + return &AdapterFileCtx{Ctx: ctx} +} + +// NewAdapterFileCtx creates and returns a new AdapterFileCtx. +// If ctx is provided, it uses that context, otherwise it creates a background context. +func NewAdapterFileCtx(ctx ...context.Context) *AdapterFileCtx { + if len(ctx) > 0 { + return NewAdapterFileCtxWithCtx(ctx[0]) + } + return NewAdapterFileCtxWithCtx(context.Background()) +} + +// GetAdapterFileCtx creates and returns an AdapterFileCtx with the given context. +func GetAdapterFileCtx(ctx context.Context) *AdapterFileCtx { + return NewAdapterFileCtxWithCtx(ctx) +} + +// WithFileName sets the file name in the context and returns the updated AdapterFileCtx. +func (a *AdapterFileCtx) WithFileName(fileName string) *AdapterFileCtx { + a.Ctx = context.WithValue(a.Ctx, ContextKeyFileName, fileName) + return a +} + +// WithFilePath sets the file path in the context and returns the updated AdapterFileCtx. +func (a *AdapterFileCtx) WithFilePath(filePath string) *AdapterFileCtx { + a.Ctx = context.WithValue(a.Ctx, ContextKeyFilePath, filePath) + return a +} + +// WithFileType sets the file type in the context and returns the updated AdapterFileCtx. +func (a *AdapterFileCtx) WithFileType(fileType string) *AdapterFileCtx { + a.Ctx = context.WithValue(a.Ctx, ContextKeyFileType, fileType) + return a +} + +// WithOperation sets the operation in the context and returns the updated AdapterFileCtx. +func (a *AdapterFileCtx) WithOperation(operation OperationType) *AdapterFileCtx { + a.Ctx = context.WithValue(a.Ctx, ContextKeyOperation, operation) + return a +} + +// WithKey sets the key in the context and returns the updated AdapterFileCtx. +func (a *AdapterFileCtx) WithKey(key string) *AdapterFileCtx { + a.Ctx = context.WithValue(a.Ctx, ContextKeyKey, key) + return a +} + +// WithValue sets the value in the context and returns the updated AdapterFileCtx. +func (a *AdapterFileCtx) WithValue(value any) *AdapterFileCtx { + a.Ctx = context.WithValue(a.Ctx, ContextKeyValue, value) + return a +} + +// WithContent sets the content in the context and returns the updated AdapterFileCtx. +func (a *AdapterFileCtx) WithContent(content any) *AdapterFileCtx { + a.Ctx = context.WithValue(a.Ctx, ContextKeyContent, content) + return a +} + +// GetFileName retrieves the file name from the context. +// Returns empty string if not found. +func (a *AdapterFileCtx) GetFileName() string { + if v := a.Ctx.Value(ContextKeyFileName); v != nil { + if s, ok := v.(string); ok { + return s + } + } + return "" +} + +// GetFilePath retrieves the file path from the context. +// Returns empty string if not found. +func (a *AdapterFileCtx) GetFilePath() string { + if v := a.Ctx.Value(ContextKeyFilePath); v != nil { + if s, ok := v.(string); ok { + return s + } + } + return "" +} + +// GetFileType retrieves the file type from the context. +// Returns empty string if not found. +func (a *AdapterFileCtx) GetFileType() string { + if v := a.Ctx.Value(ContextKeyFileType); v != nil { + if s, ok := v.(string); ok { + return s + } + } + return "" +} + +// GetOperation retrieves the operation from the context. +// Returns empty string if not found. +func (a *AdapterFileCtx) GetOperation() OperationType { + if v := a.Ctx.Value(ContextKeyOperation); v != nil { + if s, ok := v.(OperationType); ok { + return s + } + } + return "" +} + +// GetKey retrieves the key from the context. +// Returns empty string if not found. +func (a *AdapterFileCtx) GetKey() string { + if v := a.Ctx.Value(ContextKeyKey); v != nil { + if s, ok := v.(string); ok { + return s + } + } + return "" +} + +// GetValue retrieves the value from the context. +// Returns nil if not found. +func (a *AdapterFileCtx) GetValue() *gvar.Var { + if v := a.Ctx.Value(ContextKeyValue); v != nil { + return gvar.New(v) + } + return nil +} + +// GetContent retrieves the set content from the context. +// Returns nil if not found. +func (a *AdapterFileCtx) GetContent() *gvar.Var { + if v := a.Ctx.Value(ContextKeyContent); v != nil { + return gvar.New(v) + } + return nil +} diff --git a/os/gcfg/gcfg_adapter_file_path.go b/os/gcfg/gcfg_adapter_file_path.go index 0044072ef..3125b8baa 100644 --- a/os/gcfg/gcfg_adapter_file_path.go +++ b/os/gcfg/gcfg_adapter_file_path.go @@ -244,7 +244,7 @@ func (a *AdapterFile) GetFilePath(fileNameOrPath ...string) (filePath string, er var ( fileExtName string tempFileNameOrPath string - usedFileNameOrPath = a.defaultFileNameOrPath + usedFileNameOrPath = a.defaultFileNameOrPath.String() ) if len(fileNameOrPath) > 0 { usedFileNameOrPath = fileNameOrPath[0] diff --git a/os/gcfg/gcfg_ctx_keys.go b/os/gcfg/gcfg_ctx_keys.go new file mode 100644 index 000000000..9d3976655 --- /dev/null +++ b/os/gcfg/gcfg_ctx_keys.go @@ -0,0 +1,51 @@ +// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://github.com/gogf/gf. + +// Package gcfg provides reading, caching and managing for configuration. +package gcfg + +import "github.com/gogf/gf/v2/os/gctx" + +// Context key constants for configuration operations. +const ( + // ContextKeyFileName is the context key for file name + ContextKeyFileName gctx.StrKey = "fileName" + // ContextKeyFilePath is the context key for file path + ContextKeyFilePath gctx.StrKey = "filePath" + // ContextKeyFileType is the context key for file type + ContextKeyFileType gctx.StrKey = "fileType" + // ContextKeyOperation is the context key for operation type + ContextKeyOperation gctx.StrKey = "operation" + // ContextKeyKey is the context key for key + ContextKeyKey gctx.StrKey = "key" + // ContextKeyValue is the context key for value + ContextKeyValue gctx.StrKey = "value" + // ContextKeyContent is the context key for set content + ContextKeyContent gctx.StrKey = "content" +) + +// OperationType defines the type for configuration operation. +type OperationType string + +// Operation constants for configuration operations. +const ( + // OperationSet represents set operation + OperationSet OperationType = "set" + // OperationWrite represents write operation + OperationWrite OperationType = "write" + // OperationRename represents rename operation + OperationRename OperationType = "rename" + // OperationRemove represents remove operation + OperationRemove OperationType = "remove" + // OperationCreate represents create operation + OperationCreate OperationType = "create" + // OperationChmod represents chmod operation + OperationChmod OperationType = "chmod" + // OperationClear represents clear operation + OperationClear OperationType = "clear" + // OperationUpdate represents update operation + OperationUpdate OperationType = "update" +) diff --git a/os/gcfg/gcfg_watcher_registry.go b/os/gcfg/gcfg_watcher_registry.go new file mode 100644 index 000000000..d5e6ee732 --- /dev/null +++ b/os/gcfg/gcfg_watcher_registry.go @@ -0,0 +1,62 @@ +// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://github.com/gogf/gf. + +package gcfg + +import ( + "context" + + "github.com/gogf/gf/v2/container/gmap" + "github.com/gogf/gf/v2/internal/intlog" +) + +// WatcherRegistry is a helper type for managing configuration watchers. +// It provides a unified implementation of watcher management to avoid code duplication +// across different adapter implementations. +type WatcherRegistry struct { + watchers *gmap.StrAnyMap // Watchers map storing watcher callbacks. +} + +// NewWatcherRegistry creates and returns a new WatcherRegistry instance. +func NewWatcherRegistry() *WatcherRegistry { + return &WatcherRegistry{ + watchers: gmap.NewStrAnyMap(true), + } +} + +// Add adds a watcher with the specified name and callback function. +func (r *WatcherRegistry) Add(name string, fn func(ctx context.Context)) { + r.watchers.Set(name, fn) +} + +// Remove removes the watcher with the specified name. +func (r *WatcherRegistry) Remove(name string) { + r.watchers.Remove(name) +} + +// GetNames returns all watcher names. +func (r *WatcherRegistry) GetNames() []string { + return r.watchers.Keys() +} + +// Notify notifies all registered watchers by calling their callback functions. +// Each callback is executed in a separate goroutine with panic recovery to prevent +// one watcher's panic from affecting others. +func (r *WatcherRegistry) Notify(ctx context.Context) { + r.watchers.Iterator(func(k string, v any) bool { + if fn, ok := v.(func(ctx context.Context)); ok { + go func(k string, fn func(ctx context.Context), ctx context.Context) { + defer func() { + if r := recover(); r != nil { + intlog.Errorf(ctx, "watcher %s panic: %v", k, r) + } + }() + fn(ctx) + }(k, fn, ctx) + } + return true + }) +} diff --git a/os/gcfg/gcfg_watcher_registry_test.go b/os/gcfg/gcfg_watcher_registry_test.go new file mode 100644 index 000000000..a720e6b4b --- /dev/null +++ b/os/gcfg/gcfg_watcher_registry_test.go @@ -0,0 +1,85 @@ +// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://github.com/gogf/gf. + +package gcfg_test + +import ( + "context" + "sync" + "testing" + + "github.com/gogf/gf/v2/os/gcfg" + "github.com/gogf/gf/v2/test/gtest" +) + +func TestWatcherRegistry_Basic(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + registry := gcfg.NewWatcherRegistry() + + // Test Add and GetNames + var ( + wg sync.WaitGroup + called bool + ) + wg.Add(1) + registry.Add("test-watcher", func(ctx context.Context) { + defer wg.Done() + called = true + }) + + names := registry.GetNames() + t.AssertEQ(len(names), 1) + t.AssertEQ(names[0], "test-watcher") + + // Test Notify + registry.Notify(context.Background()) + wg.Wait() + t.AssertEQ(called, true) + + // Test Remove + registry.Remove("test-watcher") + names = registry.GetNames() + t.AssertEQ(len(names), 0) + }) +} + +func TestWatcherRegistry_MultipleWatchers(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + registry := gcfg.NewWatcherRegistry() + + var ( + wg sync.WaitGroup + count1, count2, count3 int + ) + wg.Add(3) + registry.Add("watcher1", func(ctx context.Context) { + defer wg.Done() + count1++ + }) + registry.Add("watcher2", func(ctx context.Context) { + defer wg.Done() + count2++ + }) + registry.Add("watcher3", func(ctx context.Context) { + defer wg.Done() + count3++ + }) + + names := registry.GetNames() + t.AssertEQ(len(names), 3) + + registry.Notify(context.Background()) + wg.Wait() + t.AssertEQ(count1, 1) + t.AssertEQ(count2, 1) + t.AssertEQ(count3, 1) + + // Remove one watcher + registry.Remove("watcher2") + names = registry.GetNames() + t.AssertEQ(len(names), 2) + }) +} diff --git a/os/gcfg/gcfg_z_unit_watcher_test.go b/os/gcfg/gcfg_z_unit_watcher_test.go new file mode 100644 index 000000000..4b6313f58 --- /dev/null +++ b/os/gcfg/gcfg_z_unit_watcher_test.go @@ -0,0 +1,273 @@ +// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://github.com/gogf/gf. + +package gcfg_test + +import ( + "context" + "testing" + "time" + + "github.com/gogf/gf/v2/container/gmap" + "github.com/gogf/gf/v2/container/gtype" + "github.com/gogf/gf/v2/os/gcfg" + "github.com/gogf/gf/v2/os/gfile" + "github.com/gogf/gf/v2/test/gtest" + "github.com/gogf/gf/v2/util/guid" +) + +func TestWatcher_File_Ctx(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + var ( + key1 = "test-ctx" + configFile = guid.S() + ".toml" + content1 = `key = "value1"` + content2 = `key = "value2"` + ) + // Create config file. + err := gfile.PutContents(configFile, content1) + t.AssertNil(err) + defer gfile.RemoveFile(configFile) + + // Create config instance. + c, err := gcfg.NewAdapterFile(configFile) + t.AssertNil(err) + c.Data(context.Background()) + c.AddWatcher(key1, func(ctx context.Context) { + fileCtx := gcfg.GetAdapterFileCtx(ctx) + t.Assert(fileCtx.GetOperation(), gcfg.OperationWrite) + t.Assert(fileCtx.GetFileName(), configFile) + t.Assert(fileCtx.GetFilePath(), gfile.Abs(configFile)) + }) + gfile.PutContents(configFile, content2) + time.Sleep(1 * time.Second) + c.AddWatcher(key1, func(ctx context.Context) { + fileCtx := gcfg.GetAdapterFileCtx(ctx) + t.Assert(fileCtx.GetOperation(), gcfg.OperationSet) + t.Assert(fileCtx.GetKey(), "key") + t.Assert(fileCtx.GetValue().String(), "value2") + }) + c.Set("key", "value2") + time.Sleep(1 * time.Second) + c.RemoveWatcher(key1) + }) +} + +func TestWatcher_AddWatcherAndNotify(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + var ( + m = gmap.NewStrAnyMap(true) + key1 = "test-watcher1" + key2 = "test-watcher2" + configFile = guid.S() + ".toml" + content1 = `key = "value1"` + content2 = `key = "value2"` + ) + + // Create config file. + err := gfile.PutContents(configFile, content1) + t.AssertNil(err) + defer gfile.RemoveFile(configFile) + + // Create config instance. + c, err := gcfg.NewAdapterFile(configFile) + t.AssertNil(err) + m.Set(key1, true) + m.Set(key2, true) + + // Add watchers. + c.AddWatcher(key1, func(ctx context.Context) { + m.Set(key1, false) + }) + c.AddWatcher(key2, func(ctx context.Context) { + m.Set(key2, false) + }) + + // Check initial values. + t.Assert(c.MustGet(ctx, "key").String(), "value1") + t.Assert(m.Get(key1), true) + t.Assert(m.Get(key2), true) + + // Update config file content. + err = gfile.PutContents(configFile, content2) + t.AssertNil(err) + + // Wait for watching notification. + time.Sleep(1 * time.Second) + + // Check updated values. + t.Assert(c.MustGet(ctx, "key").String(), "value2") + t.AssertEQ(m.Get(key1), false) + t.AssertEQ(m.Get(key2), false) + }) +} + +func TestWatcher_RemoveWatcher(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + var ( + m = gmap.NewStrAnyMap(true) + key1 = "test-watcher1" + key2 = "test-watcher2" + configFile = guid.S() + ".toml" + content1 = `key = "value1"` + content2 = `key = "value2"` + ) + err := gfile.PutContents(configFile, content1) + t.AssertNil(err) + defer gfile.RemoveFile(configFile) + + // Create config instance. + c, err := gcfg.NewAdapterFile(configFile) + t.AssertNil(err) + m.Set(key1, true) + m.Set(key2, true) + + // Add watchers. + c.AddWatcher(key1, func(ctx context.Context) { + m.Set(key1, false) + }) + c.AddWatcher(key2, func(ctx context.Context) { + m.Set(key2, false) + }) + + // Check initial values. + t.Assert(c.MustGet(ctx, "key").String(), "value1") + t.Assert(m.Get(key1), true) + t.Assert(m.Get(key2), true) + + // Remove one watcher. + c.RemoveWatcher(key2) + + // Update config file content. + err = gfile.PutContents(configFile, content2) + t.AssertNil(err) + + // Wait for watching notification. + time.Sleep(1 * time.Second) + + // Check updated values. + t.Assert(c.MustGet(ctx, "key").String(), "value2") + t.AssertEQ(m.Get(key1), false) + // watcherName2 should not be notified as it was removed + t.AssertEQ(m.Get(key2), true) + }) +} + +func TestWatcher_SetContentNotify(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + var ( + count = gtype.NewInt(0) + key = "test-watcher" + content1 = `key = "value1"` + content2 = `key = "value2"` + ) + + // Create config instance. + c, err := gcfg.NewAdapterContent(content1) + t.AssertNil(err) + + // Add watcher. + c.AddWatcher(key, func(ctx context.Context) { + count.Add(1) + }) + + // Check initial values. + value, err := c.Get(ctx, "key") + t.AssertNil(err) + t.Assert(value, "value1") + t.Assert(count.Val(), 0) + + // Set custom content. + c.SetContent(content2) + + // Wait for watching notification. + time.Sleep(2 * time.Second) + + // Check that watcher was notified + t.Assert(count.Val(), 1) + value2, err := c.Get(ctx, "key") + t.AssertNil(err) + t.Assert(value2, "value2") + }) +} + +func TestWatcher_RemoveContentNotify(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + var ( + count = gtype.NewInt(0) + key = "test-watcher" + configFile = guid.S() + ".toml" + content = `key = "value1"` + ) + + // Create config file. + err := gfile.PutContents(configFile, content) + t.AssertNil(err) + defer gfile.RemoveFile(configFile) + + // Create config instance. + c, err := gcfg.NewAdapterFile(configFile) + t.AssertNil(err) + + // Add watcher. + c.AddWatcher(key, func(ctx context.Context) { + count.Add(1) + }) + + // Check initial values. + t.Assert(c.MustGet(ctx, "key").String(), "value1") + t.Assert(count.Val(), 0) + + // Remove custom content. + c.RemoveContent(configFile) + + // Wait for watching notification. + time.Sleep(1 * time.Second) + + // Check that watcher was notified again + t.Assert(count.Val(), 1) + t.Assert(c.MustGet(ctx, "key").String(), "value1") // Back to file content + }) +} + +func TestWatcher_ClearContentNotify(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + var ( + count = gtype.NewInt(0) + key = "test-watcher" + configFile = guid.S() + ".toml" + content = `key = "value1"` + ) + + // Create config file. + err := gfile.PutContents(configFile, content) + t.AssertNil(err) + defer gfile.RemoveFile(configFile) + + // Create config instance. + c, err := gcfg.NewAdapterFile(configFile) + t.AssertNil(err) + + // Add watcher. + c.AddWatcher(key, func(ctx context.Context) { + count.Add(1) + }) + + // Check initial values. + t.Assert(c.MustGet(ctx, "key").String(), "value1") + t.Assert(count.Val(), 0) + + // Clear all custom content. + c.ClearContent() + + // Wait for watching notification. + time.Sleep(1 * time.Second) + + // Check that watcher was notified again + t.Assert(count.Val(), 1) + t.Assert(c.MustGet(ctx, "key").String(), "value1") // Back to file content + }) +} diff --git a/os/gcron/gcron.go b/os/gcron/gcron.go index 0e375185c..787bc85c5 100644 --- a/os/gcron/gcron.go +++ b/os/gcron/gcron.go @@ -125,3 +125,9 @@ func Stop(name ...string) { func StopGracefully() { defaultCron.StopGracefully() } + +// StopGracefullyNonBlocking stops all running tasks gracefully without blocking, +// returning a context that callers can use to wait for completion. +func StopGracefullyNonBlocking() context.Context { + return defaultCron.StopGracefullyNonBlocking() +} diff --git a/os/gcron/gcron_cron.go b/os/gcron/gcron_cron.go index c9bd97cdf..b8accf31f 100644 --- a/os/gcron/gcron_cron.go +++ b/os/gcron/gcron_cron.go @@ -20,11 +20,14 @@ import ( // Cron stores all the cron job entries. type Cron struct { - idGen *gtype.Int64 // Used for unique name generation. - status *gtype.Int // Timed task status(0: Not Start; 1: Running; 2: Stopped; -1: Closed) - entries *gmap.StrAnyMap // All timed task entries. - logger glog.ILogger // Logger, it is nil in default. - jobWaiter sync.WaitGroup // Graceful shutdown when cron jobs are stopped. + idGen *gtype.Int64 // Used for unique name generation. + status *gtype.Int // Timed task status(0: Not Start; 1: Running; 2: Stopped; -1: Closed) + entries *gmap.StrAnyMap // All timed task entries. + logger glog.ILogger // Logger, it is nil in default. + loggerMu sync.RWMutex + jobWaiter sync.WaitGroup // Graceful shutdown when cron jobs are stopped. + running bool + runningLock sync.Mutex } // New returns a new Cron object with default settings. @@ -33,16 +36,21 @@ func New() *Cron { idGen: gtype.NewInt64(), status: gtype.NewInt(StatusRunning), entries: gmap.NewStrAnyMap(true), + running: true, } } // SetLogger sets the logger for cron. func (c *Cron) SetLogger(logger glog.ILogger) { + c.loggerMu.Lock() + defer c.loggerMu.Unlock() c.logger = logger } // GetLogger returns the logger in the cron. func (c *Cron) GetLogger() glog.ILogger { + c.loggerMu.RLock() + defer c.loggerMu.RUnlock() return c.logger } @@ -171,7 +179,10 @@ func (c *Cron) Start(name ...string) { } } } else { + c.runningLock.Lock() c.status.Set(StatusReady) + c.running = true + c.runningLock.Unlock() } } @@ -185,14 +196,32 @@ func (c *Cron) Stop(name ...string) { } } } else { + c.runningLock.Lock() c.status.Set(StatusStopped) + c.running = false + c.runningLock.Unlock() } } // StopGracefully Blocks and waits all current running jobs done. func (c *Cron) StopGracefully() { - c.status.Set(StatusStopped) - c.jobWaiter.Wait() + ctx := c.StopGracefullyNonBlocking() + <-ctx.Done() +} + +// StopGracefullyNonBlocking stops all running tasks gracefully without blocking, +// returning a context that callers can use to wait for completion. +func (c *Cron) StopGracefullyNonBlocking() context.Context { + ctx, cancel := context.WithCancel(context.Background()) + go func() { + c.runningLock.Lock() + defer c.runningLock.Unlock() + c.status.Set(StatusStopped) + c.running = false + c.jobWaiter.Wait() + cancel() + }() + return ctx } // Remove deletes scheduled task which named `name`. @@ -204,7 +233,10 @@ func (c *Cron) Remove(name string) { // Close stops and closes current cron. func (c *Cron) Close() { + c.runningLock.Lock() + defer c.runningLock.Unlock() c.status.Set(StatusClosed) + c.running = false } // Size returns the size of the timed tasks. diff --git a/os/gcron/gcron_entry.go b/os/gcron/gcron_entry.go index dd3ed72e6..842edfbf2 100644 --- a/os/gcron/gcron_entry.go +++ b/os/gcron/gcron_entry.go @@ -152,7 +152,15 @@ func (e *Entry) checkAndRun(ctx context.Context) { e.Close() case StatusReady, StatusRunning: - e.cron.jobWaiter.Add(1) + e.cron.runningLock.Lock() + if e.cron.running { + e.cron.jobWaiter.Add(1) + } else { + e.cron.runningLock.Unlock() + e.logDebugf(ctx, `cron job "%s" stoped or closed`, e.getJobNameWithPattern()) + return + } + e.cron.runningLock.Unlock() defer func() { e.cron.jobWaiter.Done() if exception := recover(); exception != nil { diff --git a/os/gcron/gcron_z_example_1_test.go b/os/gcron/gcron_z_example_1_test.go index 5aa635acc..538be7c35 100644 --- a/os/gcron/gcron_z_example_1_test.go +++ b/os/gcron/gcron_z_example_1_test.go @@ -31,7 +31,7 @@ func ExampleCron_gracefulShutdown() { g.Log().Debug(ctx, "Every 2s job start") time.Sleep(5 * time.Second) g.Log().Debug(ctx, "Every 2s job after 5 second end") - }, "MyCronJob") + }, "MyCronJob1") if err != nil { panic(err) } @@ -46,3 +46,25 @@ func ExampleCron_gracefulShutdown() { gcron.StopGracefully() glog.Print(ctx, "All cron jobs completed") } + +func ExampleCron_StopGracefullyNonBlocking() { + _, err := gcron.Add(ctx, "*/2 * * * * *", func(ctx context.Context) { + g.Log().Debug(ctx, "Every 2s job start") + time.Sleep(5 * time.Second) + g.Log().Debug(ctx, "Every 2s job after 5 second end") + }, "MyCronJob2") + if err != nil { + panic(err) + } + + quit := make(chan os.Signal, 1) + signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM) + + sig := <-quit + glog.Printf(ctx, "Signal received: %s, stopping cron", sig) + + glog.Print(ctx, "Waiting for all cron jobs to complete...") + ctx := gcron.StopGracefullyNonBlocking() + <-ctx.Done() + glog.Print(ctx, "All cron jobs completed") +} diff --git a/os/gcron/gcron_z_unit_entry_test.go b/os/gcron/gcron_z_unit_entry_test.go index 62fa361ac..7a77df70c 100644 --- a/os/gcron/gcron_z_unit_entry_test.go +++ b/os/gcron/gcron_z_unit_entry_test.go @@ -22,10 +22,12 @@ func TestCron_Entry_Operations(t *testing.T) { cron = gcron.New() array = garray.New(true) ) - cron.DelayAddTimes(ctx, 500*time.Millisecond, "* * * * * *", 2, func(ctx context.Context) { - array.Append(1) - }) - t.Assert(cron.Size(), 0) + go func() { + cron.DelayAddTimes(ctx, 500*time.Millisecond, "* * * * * *", 2, func(ctx context.Context) { + array.Append(1) + }) + t.Assert(cron.Size(), 0) + }() time.Sleep(800 * time.Millisecond) t.Assert(array.Len(), 0) t.Assert(cron.Size(), 1) @@ -39,12 +41,16 @@ func TestCron_Entry_Operations(t *testing.T) { cron = gcron.New() array = garray.New(true) ) - entry, err1 := cron.Add(ctx, "* * * * * *", func(ctx context.Context) { - array.Append(1) - }) - t.Assert(err1, nil) - t.Assert(array.Len(), 0) - t.Assert(cron.Size(), 1) + var entry *gcron.Entry + go func() { + var err error + entry, err = cron.Add(ctx, "* * * * * *", func(ctx context.Context) { + array.Append(1) + }) + t.Assert(err, nil) + t.Assert(array.Len(), 0) + t.Assert(cron.Size(), 1) + }() time.Sleep(1300 * time.Millisecond) t.Assert(array.Len(), 1) t.Assert(cron.Size(), 1) diff --git a/os/gcron/gcron_z_unit_test.go b/os/gcron/gcron_z_unit_test.go index 1f162d560..4d514b818 100644 --- a/os/gcron/gcron_z_unit_test.go +++ b/os/gcron/gcron_z_unit_test.go @@ -30,18 +30,23 @@ func TestCron_Add_Close(t *testing.T) { gtest.C(t, func(t *gtest.T) { cron := gcron.New() array := garray.New(true) - _, err1 := cron.Add(ctx, "* * * * * *", func(ctx context.Context) { - g.Log().Print(ctx, "cron1") - array.Append(1) - }) - _, err2 := cron.Add(ctx, "* * * * * *", func(ctx context.Context) { - g.Log().Print(ctx, "cron2") - array.Append(1) - }, "test") - t.Assert(err1, nil) - t.Assert(err2, nil) - t.Assert(cron.Size(), 2) + g.Log().Debugf(ctx, "TestCron_Add_Close Add begin Start time %v ", time.Now().UnixMilli()) + go func() { + _, err1 := cron.Add(ctx, "* * * * * *", func(ctx context.Context) { + g.Log().Print(ctx, "cron1") + array.Append(1) + }) + t.Assert(err1, nil) + }() + go func() { + _, err2 := cron.Add(ctx, "* * * * * *", func(ctx context.Context) { + g.Log().Print(ctx, "cron2") + array.Append(1) + }, "test") + t.Assert(err2, nil) + }() time.Sleep(1300 * time.Millisecond) + t.Assert(cron.Size(), 2) t.Assert(array.Len(), 2) time.Sleep(1300 * time.Millisecond) t.Assert(array.Len(), 4) @@ -56,8 +61,8 @@ func TestCron_Add_Close(t *testing.T) { func TestCron_Basic(t *testing.T) { gtest.C(t, func(t *gtest.T) { cron := gcron.New() + defer cron.Close() cron.Add(ctx, "* * * * * *", func(ctx context.Context) {}, "add") - // fmt.Println("start", time.Now()) cron.DelayAdd(ctx, time.Second, "* * * * * *", func(ctx context.Context) {}, "delay_add") t.Assert(cron.Size(), 1) time.Sleep(1200 * time.Millisecond) @@ -93,17 +98,25 @@ func TestCron_Remove(t *testing.T) { gtest.C(t, func(t *gtest.T) { cron := gcron.New() array := garray.New(true) - cron.Add(ctx, "* * * * * *", func(ctx context.Context) { - array.Append(1) - }, "add") - t.Assert(array.Len(), 0) + go func() { + cron.Add(ctx, "* * * * * *", func(ctx context.Context) { + array.Append(1) + }, "add") + t.Assert(array.Len(), 0) + }() time.Sleep(1200 * time.Millisecond) t.Assert(array.Len(), 1) - cron.Remove("add") t.Assert(array.Len(), 1) time.Sleep(1200 * time.Millisecond) t.Assert(array.Len(), 1) + time.Sleep(1200 * time.Millisecond) + t.Assert(array.Len(), 1) + time.Sleep(1200 * time.Millisecond) + t.Assert(array.Len(), 1) + time.Sleep(1200 * time.Millisecond) + t.Assert(array.Len(), 1) + }) } @@ -122,17 +135,19 @@ func doTestCronAddFixedPattern(t *testing.T) { expect = now.Add(time.Second * 2) ) defer cron.Close() - var pattern = fmt.Sprintf( `%d %d %d %d %d %s`, expect.Second(), expect.Minute(), expect.Hour(), expect.Day(), expect.Month(), expect.Weekday().String(), ) cron.SetLogger(g.Log()) - g.Log().Debugf(ctx, `pattern: %s`, pattern) - _, err := cron.Add(ctx, pattern, func(ctx context.Context) { - array.Append(1) - }) - t.AssertNil(err) + go func() { + g.Log().Debugf(ctx, `pattern: %s`, pattern) + _, err := cron.Add(ctx, pattern, func(ctx context.Context) { + g.Log().Debugf(ctx, `receive job`) + array.Append(1) + }) + t.AssertNil(err) + }() time.Sleep(3500 * time.Millisecond) g.Log().Debug(ctx, `current time`) t.Assert(array.Len(), 1) @@ -143,9 +158,12 @@ func TestCron_AddSingleton(t *testing.T) { // un used, can be removed gtest.C(t, func(t *gtest.T) { cron := gcron.New() - cron.Add(ctx, "* * * * * *", func(ctx context.Context) {}, "add") - cron.DelayAdd(ctx, time.Second, "* * * * * *", func(ctx context.Context) {}, "delay_add") - t.Assert(cron.Size(), 1) + defer cron.Close() + go func() { + cron.Add(ctx, "* * * * * *", func(ctx context.Context) {}, "add") + cron.DelayAdd(ctx, time.Second, "* * * * * *", func(ctx context.Context) {}, "delay_add") + t.Assert(cron.Size(), 1) + }() time.Sleep(1200 * time.Millisecond) t.Assert(cron.Size(), 2) @@ -160,12 +178,15 @@ func TestCron_AddSingleton(t *testing.T) { // keep this gtest.C(t, func(t *gtest.T) { cron := gcron.New() + defer cron.Close() array := garray.New(true) - cron.AddSingleton(ctx, "* * * * * *", func(ctx context.Context) { - array.Append(1) - time.Sleep(50 * time.Second) - }) - t.Assert(cron.Size(), 1) + go func() { + cron.AddSingleton(ctx, "* * * * * *", func(ctx context.Context) { + array.Append(1) + time.Sleep(50 * time.Second) + }) + t.Assert(cron.Size(), 1) + }() time.Sleep(3500 * time.Millisecond) t.Assert(array.Len(), 1) }) @@ -175,14 +196,17 @@ func TestCron_AddSingleton(t *testing.T) { func TestCron_AddOnce1(t *testing.T) { gtest.C(t, func(t *gtest.T) { cron := gcron.New() + defer cron.Close() array := garray.New(true) - cron.AddOnce(ctx, "* * * * * *", func(ctx context.Context) { - array.Append(1) - }) - cron.AddOnce(ctx, "* * * * * *", func(ctx context.Context) { - array.Append(1) - }) - t.Assert(cron.Size(), 2) + go func() { + cron.AddOnce(ctx, "* * * * * *", func(ctx context.Context) { + array.Append(1) + }) + cron.AddOnce(ctx, "* * * * * *", func(ctx context.Context) { + array.Append(1) + }) + t.Assert(cron.Size(), 2) + }() time.Sleep(2500 * time.Millisecond) t.Assert(array.Len(), 2) t.Assert(cron.Size(), 0) @@ -192,11 +216,14 @@ func TestCron_AddOnce1(t *testing.T) { func TestCron_AddOnce2(t *testing.T) { gtest.C(t, func(t *gtest.T) { cron := gcron.New() + defer cron.Close() array := garray.New(true) - cron.AddOnce(ctx, "@every 2s", func(ctx context.Context) { - array.Append(1) - }) - t.Assert(cron.Size(), 1) + go func() { + cron.AddOnce(ctx, "@every 2s", func(ctx context.Context) { + array.Append(1) + }) + t.Assert(cron.Size(), 1) + }() time.Sleep(3000 * time.Millisecond) t.Assert(array.Len(), 1) t.Assert(cron.Size(), 0) @@ -206,10 +233,13 @@ func TestCron_AddOnce2(t *testing.T) { func TestCron_AddTimes(t *testing.T) { gtest.C(t, func(t *gtest.T) { cron := gcron.New() + defer cron.Close() array := garray.New(true) - _, _ = cron.AddTimes(ctx, "* * * * * *", 2, func(ctx context.Context) { - array.Append(1) - }) + go func() { + _, _ = cron.AddTimes(ctx, "* * * * * *", 2, func(ctx context.Context) { + array.Append(1) + }) + }() time.Sleep(3500 * time.Millisecond) t.Assert(array.Len(), 2) t.Assert(cron.Size(), 0) @@ -219,11 +249,14 @@ func TestCron_AddTimes(t *testing.T) { func TestCron_DelayAdd(t *testing.T) { gtest.C(t, func(t *gtest.T) { cron := gcron.New() + defer cron.Close() array := garray.New(true) - cron.DelayAdd(ctx, 500*time.Millisecond, "* * * * * *", func(ctx context.Context) { - array.Append(1) - }) - t.Assert(cron.Size(), 0) + go func() { + cron.DelayAdd(ctx, 500*time.Millisecond, "* * * * * *", func(ctx context.Context) { + array.Append(1) + }) + t.Assert(cron.Size(), 0) + }() time.Sleep(800 * time.Millisecond) t.Assert(array.Len(), 0) t.Assert(cron.Size(), 1) @@ -236,12 +269,15 @@ func TestCron_DelayAdd(t *testing.T) { func TestCron_DelayAddSingleton(t *testing.T) { gtest.C(t, func(t *gtest.T) { cron := gcron.New() + defer cron.Close() array := garray.New(true) - cron.DelayAddSingleton(ctx, 500*time.Millisecond, "* * * * * *", func(ctx context.Context) { - array.Append(1) - time.Sleep(10 * time.Second) - }) - t.Assert(cron.Size(), 0) + go func() { + cron.DelayAddSingleton(ctx, 500*time.Millisecond, "* * * * * *", func(ctx context.Context) { + array.Append(1) + time.Sleep(10 * time.Second) + }) + t.Assert(cron.Size(), 0) + }() time.Sleep(2200 * time.Millisecond) t.Assert(array.Len(), 1) t.Assert(cron.Size(), 1) @@ -251,11 +287,14 @@ func TestCron_DelayAddSingleton(t *testing.T) { func TestCron_DelayAddOnce(t *testing.T) { gtest.C(t, func(t *gtest.T) { cron := gcron.New() + defer cron.Close() array := garray.New(true) - cron.DelayAddOnce(ctx, 500*time.Millisecond, "* * * * * *", func(ctx context.Context) { - array.Append(1) - }) - t.Assert(cron.Size(), 0) + go func() { + cron.DelayAddOnce(ctx, 500*time.Millisecond, "* * * * * *", func(ctx context.Context) { + array.Append(1) + }) + t.Assert(cron.Size(), 0) + }() time.Sleep(800 * time.Millisecond) t.Assert(array.Len(), 0) t.Assert(cron.Size(), 1) @@ -268,11 +307,14 @@ func TestCron_DelayAddOnce(t *testing.T) { func TestCron_DelayAddTimes(t *testing.T) { gtest.C(t, func(t *gtest.T) { cron := gcron.New() + defer cron.Close() array := garray.New(true) - cron.DelayAddTimes(ctx, 500*time.Millisecond, "* * * * * *", 2, func(ctx context.Context) { - array.Append(1) - }) - t.Assert(cron.Size(), 0) + go func() { + cron.DelayAddTimes(ctx, 500*time.Millisecond, "* * * * * *", 2, func(ctx context.Context) { + array.Append(1) + }) + t.Assert(cron.Size(), 0) + }() time.Sleep(800 * time.Millisecond) t.Assert(array.Len(), 0) t.Assert(cron.Size(), 1) @@ -284,27 +326,30 @@ func TestCron_DelayAddTimes(t *testing.T) { func TestCron_JobWaiter(t *testing.T) { gtest.C(t, func(t *gtest.T) { - var err error s1 := garray.New(true) s2 := garray.New(true) - _, err = gcron.Add(ctx, "* * * * * *", func(ctx context.Context) { - g.Log().Debug(ctx, "Every second") - s1.Append(struct{}{}) - }, "MyFirstCronJob") - t.Assert(err, nil) - _, err = gcron.Add(ctx, "*/2 * * * * *", func(ctx context.Context) { - g.Log().Debug(ctx, "Every 2s job start") - time.Sleep(3 * time.Second) - s2.Append(struct{}{}) - g.Log().Debug(ctx, "Every 2s job after 3 second end") - }, "MySecondCronJob") - t.Assert(err, nil) - quit := make(chan os.Signal, 1) signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM) - + cron := gcron.New() + defer cron.Close() go func() { - time.Sleep(4 * time.Second) // Ensure that the job is triggered twice + _, err := cron.Add(ctx, "* * * * * *", func(ctx context.Context) { + g.Log().Debug(ctx, "Every second") + s1.Append(struct{}{}) + }, "TestCronJobWaiterMyFirstCronJob") + t.Assert(err, nil) + }() + go func() { + _, err := cron.Add(ctx, "*/2 * * * * *", func(ctx context.Context) { + g.Log().Debug(ctx, "Every 2s job start") + time.Sleep(3 * time.Second) + s2.Append(struct{}{}) + g.Log().Debug(ctx, "Every 2s job after 3 second end") + }, "TestCronJobMySecondCronJob") + t.Assert(err, nil) + }() + go func() { + time.Sleep(4300 * time.Millisecond) // Ensure that the job is triggered twice glog.Print(ctx, "Sending SIGINT") quit <- syscall.SIGINT // Send SIGINT }() @@ -312,10 +357,136 @@ func TestCron_JobWaiter(t *testing.T) { sig := <-quit glog.Printf(ctx, "Signal received: %s, stopping cron", sig) - glog.Print(ctx, "Waiting for all cron jobs to complete...") - gcron.StopGracefully() + glog.Print(ctx, "TestCron_JobWaiter Waiting for all cron jobs to complete...") + cron.StopGracefully() glog.Print(ctx, "All cron jobs completed") t.Assert(s1.Len(), 4) t.Assert(s2.Len(), 2) }) } + +func TestCron_JobWaiterNonBlocking(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + s1 := garray.New(true) + s2 := garray.New(true) + quit := make(chan os.Signal, 1) + signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM) + cron := gcron.New() + defer cron.Close() + go func() { + _, err := cron.Add(ctx, "* * * * * *", func(ctx context.Context) { + g.Log().Debug(ctx, "Every second start") + s1.Append(struct{}{}) + g.Log().Debug(ctx, "Every second end ") + }) + t.Assert(err, nil) + }() + go func() { + _, err := cron.Add(ctx, "*/2 * * * * *", func(ctx context.Context) { + g.Log().Debug(ctx, "Every 2s job start ") + time.Sleep(3 * time.Second) + s2.Append(struct{}{}) + g.Log().Debug(ctx, "Every 2s job after 3 second end ") + }) + t.Assert(err, nil) + + }() + go func() { + time.Sleep(4300 * time.Millisecond) // Ensure that the job is triggered twice + glog.Print(ctx, "Sending SIGINT") + quit <- syscall.SIGINT // Send SIGINT + }() + + sig := <-quit + glog.Printf(ctx, "Signal received: %s, stopping cron", sig) + glog.Print(ctx, "TestCron_JobWaiterNonBlocking Waiting for all cron jobs to complete...") + ctx := cron.StopGracefullyNonBlocking() + <-ctx.Done() + glog.Print(ctx, "All cron jobs completed") + t.Assert(s1.Len(), 4) + t.Assert(s2.Len(), 2) + }) +} + +func TestCron_NoneJobsDoneImmediately(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + cron := gcron.New() + defer cron.Close() + + ctx := cron.StopGracefullyNonBlocking() + select { + case <-ctx.Done(): + case <-time.After(110 * time.Millisecond): + t.Error("context was not done immediately") + } + }) +} + +func TestCron_RepeatedCallsStopGracefullyNonBlocking(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + cron := gcron.New() + defer cron.Close() + + _ = cron.StopGracefullyNonBlocking() + ctx := cron.StopGracefullyNonBlocking() + select { + case <-ctx.Done(): + case <-time.After(110 * time.Millisecond): + t.Error("context was not done immediately") + } + }) +} + +func TestCron_RepeatedCallsStopGracefullyNonBlocking2(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + s1 := garray.New(true) + s2 := garray.New(true) + cron := gcron.New() + defer cron.Close() + g.Log().Debugf(ctx, "TestCron_RepeatedCallsStopGracefullyNonBlocking2 Add begin Start time %v ", time.Now().UnixMilli()) + go func() { + _, err := cron.Add(ctx, "* * * * * *", func(ctx context.Context) { + g.Log().Debug(ctx, "Every second") + s1.Append(struct{}{}) + }) + t.Assert(err, nil) + + }() + go func() { + _, err := cron.Add(ctx, "*/2 * * * * *", func(ctx context.Context) { + g.Log().Debug(ctx, "Every 2s job start") + time.Sleep(3 * time.Second) + s2.Append(struct{}{}) + g.Log().Debug(ctx, "Every 2s job after 3 second end") + }) + t.Assert(err, nil) + }() + time.Sleep(4300 * time.Millisecond) + g.Log().Debugf(ctx, "TestCron_RepeatedCallsStopGracefullyNonBlocking2 end time %v ", time.Now().UnixMilli()) + glog.Print(ctx, "Waiting for all cron jobs to complete...") + _ = cron.StopGracefullyNonBlocking() + ctx := cron.StopGracefullyNonBlocking() + <-ctx.Done() + glog.Print(ctx, "All cron jobs completed") + t.Assert(s1.Len(), 4) + t.Assert(s2.Len(), 2) + }) +} + +func TestCron_StopGracefullyWithStopStart(t *testing.T) { + gtest.C(t, func(t *gtest.T) { + cron := gcron.New() + defer cron.Close() + go func() { + _, err := cron.Add(ctx, "* * * * * *", func(ctx context.Context) { + g.Log().Debug(ctx, "Every second") + }) + t.Assert(err, nil) + }() + time.Sleep(1300 * time.Millisecond) + cron.Stop() + cron.Start() + ctx := cron.StopGracefullyNonBlocking() + <-ctx.Done() + }) +} diff --git a/os/gctx/gctx.go b/os/gctx/gctx.go index 2a7e71113..1316c5452 100644 --- a/os/gctx/gctx.go +++ b/os/gctx/gctx.go @@ -52,6 +52,7 @@ func New() context.Context { } // WithCtx creates and returns a context containing context id upon given parent context `ctx`. +// // Deprecated: use WithSpan instead. func WithCtx(ctx context.Context) context.Context { if CtxId(ctx) != "" { diff --git a/os/gmutex/gmutex.go b/os/gmutex/gmutex.go index 956ccdc8b..1d49f07fc 100644 --- a/os/gmutex/gmutex.go +++ b/os/gmutex/gmutex.go @@ -10,6 +10,7 @@ package gmutex // New creates and returns a new mutex. +// // Deprecated: use Mutex or RWMutex instead. func New() *RWMutex { return &RWMutex{} diff --git a/os/gview/gview_parse.go b/os/gview/gview_parse.go index 02d2888b0..93d151376 100644 --- a/os/gview/gview_parse.go +++ b/os/gview/gview_parse.go @@ -102,6 +102,7 @@ func (view *View) ParseContent(ctx context.Context, content string, params ...Pa } // Option for template parsing. +// // Deprecated: use Options instead. type Option = Options @@ -114,6 +115,7 @@ type Options struct { } // ParseOption implements template parsing using Option. +// // Deprecated: use ParseWithOptions instead. func (view *View) ParseOption(ctx context.Context, option Option) (result string, err error) { return view.ParseWithOptions(ctx, option) diff --git a/util/gconv/gconv.go b/util/gconv/gconv.go index 58f8c63eb..cc5adc497 100644 --- a/util/gconv/gconv.go +++ b/util/gconv/gconv.go @@ -154,6 +154,7 @@ func NewConverter() Converter { } // RegisterConverter registers custom converter. +// // Deprecated: use RegisterTypeConverterFunc instead for clear func RegisterConverter(fn any) (err error) { return RegisterTypeConverterFunc(fn) diff --git a/util/gconv/gconv_map.go b/util/gconv/gconv_map.go index 04733e8b3..caa4cced0 100644 --- a/util/gconv/gconv_map.go +++ b/util/gconv/gconv_map.go @@ -20,6 +20,7 @@ func Map(value any, option ...MapOption) map[string]any { // MapDeep does Map function recursively, which means if the attribute of `value` // is also a struct/*struct, calls Map function on this attribute converting it to // a map[string]any type variable. +// // Deprecated: used Map instead. func MapDeep(value any, tags ...string) map[string]any { result, _ := defaultConverter.Map(value, MapOption{ @@ -40,6 +41,7 @@ func MapStrStr(value any, option ...MapOption) map[string]string { // MapStrStrDeep converts `value` to map[string]string recursively. // Note that there might be data copy for this map type converting. +// // Deprecated: used MapStrStr instead. func MapStrStrDeep(value any, tags ...string) map[string]string { if r, ok := value.(map[string]string); ok { diff --git a/util/gconv/gconv_maps.go b/util/gconv/gconv_maps.go index a3d7b6a8c..f622b2ae4 100644 --- a/util/gconv/gconv_maps.go +++ b/util/gconv/gconv_maps.go @@ -17,6 +17,7 @@ func SliceMap(anyInput any, option ...MapOption) []map[string]any { } // SliceMapDeep is alias of MapsDeep. +// // Deprecated: used SliceMap instead. func SliceMapDeep(anyInput any) []map[string]any { return MapsDeep(anyInput) @@ -43,6 +44,7 @@ func Maps(value any, option ...MapOption) []map[string]any { // MapsDeep converts `value` to []map[string]any recursively. // // TODO completely implement the recursive converting for all types. +// // Deprecated: used Maps instead. func MapsDeep(value any, tags ...string) []map[string]any { if value == nil { diff --git a/util/gutil/gutil_comparator.go b/util/gutil/gutil_comparator.go index a5e73d41a..2591b0d60 100644 --- a/util/gutil/gutil_comparator.go +++ b/util/gutil/gutil_comparator.go @@ -7,6 +7,7 @@ package gutil import ( + "cmp" "strings" "github.com/gogf/gf/v2/util/gconv" @@ -125,3 +126,12 @@ func ComparatorTime(a, b any) int { return 0 } } + +// ComparatorT provides a generic comparison for ordered types. +func ComparatorT[T cmp.Ordered](a, b T) int { + return cmp.Compare(a, b) +} + +func ComparatorTStr[T any](a, b T) int { + return cmp.Compare(gconv.String(a), gconv.String(b)) +} diff --git a/version.go b/version.go index 308cbe519..fbcf4ce79 100644 --- a/version.go +++ b/version.go @@ -2,5 +2,5 @@ package gf const ( // VERSION is the current GoFrame version. - VERSION = "v2.9.3" + VERSION = "v2.9.5" )