mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-23 08:56:29 +00:00
Update Dependencies (#349)
* github.com/russross/meddler v1.0.0 -> v1.0.1 * github.com/gin-gonic/gin v1.6.3 -> v1.7.4 * github.com/go-sql-driver/mysql v1.5.0 -> v1.6.0 * github.com/sirupsen/logrus v1.6.0 -> v1.8.1 * github.com/rs/zerolog v1.18.0 -> v1.25.0
This commit is contained in:
parent
0bd10fa507
commit
4df9c8d6a5
495 changed files with 39456 additions and 29666 deletions
34
go.mod
34
go.mod
|
@ -24,8 +24,9 @@ require (
|
||||||
github.com/franela/goblin v0.0.0-20200512143142-b260c999b2d7
|
github.com/franela/goblin v0.0.0-20200512143142-b260c999b2d7
|
||||||
github.com/ghodss/yaml v1.0.0
|
github.com/ghodss/yaml v1.0.0
|
||||||
github.com/gin-gonic/contrib v0.0.0-20191209060500-d6e26eeaa607
|
github.com/gin-gonic/contrib v0.0.0-20191209060500-d6e26eeaa607
|
||||||
github.com/gin-gonic/gin v1.6.3
|
github.com/gin-gonic/gin v1.7.4
|
||||||
github.com/go-sql-driver/mysql v1.5.0
|
github.com/go-playground/validator/v10 v10.9.0 // indirect
|
||||||
|
github.com/go-sql-driver/mysql v1.6.0
|
||||||
github.com/gogits/go-gogs-client v0.0.0-20160212212711-d584b1e0fb4d
|
github.com/gogits/go-gogs-client v0.0.0-20160212212711-d584b1e0fb4d
|
||||||
github.com/gogo/protobuf v1.3.1 // indirect
|
github.com/gogo/protobuf v1.3.1 // indirect
|
||||||
github.com/golang-jwt/jwt v3.2.2+incompatible
|
github.com/golang-jwt/jwt v3.2.2+incompatible
|
||||||
|
@ -36,37 +37,38 @@ require (
|
||||||
github.com/hashicorp/go-version v1.3.0 // indirect
|
github.com/hashicorp/go-version v1.3.0 // indirect
|
||||||
github.com/jackspirou/syscerts v0.0.0-20160531025014-b68f5469dff1
|
github.com/jackspirou/syscerts v0.0.0-20160531025014-b68f5469dff1
|
||||||
github.com/joho/godotenv v1.3.0
|
github.com/joho/godotenv v1.3.0
|
||||||
github.com/kr/pretty v0.2.1
|
github.com/json-iterator/go v1.1.12 // indirect
|
||||||
github.com/kr/text v0.2.0 // indirect
|
github.com/kr/pretty v0.3.0
|
||||||
github.com/lib/pq v1.5.2
|
github.com/lib/pq v1.5.2
|
||||||
|
github.com/mattn/go-isatty v0.0.14 // indirect
|
||||||
github.com/mattn/go-sqlite3 v2.0.3+incompatible
|
github.com/mattn/go-sqlite3 v2.0.3+incompatible
|
||||||
github.com/morikuni/aec v1.0.0 // indirect
|
github.com/morikuni/aec v1.0.0 // indirect
|
||||||
github.com/mrjones/oauth v0.0.0-20190623134757-126b35219450
|
github.com/mrjones/oauth v0.0.0-20190623134757-126b35219450
|
||||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
|
|
||||||
github.com/opencontainers/go-digest v1.0.0 // indirect
|
github.com/opencontainers/go-digest v1.0.0 // indirect
|
||||||
github.com/opencontainers/image-spec v1.0.1 // indirect
|
github.com/opencontainers/image-spec v1.0.1 // indirect
|
||||||
github.com/pkg/errors v0.9.1 // indirect
|
|
||||||
github.com/prometheus/client_golang v1.6.0
|
github.com/prometheus/client_golang v1.6.0
|
||||||
github.com/prometheus/common v0.10.0 // indirect
|
github.com/prometheus/common v0.10.0 // indirect
|
||||||
github.com/rs/zerolog v1.18.0
|
github.com/rs/zerolog v1.25.0
|
||||||
github.com/russross/meddler v1.0.0
|
github.com/russross/meddler v1.0.1
|
||||||
github.com/sirupsen/logrus v1.6.0
|
github.com/sirupsen/logrus v1.8.1
|
||||||
github.com/stretchr/objx v0.2.0 // indirect
|
github.com/stretchr/objx v0.3.0 // indirect
|
||||||
github.com/stretchr/testify v1.5.1
|
github.com/stretchr/testify v1.7.0
|
||||||
github.com/tevino/abool v0.0.0-20170917061928-9b9efcf221b5
|
github.com/tevino/abool v0.0.0-20170917061928-9b9efcf221b5
|
||||||
|
github.com/ugorji/go v1.2.6 // indirect
|
||||||
github.com/urfave/cli v1.22.4
|
github.com/urfave/cli v1.22.4
|
||||||
github.com/woodpecker-ci/expr v0.0.0-20210628233344-164b8b3d0915
|
github.com/woodpecker-ci/expr v0.0.0-20210628233344-164b8b3d0915
|
||||||
github.com/woodpecker-ci/togo v0.0.0-20180401185031-50a0e4726e74
|
github.com/woodpecker-ci/togo v0.0.0-20180401185031-50a0e4726e74
|
||||||
golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37
|
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519
|
||||||
golang.org/x/net v0.0.0-20210825183410-e898025ed96a
|
golang.org/x/net v0.0.0-20210825183410-e898025ed96a
|
||||||
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
|
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
|
||||||
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a
|
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
|
||||||
|
golang.org/x/sys v0.0.0-20210923061019-b8560ed6a9b7 // indirect
|
||||||
|
golang.org/x/text v0.3.7 // indirect
|
||||||
google.golang.org/appengine v1.6.6 // indirect
|
google.golang.org/appengine v1.6.6 // indirect
|
||||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect
|
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect
|
||||||
google.golang.org/grpc v1.29.1
|
google.golang.org/grpc v1.29.1
|
||||||
google.golang.org/protobuf v1.27.1 // indirect
|
google.golang.org/protobuf v1.27.1 // indirect
|
||||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
|
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||||
gopkg.in/yaml.v2 v2.3.0 // indirect
|
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200506231410-2ff61e1afc86
|
|
||||||
gotest.tools v2.2.0+incompatible // indirect
|
gotest.tools v2.2.0+incompatible // indirect
|
||||||
)
|
)
|
||||||
|
|
123
go.sum
123
go.sum
|
@ -29,7 +29,7 @@ github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+
|
||||||
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
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/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||||
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM=
|
github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||||
|
@ -69,23 +69,27 @@ github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE
|
||||||
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
||||||
github.com/gin-gonic/contrib v0.0.0-20191209060500-d6e26eeaa607 h1:MrIm8EEPue08JS4eh+b08IOG+wd0WRWEHWnewNfWFX0=
|
github.com/gin-gonic/contrib v0.0.0-20191209060500-d6e26eeaa607 h1:MrIm8EEPue08JS4eh+b08IOG+wd0WRWEHWnewNfWFX0=
|
||||||
github.com/gin-gonic/contrib v0.0.0-20191209060500-d6e26eeaa607/go.mod h1:iqneQ2Df3omzIVTkIfn7c1acsVnMGiSLn4XF5Blh3Yg=
|
github.com/gin-gonic/contrib v0.0.0-20191209060500-d6e26eeaa607/go.mod h1:iqneQ2Df3omzIVTkIfn7c1acsVnMGiSLn4XF5Blh3Yg=
|
||||||
github.com/gin-gonic/gin v1.6.3 h1:ahKqKTFpO5KTPHxWZjEdPScmYaGtLo8Y4DMHoEsnp14=
|
github.com/gin-gonic/gin v1.7.4 h1:QmUZXrvJ9qZ3GfWvQ+2wnW/1ePrTEJqPKMYEU3lD/DM=
|
||||||
github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M=
|
github.com/gin-gonic/gin v1.7.4/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY=
|
||||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
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/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||||
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
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.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
||||||
github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
|
github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
|
||||||
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||||
github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=
|
|
||||||
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
|
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
|
||||||
github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no=
|
github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU=
|
||||||
|
github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs=
|
||||||
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
|
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
|
||||||
github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1Vv0sFl1UcHBOY=
|
github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho=
|
||||||
github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI=
|
github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA=
|
||||||
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
|
github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4=
|
||||||
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
github.com/go-playground/validator/v10 v10.9.0 h1:NgTtmN58D0m8+UuxtYmGztBJB7VnPgjj221I1QHci2A=
|
||||||
|
github.com/go-playground/validator/v10 v10.9.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos=
|
||||||
|
github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
|
||||||
|
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
||||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||||
|
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||||
github.com/gogits/go-gogs-client v0.0.0-20160212212711-d584b1e0fb4d h1:2sle18csjgDC8lnX5SHBwoyBlE1QLj8A8vgDxd2Mwbw=
|
github.com/gogits/go-gogs-client v0.0.0-20160212212711-d584b1e0fb4d h1:2sle18csjgDC8lnX5SHBwoyBlE1QLj8A8vgDxd2Mwbw=
|
||||||
github.com/gogits/go-gogs-client v0.0.0-20160212212711-d584b1e0fb4d/go.mod h1:cY2AIrMgHm6oOHmR7jY+9TtjzSjQ3iG7tURJG3Y6XH0=
|
github.com/gogits/go-gogs-client v0.0.0-20160212212711-d584b1e0fb4d/go.mod h1:cY2AIrMgHm6oOHmR7jY+9TtjzSjQ3iG7tURJG3Y6XH0=
|
||||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||||
|
@ -129,28 +133,31 @@ github.com/jackspirou/syscerts v0.0.0-20160531025014-b68f5469dff1/go.mod h1:zuHl
|
||||||
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
|
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
|
||||||
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
||||||
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||||
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
|
|
||||||
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
github.com/json-iterator/go v1.1.9/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/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
||||||
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
|
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
|
||||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
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.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8=
|
|
||||||
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/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.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
|
|
||||||
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||||
|
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
||||||
|
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
|
||||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
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.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 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||||
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
|
|
||||||
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
|
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
|
||||||
|
github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w=
|
||||||
|
github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
|
||||||
github.com/lib/pq v1.5.2 h1:yTSXVswvWUOQ3k1sd7vJfDrbSl8lKuscqFJRqjC0ifw=
|
github.com/lib/pq v1.5.2 h1:yTSXVswvWUOQ3k1sd7vJfDrbSl8lKuscqFJRqjC0ifw=
|
||||||
github.com/lib/pq v1.5.2/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
github.com/lib/pq v1.5.2/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||||
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
|
|
||||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||||
|
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
|
||||||
|
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||||
|
github.com/mattn/go-sqlite3 v1.14.7/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
||||||
github.com/mattn/go-sqlite3 v2.0.3+incompatible h1:gXHsfypPkaMZrKbD5209QV9jbUTJKjyR5WD3HYQSd+U=
|
github.com/mattn/go-sqlite3 v2.0.3+incompatible h1:gXHsfypPkaMZrKbD5209QV9jbUTJKjyR5WD3HYQSd+U=
|
||||||
github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
|
github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
|
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
|
||||||
|
@ -159,19 +166,19 @@ github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJ
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
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=
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||||
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
|
|
||||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
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/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A=
|
github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A=
|
||||||
github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc=
|
github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc=
|
||||||
github.com/mrjones/oauth v0.0.0-20190623134757-126b35219450 h1:j2kD3MT1z4PXCiUllUJF9mWUESr9TWKS7iEKsQ/IipM=
|
github.com/mrjones/oauth v0.0.0-20190623134757-126b35219450 h1:j2kD3MT1z4PXCiUllUJF9mWUESr9TWKS7iEKsQ/IipM=
|
||||||
github.com/mrjones/oauth v0.0.0-20190623134757-126b35219450/go.mod h1:skjdDftzkFALcuGzYSklqYd8gvat6F1gZJ4YPVbkZpM=
|
github.com/mrjones/oauth v0.0.0-20190623134757-126b35219450/go.mod h1:skjdDftzkFALcuGzYSklqYd8gvat6F1gZJ4YPVbkZpM=
|
||||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
|
|
||||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
|
||||||
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
|
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
|
||||||
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
|
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
|
||||||
github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI=
|
github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI=
|
||||||
github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
|
github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
|
||||||
|
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
|
||||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
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.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||||
|
@ -195,35 +202,41 @@ github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R
|
||||||
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
||||||
github.com/prometheus/procfs v0.0.11 h1:DhHlBtkHWPYi8O2y31JkK0TF+DGM+51OopZjH/Ia5qI=
|
github.com/prometheus/procfs v0.0.11 h1:DhHlBtkHWPYi8O2y31JkK0TF+DGM+51OopZjH/Ia5qI=
|
||||||
github.com/prometheus/procfs v0.0.11/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
|
github.com/prometheus/procfs v0.0.11/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
|
||||||
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
|
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
|
||||||
github.com/rs/zerolog v1.18.0 h1:CbAm3kP2Tptby1i9sYy2MGRg0uxIN9cyDb59Ys7W8z8=
|
github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8=
|
||||||
github.com/rs/zerolog v1.18.0/go.mod h1:9nvC1axdVrAHcu/s9taAVfBuIdTZLVQmKQyvrUjF5+I=
|
github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
|
||||||
|
github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
|
||||||
|
github.com/rs/zerolog v1.25.0 h1:Rj7XygbUHKUlDPcVdoLyR91fJBsduXj5fRxyqIQj/II=
|
||||||
|
github.com/rs/zerolog v1.25.0/go.mod h1:7KHcEGe0QZPOm2IE4Kpb5rTh6n1h2hIgS5OOnu1rUaI=
|
||||||
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
|
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
|
||||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
github.com/russross/meddler v1.0.0 h1:3HgwIot/NsCrLrmorjSO7JhzoshoSVfuqgFgZ0VTbro=
|
github.com/russross/meddler v1.0.1 h1:JLR7Z4M4iGm1nr7DIURBq18UW8cTrm+qArUFgOhELo8=
|
||||||
github.com/russross/meddler v1.0.0/go.mod h1:j75NzzcOL4CGy+pPKykxZoT/At5Qj4ZnRRs1PXxweZI=
|
github.com/russross/meddler v1.0.1/go.mod h1:GzGDChbFHuzxlFwt8gnJMRRNyFSQDSudmy2kHh7GYnQ=
|
||||||
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
|
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
|
||||||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||||
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
|
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
|
||||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||||
github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I=
|
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
|
||||||
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
|
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
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.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48=
|
github.com/stretchr/objx v0.3.0 h1:NGXK3lHquSN08v5vWalVI/L8XU9hdzE/G6xsrze47As=
|
||||||
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
github.com/stretchr/objx v0.3.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
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.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||||
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
|
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||||
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/tevino/abool v0.0.0-20170917061928-9b9efcf221b5 h1:hNna6Fi0eP1f2sMBe/rJicDmaHmoXGe1Ta84FPYHLuE=
|
github.com/tevino/abool v0.0.0-20170917061928-9b9efcf221b5 h1:hNna6Fi0eP1f2sMBe/rJicDmaHmoXGe1Ta84FPYHLuE=
|
||||||
github.com/tevino/abool v0.0.0-20170917061928-9b9efcf221b5/go.mod h1:f1SCnEOt6sc3fOJfPQDRDzHOtSXuTtnz0ImG9kPRDV0=
|
github.com/tevino/abool v0.0.0-20170917061928-9b9efcf221b5/go.mod h1:f1SCnEOt6sc3fOJfPQDRDzHOtSXuTtnz0ImG9kPRDV0=
|
||||||
github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=
|
|
||||||
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
|
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
|
||||||
github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=
|
github.com/ugorji/go v1.2.6 h1:tGiWC9HENWE2tqYycIqFTNorMmFRVhNwCpDOpWqnk8E=
|
||||||
|
github.com/ugorji/go v1.2.6/go.mod h1:anCg0y61KIhDlPZmnH+so+RQbysYVyDko0IMgJv0Nn0=
|
||||||
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
|
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
|
||||||
|
github.com/ugorji/go/codec v1.2.6 h1:7kbGefxLoDBuYXOms4yD7223OpNMMPNPZxXk5TvFcyQ=
|
||||||
|
github.com/ugorji/go/codec v1.2.6/go.mod h1:V6TCNZ4PHqoHGFZuSG1W8nrCzzdgA2DozYxWFFpvxTw=
|
||||||
github.com/urfave/cli v1.22.4 h1:u7tSpNPPswAFymm8IehJhy4uJMlUuU/GmqSkvJ1InXA=
|
github.com/urfave/cli v1.22.4 h1:u7tSpNPPswAFymm8IehJhy4uJMlUuU/GmqSkvJ1InXA=
|
||||||
github.com/urfave/cli v1.22.4/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
github.com/urfave/cli v1.22.4/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||||
github.com/woodpecker-ci/expr v0.0.0-20210628233344-164b8b3d0915 h1:9zBOoKSR9CBeYoKQv6LFIuImg8lorCjh8XzK72bJMRg=
|
github.com/woodpecker-ci/expr v0.0.0-20210628233344-164b8b3d0915 h1:9zBOoKSR9CBeYoKQv6LFIuImg8lorCjh8XzK72bJMRg=
|
||||||
|
@ -231,17 +244,20 @@ github.com/woodpecker-ci/expr v0.0.0-20210628233344-164b8b3d0915/go.mod h1:PbzlZ
|
||||||
github.com/woodpecker-ci/togo v0.0.0-20180401185031-50a0e4726e74 h1:q/tWgA3hMWrAQqsS4yfhc0+w4RevBGr9ghem/bFFDRY=
|
github.com/woodpecker-ci/togo v0.0.0-20180401185031-50a0e4726e74 h1:q/tWgA3hMWrAQqsS4yfhc0+w4RevBGr9ghem/bFFDRY=
|
||||||
github.com/woodpecker-ci/togo v0.0.0-20180401185031-50a0e4726e74/go.mod h1:lykh/ei/caPO6sv4NN+pqnDTo8kEKhZcnhafN8GhGNs=
|
github.com/woodpecker-ci/togo v0.0.0-20180401185031-50a0e4726e74/go.mod h1:lykh/ei/caPO6sv4NN+pqnDTo8kEKhZcnhafN8GhGNs=
|
||||||
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
|
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
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-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-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37 h1:cg5LA/zNPRzIXIWSCxQW10Rvpy94aQh3LT/ShoCpkHw=
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
|
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg=
|
||||||
|
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
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-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
golang.org/x/mod v0.2.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-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
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-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-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
@ -253,6 +269,8 @@ golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR
|
||||||
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
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-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-20200226121028-0de0cce0169b/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-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
||||||
golang.org/x/net v0.0.0-20210825183410-e898025ed96a h1:bRuuGXV8wwSdGTB+CtJf+FjgO1APK1CoO39T4BN/XBw=
|
golang.org/x/net v0.0.0-20210825183410-e898025ed96a h1:bRuuGXV8wwSdGTB+CtJf+FjgO1APK1CoO39T4BN/XBw=
|
||||||
golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
|
@ -263,8 +281,8 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ
|
||||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/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=
|
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-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a h1:WXEvlFVvvGxCJLG6REjsT03iWnKLEWinaScsxF2Vm2o=
|
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
|
||||||
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/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-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
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-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-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
@ -272,30 +290,40 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h
|
||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/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-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da h1:b3NXsE2LusjYGGjL5bxEVZZORm/YEFFrWFjR8eFrw/c=
|
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-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-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20210923061019-b8560ed6a9b7 h1:c20P3CcPbopVp2f7099WLOqSNKURf30Z0uq66HpijZY=
|
||||||
|
golang.org/x/sys v0.0.0-20210923061019-b8560ed6a9b7/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
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.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.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||||
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
|
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.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
|
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
|
||||||
|
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/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-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/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-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-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-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||||
golang.org/x/tools v0.0.0-20190828213141-aed303cbaa74/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-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.0.0-20200325010219-a49f79bcc224/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
|
golang.org/x/tools v0.0.0-20200325010219-a49f79bcc224/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
|
||||||
|
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-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-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/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 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
|
||||||
|
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
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.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||||
google.golang.org/appengine v1.6.6 h1:lMO5rYAqUxkmaj76jAkRUvt5JZgFymx/+Q5Mzfivuhc=
|
google.golang.org/appengine v1.6.6 h1:lMO5rYAqUxkmaj76jAkRUvt5JZgFymx/+Q5Mzfivuhc=
|
||||||
|
@ -323,18 +351,21 @@ google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+Rur
|
||||||
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
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 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-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
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/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
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.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.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.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.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
|
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200506231410-2ff61e1afc86 h1:OfFoIUYv/me30yv7XlMy4F9RJw8DEm8WQ6QG1Ph4bH0=
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200506231410-2ff61e1afc86/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
|
||||||
|
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
|
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
|
||||||
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
|
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
|
||||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
|
|
8
vendor/github.com/gin-gonic/gin/.travis.yml
generated
vendored
8
vendor/github.com/gin-gonic/gin/.travis.yml
generated
vendored
|
@ -3,18 +3,20 @@ language: go
|
||||||
matrix:
|
matrix:
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
include:
|
include:
|
||||||
- go: 1.11.x
|
|
||||||
env: GO111MODULE=on
|
|
||||||
- go: 1.12.x
|
- go: 1.12.x
|
||||||
env: GO111MODULE=on
|
env: GO111MODULE=on
|
||||||
- go: 1.13.x
|
- go: 1.13.x
|
||||||
- go: 1.13.x
|
- go: 1.13.x
|
||||||
env:
|
env:
|
||||||
- TESTTAGS=nomsgpack
|
- TESTTAGS=nomsgpack
|
||||||
- go: 1.14.x
|
- go: 1.14.x
|
||||||
- go: 1.14.x
|
- go: 1.14.x
|
||||||
env:
|
env:
|
||||||
- TESTTAGS=nomsgpack
|
- TESTTAGS=nomsgpack
|
||||||
|
- go: 1.15.x
|
||||||
|
- go: 1.15.x
|
||||||
|
env:
|
||||||
|
- TESTTAGS=nomsgpack
|
||||||
- go: master
|
- go: master
|
||||||
|
|
||||||
git:
|
git:
|
||||||
|
|
4
vendor/github.com/gin-gonic/gin/AUTHORS.md
generated
vendored
4
vendor/github.com/gin-gonic/gin/AUTHORS.md
generated
vendored
|
@ -156,7 +156,7 @@ People and companies, who have contributed, in alphabetical order.
|
||||||
- Fix variadic parameter in the flexible render API
|
- Fix variadic parameter in the flexible render API
|
||||||
- Fix Corrupted plain render
|
- Fix Corrupted plain render
|
||||||
- Add Pluggable View Renderer Example
|
- Add Pluggable View Renderer Example
|
||||||
|
|
||||||
|
|
||||||
**@msemenistyi (Mykyta Semenistyi)**
|
**@msemenistyi (Mykyta Semenistyi)**
|
||||||
- update Readme.md. Add code to String method
|
- update Readme.md. Add code to String method
|
||||||
|
@ -190,6 +190,8 @@ People and companies, who have contributed, in alphabetical order.
|
||||||
**@rogierlommers (Rogier Lommers)**
|
**@rogierlommers (Rogier Lommers)**
|
||||||
- Add updated static serve example
|
- Add updated static serve example
|
||||||
|
|
||||||
|
**@rw-access (Ross Wolf)**
|
||||||
|
- Added support to mix exact and param routes
|
||||||
|
|
||||||
**@se77en (Damon Zhao)**
|
**@se77en (Damon Zhao)**
|
||||||
- Improve color logging
|
- Improve color logging
|
||||||
|
|
1267
vendor/github.com/gin-gonic/gin/BENCHMARKS.md
generated
vendored
1267
vendor/github.com/gin-gonic/gin/BENCHMARKS.md
generated
vendored
File diff suppressed because it is too large
Load diff
67
vendor/github.com/gin-gonic/gin/CHANGELOG.md
generated
vendored
67
vendor/github.com/gin-gonic/gin/CHANGELOG.md
generated
vendored
|
@ -1,5 +1,56 @@
|
||||||
# Gin ChangeLog
|
# Gin ChangeLog
|
||||||
|
|
||||||
|
## Gin v1.7.3
|
||||||
|
|
||||||
|
### BUGFIXES
|
||||||
|
|
||||||
|
* fix level 1 router match [#2767](https://github.com/gin-gonic/gin/issues/2767), [#2796](https://github.com/gin-gonic/gin/issues/2796)
|
||||||
|
|
||||||
|
## Gin v1.7.2
|
||||||
|
|
||||||
|
### BUGFIXES
|
||||||
|
|
||||||
|
* Fix conflict between param and exact path [#2706](https://github.com/gin-gonic/gin/issues/2706). Close issue [#2682](https://github.com/gin-gonic/gin/issues/2682) [#2696](https://github.com/gin-gonic/gin/issues/2696).
|
||||||
|
|
||||||
|
## Gin v1.7.1
|
||||||
|
|
||||||
|
### BUGFIXES
|
||||||
|
|
||||||
|
* fix: data race with trustedCIDRs from [#2674](https://github.com/gin-gonic/gin/issues/2674)([#2675](https://github.com/gin-gonic/gin/pull/2675))
|
||||||
|
|
||||||
|
## Gin v1.7.0
|
||||||
|
|
||||||
|
### BUGFIXES
|
||||||
|
|
||||||
|
* fix compile error from [#2572](https://github.com/gin-gonic/gin/pull/2572) ([#2600](https://github.com/gin-gonic/gin/pull/2600))
|
||||||
|
* fix: print headers without Authorization header on broken pipe ([#2528](https://github.com/gin-gonic/gin/pull/2528))
|
||||||
|
* fix(tree): reassign fullpath when register new node ([#2366](https://github.com/gin-gonic/gin/pull/2366))
|
||||||
|
|
||||||
|
### ENHANCEMENTS
|
||||||
|
|
||||||
|
* Support params and exact routes without creating conflicts ([#2663](https://github.com/gin-gonic/gin/pull/2663))
|
||||||
|
* chore: improve render string performance ([#2365](https://github.com/gin-gonic/gin/pull/2365))
|
||||||
|
* Sync route tree to httprouter latest code ([#2368](https://github.com/gin-gonic/gin/pull/2368))
|
||||||
|
* chore: rename getQueryCache/getFormCache to initQueryCache/initFormCa ([#2375](https://github.com/gin-gonic/gin/pull/2375))
|
||||||
|
* chore(performance): improve countParams ([#2378](https://github.com/gin-gonic/gin/pull/2378))
|
||||||
|
* Remove some functions that have the same effect as the bytes package ([#2387](https://github.com/gin-gonic/gin/pull/2387))
|
||||||
|
* update:SetMode function ([#2321](https://github.com/gin-gonic/gin/pull/2321))
|
||||||
|
* remove a unused type SecureJSONPrefix ([#2391](https://github.com/gin-gonic/gin/pull/2391))
|
||||||
|
* Add a redirect sample for POST method ([#2389](https://github.com/gin-gonic/gin/pull/2389))
|
||||||
|
* Add CustomRecovery builtin middleware ([#2322](https://github.com/gin-gonic/gin/pull/2322))
|
||||||
|
* binding: avoid 2038 problem on 32-bit architectures ([#2450](https://github.com/gin-gonic/gin/pull/2450))
|
||||||
|
* Prevent panic in Context.GetQuery() when there is no Request ([#2412](https://github.com/gin-gonic/gin/pull/2412))
|
||||||
|
* Add GetUint and GetUint64 method on gin.context ([#2487](https://github.com/gin-gonic/gin/pull/2487))
|
||||||
|
* update content-disposition header to MIME-style ([#2512](https://github.com/gin-gonic/gin/pull/2512))
|
||||||
|
* reduce allocs and improve the render `WriteString` ([#2508](https://github.com/gin-gonic/gin/pull/2508))
|
||||||
|
* implement ".Unwrap() error" on Error type ([#2525](https://github.com/gin-gonic/gin/pull/2525)) ([#2526](https://github.com/gin-gonic/gin/pull/2526))
|
||||||
|
* Allow bind with a map[string]string ([#2484](https://github.com/gin-gonic/gin/pull/2484))
|
||||||
|
* chore: update tree ([#2371](https://github.com/gin-gonic/gin/pull/2371))
|
||||||
|
* Support binding for slice/array obj [Rewrite] ([#2302](https://github.com/gin-gonic/gin/pull/2302))
|
||||||
|
* basic auth: fix timing oracle ([#2609](https://github.com/gin-gonic/gin/pull/2609))
|
||||||
|
* Add mixed param and non-param paths (port of httprouter[#329](https://github.com/gin-gonic/gin/pull/329)) ([#2663](https://github.com/gin-gonic/gin/pull/2663))
|
||||||
|
* feat(engine): add trustedproxies and remoteIP ([#2632](https://github.com/gin-gonic/gin/pull/2632))
|
||||||
|
|
||||||
## Gin v1.6.3
|
## Gin v1.6.3
|
||||||
|
|
||||||
### ENHANCEMENTS
|
### ENHANCEMENTS
|
||||||
|
@ -8,14 +59,14 @@
|
||||||
|
|
||||||
## Gin v1.6.2
|
## Gin v1.6.2
|
||||||
|
|
||||||
### BUFIXES
|
### BUGFIXES
|
||||||
* fix missing initial sync.RWMutex [#2305](https://github.com/gin-gonic/gin/pull/2305)
|
* fix missing initial sync.RWMutex [#2305](https://github.com/gin-gonic/gin/pull/2305)
|
||||||
### ENHANCEMENTS
|
### ENHANCEMENTS
|
||||||
* Add set samesite in cookie. [#2306](https://github.com/gin-gonic/gin/pull/2306)
|
* Add set samesite in cookie. [#2306](https://github.com/gin-gonic/gin/pull/2306)
|
||||||
|
|
||||||
## Gin v1.6.1
|
## Gin v1.6.1
|
||||||
|
|
||||||
### BUFIXES
|
### BUGFIXES
|
||||||
* Revert "fix accept incoming network connections" [#2294](https://github.com/gin-gonic/gin/pull/2294)
|
* Revert "fix accept incoming network connections" [#2294](https://github.com/gin-gonic/gin/pull/2294)
|
||||||
|
|
||||||
## Gin v1.6.0
|
## Gin v1.6.0
|
||||||
|
@ -25,7 +76,7 @@
|
||||||
* drop support govendor [#2148](https://github.com/gin-gonic/gin/pull/2148)
|
* drop support govendor [#2148](https://github.com/gin-gonic/gin/pull/2148)
|
||||||
* Added support for SameSite cookie flag [#1615](https://github.com/gin-gonic/gin/pull/1615)
|
* Added support for SameSite cookie flag [#1615](https://github.com/gin-gonic/gin/pull/1615)
|
||||||
### FEATURES
|
### FEATURES
|
||||||
* add yaml negotitation [#2220](https://github.com/gin-gonic/gin/pull/2220)
|
* add yaml negotiation [#2220](https://github.com/gin-gonic/gin/pull/2220)
|
||||||
* FileFromFS [#2112](https://github.com/gin-gonic/gin/pull/2112)
|
* FileFromFS [#2112](https://github.com/gin-gonic/gin/pull/2112)
|
||||||
### BUGFIXES
|
### BUGFIXES
|
||||||
* Unix Socket Handling [#2280](https://github.com/gin-gonic/gin/pull/2280)
|
* Unix Socket Handling [#2280](https://github.com/gin-gonic/gin/pull/2280)
|
||||||
|
@ -215,12 +266,12 @@
|
||||||
|
|
||||||
## Gin 1.1
|
## Gin 1.1
|
||||||
|
|
||||||
- [NEW] Implement QueryArray and PostArray methods
|
- [NEW] Implement QueryArray and PostArray methods
|
||||||
- [NEW] Refactor GetQuery and GetPostForm
|
- [NEW] Refactor GetQuery and GetPostForm
|
||||||
- [NEW] Add contribution guide
|
- [NEW] Add contribution guide
|
||||||
- [FIX] Corrected typos in README
|
- [FIX] Corrected typos in README
|
||||||
- [FIX] Removed additional Iota
|
- [FIX] Removed additional Iota
|
||||||
- [FIX] Changed imports to gopkg instead of github in README (#733)
|
- [FIX] Changed imports to gopkg instead of github in README (#733)
|
||||||
- [FIX] Logger: skip ANSI color commands if output is not a tty
|
- [FIX] Logger: skip ANSI color commands if output is not a tty
|
||||||
|
|
||||||
## Gin 1.0rc2 (...)
|
## Gin 1.0rc2 (...)
|
||||||
|
|
4
vendor/github.com/gin-gonic/gin/CONTRIBUTING.md
generated
vendored
4
vendor/github.com/gin-gonic/gin/CONTRIBUTING.md
generated
vendored
|
@ -1,4 +1,4 @@
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
- With issues:
|
- With issues:
|
||||||
- Use the search tool before opening a new issue.
|
- Use the search tool before opening a new issue.
|
||||||
|
@ -8,6 +8,6 @@
|
||||||
- With pull requests:
|
- With pull requests:
|
||||||
- Open your pull request against `master`
|
- Open your pull request against `master`
|
||||||
- Your pull request should have no more than two commits, if not you should squash them.
|
- 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 TravisCI.
|
- It should pass all tests in the available continuous integration systems such as TravisCI.
|
||||||
- You should add/modify tests to cover your proposed code changes.
|
- You should add/modify tests to cover your proposed code changes.
|
||||||
- If your pull request contains a new feature, please document it on the README.
|
- If your pull request contains a new feature, please document it on the README.
|
||||||
|
|
230
vendor/github.com/gin-gonic/gin/README.md
generated
vendored
230
vendor/github.com/gin-gonic/gin/README.md
generated
vendored
|
@ -5,7 +5,7 @@
|
||||||
[![Build Status](https://travis-ci.org/gin-gonic/gin.svg)](https://travis-ci.org/gin-gonic/gin)
|
[![Build Status](https://travis-ci.org/gin-gonic/gin.svg)](https://travis-ci.org/gin-gonic/gin)
|
||||||
[![codecov](https://codecov.io/gh/gin-gonic/gin/branch/master/graph/badge.svg)](https://codecov.io/gh/gin-gonic/gin)
|
[![codecov](https://codecov.io/gh/gin-gonic/gin/branch/master/graph/badge.svg)](https://codecov.io/gh/gin-gonic/gin)
|
||||||
[![Go Report Card](https://goreportcard.com/badge/github.com/gin-gonic/gin)](https://goreportcard.com/report/github.com/gin-gonic/gin)
|
[![Go Report Card](https://goreportcard.com/badge/github.com/gin-gonic/gin)](https://goreportcard.com/report/github.com/gin-gonic/gin)
|
||||||
[![GoDoc](https://godoc.org/github.com/gin-gonic/gin?status.svg)](https://godoc.org/github.com/gin-gonic/gin)
|
[![GoDoc](https://pkg.go.dev/badge/github.com/gin-gonic/gin?status.svg)](https://pkg.go.dev/github.com/gin-gonic/gin?tab=doc)
|
||||||
[![Join the chat at https://gitter.im/gin-gonic/gin](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/gin-gonic/gin?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
[![Join the chat at https://gitter.im/gin-gonic/gin](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/gin-gonic/gin?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||||
[![Sourcegraph](https://sourcegraph.com/github.com/gin-gonic/gin/-/badge.svg)](https://sourcegraph.com/github.com/gin-gonic/gin?badge)
|
[![Sourcegraph](https://sourcegraph.com/github.com/gin-gonic/gin/-/badge.svg)](https://sourcegraph.com/github.com/gin-gonic/gin?badge)
|
||||||
[![Open Source Helpers](https://www.codetriage.com/gin-gonic/gin/badges/users.svg)](https://www.codetriage.com/gin-gonic/gin)
|
[![Open Source Helpers](https://www.codetriage.com/gin-gonic/gin/badges/users.svg)](https://www.codetriage.com/gin-gonic/gin)
|
||||||
|
@ -54,6 +54,7 @@ Gin is a web framework written in Go (Golang). It features a martini-like API wi
|
||||||
- [AsciiJSON](#asciijson)
|
- [AsciiJSON](#asciijson)
|
||||||
- [PureJSON](#purejson)
|
- [PureJSON](#purejson)
|
||||||
- [Serving static files](#serving-static-files)
|
- [Serving static files](#serving-static-files)
|
||||||
|
- [Serving data from file](#serving-data-from-file)
|
||||||
- [Serving data from reader](#serving-data-from-reader)
|
- [Serving data from reader](#serving-data-from-reader)
|
||||||
- [HTML rendering](#html-rendering)
|
- [HTML rendering](#html-rendering)
|
||||||
- [Custom Template renderer](#custom-template-renderer)
|
- [Custom Template renderer](#custom-template-renderer)
|
||||||
|
@ -68,6 +69,8 @@ Gin is a web framework written in Go (Golang). It features a martini-like API wi
|
||||||
- [Support Let's Encrypt](#support-lets-encrypt)
|
- [Support Let's Encrypt](#support-lets-encrypt)
|
||||||
- [Run multiple service using Gin](#run-multiple-service-using-gin)
|
- [Run multiple service using Gin](#run-multiple-service-using-gin)
|
||||||
- [Graceful shutdown or restart](#graceful-shutdown-or-restart)
|
- [Graceful shutdown or restart](#graceful-shutdown-or-restart)
|
||||||
|
- [Third-party packages](#third-party-packages)
|
||||||
|
- [Manually](#manually)
|
||||||
- [Build a single binary with templates](#build-a-single-binary-with-templates)
|
- [Build a single binary with templates](#build-a-single-binary-with-templates)
|
||||||
- [Bind form-data request with custom struct](#bind-form-data-request-with-custom-struct)
|
- [Bind form-data request with custom struct](#bind-form-data-request-with-custom-struct)
|
||||||
- [Try to bind body into different structs](#try-to-bind-body-into-different-structs)
|
- [Try to bind body into different structs](#try-to-bind-body-into-different-structs)
|
||||||
|
@ -81,7 +84,7 @@ Gin is a web framework written in Go (Golang). It features a martini-like API wi
|
||||||
|
|
||||||
To install Gin package, you need to install Go and set your Go workspace first.
|
To install Gin package, you need to install Go and set your Go workspace first.
|
||||||
|
|
||||||
1. The first need [Go](https://golang.org/) installed (**version 1.11+ is required**), then you can use the below Go command to install Gin.
|
1. The first need [Go](https://golang.org/) installed (**version 1.12+ is required**), then you can use the below Go command to install Gin.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ go get -u github.com/gin-gonic/gin
|
$ go get -u github.com/gin-gonic/gin
|
||||||
|
@ -100,7 +103,7 @@ import "net/http"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Quick start
|
## Quick start
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# assume the following codes in example.go file
|
# assume the following codes in example.go file
|
||||||
$ cat example.go
|
$ cat example.go
|
||||||
|
@ -133,35 +136,38 @@ Gin uses a custom version of [HttpRouter](https://github.com/julienschmidt/httpr
|
||||||
|
|
||||||
[See all benchmarks](/BENCHMARKS.md)
|
[See all benchmarks](/BENCHMARKS.md)
|
||||||
|
|
||||||
Benchmark name | (1) | (2) | (3) | (4)
|
| Benchmark name | (1) | (2) | (3) | (4) |
|
||||||
--------------------------------------------|-----------:|------------:|-----------:|---------:
|
| ------------------------------ | ---------:| ---------------:| ------------:| ---------------:|
|
||||||
**BenchmarkGin_GithubAll** | **30000** | **48375** | **0** | **0**
|
| BenchmarkGin_GithubAll | **43550** | **27364 ns/op** | **0 B/op** | **0 allocs/op** |
|
||||||
BenchmarkAce_GithubAll | 10000 | 134059 | 13792 | 167
|
| BenchmarkAce_GithubAll | 40543 | 29670 ns/op | 0 B/op | 0 allocs/op |
|
||||||
BenchmarkBear_GithubAll | 5000 | 534445 | 86448 | 943
|
| BenchmarkAero_GithubAll | 57632 | 20648 ns/op | 0 B/op | 0 allocs/op |
|
||||||
BenchmarkBeego_GithubAll | 3000 | 592444 | 74705 | 812
|
| BenchmarkBear_GithubAll | 9234 | 216179 ns/op | 86448 B/op | 943 allocs/op |
|
||||||
BenchmarkBone_GithubAll | 200 | 6957308 | 698784 | 8453
|
| BenchmarkBeego_GithubAll | 7407 | 243496 ns/op | 71456 B/op | 609 allocs/op |
|
||||||
BenchmarkDenco_GithubAll | 10000 | 158819 | 20224 | 167
|
| BenchmarkBone_GithubAll | 420 | 2922835 ns/op | 720160 B/op | 8620 allocs/op |
|
||||||
BenchmarkEcho_GithubAll | 10000 | 154700 | 6496 | 203
|
| BenchmarkChi_GithubAll | 7620 | 238331 ns/op | 87696 B/op | 609 allocs/op |
|
||||||
BenchmarkGocraftWeb_GithubAll | 3000 | 570806 | 131656 | 1686
|
| BenchmarkDenco_GithubAll | 18355 | 64494 ns/op | 20224 B/op | 167 allocs/op |
|
||||||
BenchmarkGoji_GithubAll | 2000 | 818034 | 56112 | 334
|
| BenchmarkEcho_GithubAll | 31251 | 38479 ns/op | 0 B/op | 0 allocs/op |
|
||||||
BenchmarkGojiv2_GithubAll | 2000 | 1213973 | 274768 | 3712
|
| BenchmarkGocraftWeb_GithubAll | 4117 | 300062 ns/op | 131656 B/op | 1686 allocs/op |
|
||||||
BenchmarkGoJsonRest_GithubAll | 2000 | 785796 | 134371 | 2737
|
| BenchmarkGoji_GithubAll | 3274 | 416158 ns/op | 56112 B/op | 334 allocs/op |
|
||||||
BenchmarkGoRestful_GithubAll | 300 | 5238188 | 689672 | 4519
|
| BenchmarkGojiv2_GithubAll | 1402 | 870518 ns/op | 352720 B/op | 4321 allocs/op |
|
||||||
BenchmarkGorillaMux_GithubAll | 100 | 10257726 | 211840 | 2272
|
| BenchmarkGoJsonRest_GithubAll | 2976 | 401507 ns/op | 134371 B/op | 2737 allocs/op |
|
||||||
BenchmarkHttpRouter_GithubAll | 20000 | 105414 | 13792 | 167
|
| BenchmarkGoRestful_GithubAll | 410 | 2913158 ns/op | 910144 B/op | 2938 allocs/op |
|
||||||
BenchmarkHttpTreeMux_GithubAll | 10000 | 319934 | 65856 | 671
|
| BenchmarkGorillaMux_GithubAll | 346 | 3384987 ns/op | 251650 B/op | 1994 allocs/op |
|
||||||
BenchmarkKocha_GithubAll | 10000 | 209442 | 23304 | 843
|
| BenchmarkGowwwRouter_GithubAll | 10000 | 143025 ns/op | 72144 B/op | 501 allocs/op |
|
||||||
BenchmarkLARS_GithubAll | 20000 | 62565 | 0 | 0
|
| BenchmarkHttpRouter_GithubAll | 55938 | 21360 ns/op | 0 B/op | 0 allocs/op |
|
||||||
BenchmarkMacaron_GithubAll | 2000 | 1161270 | 204194 | 2000
|
| BenchmarkHttpTreeMux_GithubAll | 10000 | 153944 ns/op | 65856 B/op | 671 allocs/op |
|
||||||
BenchmarkMartini_GithubAll | 200 | 9991713 | 226549 | 2325
|
| BenchmarkKocha_GithubAll | 10000 | 106315 ns/op | 23304 B/op | 843 allocs/op |
|
||||||
BenchmarkPat_GithubAll | 200 | 5590793 | 1499568 | 27435
|
| BenchmarkLARS_GithubAll | 47779 | 25084 ns/op | 0 B/op | 0 allocs/op |
|
||||||
BenchmarkPossum_GithubAll | 10000 | 319768 | 84448 | 609
|
| BenchmarkMacaron_GithubAll | 3266 | 371907 ns/op | 149409 B/op | 1624 allocs/op |
|
||||||
BenchmarkR2router_GithubAll | 10000 | 305134 | 77328 | 979
|
| BenchmarkMartini_GithubAll | 331 | 3444706 ns/op | 226551 B/op | 2325 allocs/op |
|
||||||
BenchmarkRivet_GithubAll | 10000 | 132134 | 16272 | 167
|
| BenchmarkPat_GithubAll | 273 | 4381818 ns/op | 1483152 B/op | 26963 allocs/op |
|
||||||
BenchmarkTango_GithubAll | 3000 | 552754 | 63826 | 1618
|
| BenchmarkPossum_GithubAll | 10000 | 164367 ns/op | 84448 B/op | 609 allocs/op |
|
||||||
BenchmarkTigerTonic_GithubAll | 1000 | 1439483 | 239104 | 5374
|
| BenchmarkR2router_GithubAll | 10000 | 160220 ns/op | 77328 B/op | 979 allocs/op |
|
||||||
BenchmarkTraffic_GithubAll | 100 | 11383067 | 2659329 | 21848
|
| BenchmarkRivet_GithubAll | 14625 | 82453 ns/op | 16272 B/op | 167 allocs/op |
|
||||||
BenchmarkVulcan_GithubAll | 5000 | 394253 | 19894 | 609
|
| BenchmarkTango_GithubAll | 6255 | 279611 ns/op | 63826 B/op | 1618 allocs/op |
|
||||||
|
| BenchmarkTigerTonic_GithubAll | 2008 | 687874 ns/op | 193856 B/op | 4474 allocs/op |
|
||||||
|
| BenchmarkTraffic_GithubAll | 355 | 3478508 ns/op | 820744 B/op | 14114 allocs/op |
|
||||||
|
| BenchmarkVulcan_GithubAll | 6885 | 193333 ns/op | 19894 B/op | 609 allocs/op |
|
||||||
|
|
||||||
- (1): Total Repetitions achieved in constant time, higher means more confident result
|
- (1): Total Repetitions achieved in constant time, higher means more confident result
|
||||||
- (2): Single Repetition Duration (ns/op), lower is better
|
- (2): Single Repetition Duration (ns/op), lower is better
|
||||||
|
@ -172,8 +178,8 @@ BenchmarkVulcan_GithubAll | 5000 | 394253 | 19894
|
||||||
|
|
||||||
- [x] Zero allocation router.
|
- [x] Zero allocation router.
|
||||||
- [x] Still the fastest http router and framework. From routing to writing.
|
- [x] Still the fastest http router and framework. From routing to writing.
|
||||||
- [x] Complete suite of unit tests
|
- [x] Complete suite of unit tests.
|
||||||
- [x] Battle tested
|
- [x] Battle tested.
|
||||||
- [x] API frozen, new releases will not break your code.
|
- [x] API frozen, new releases will not break your code.
|
||||||
|
|
||||||
## Build with [jsoniter](https://github.com/json-iterator/go)
|
## Build with [jsoniter](https://github.com/json-iterator/go)
|
||||||
|
@ -237,6 +243,13 @@ func main() {
|
||||||
c.FullPath() == "/user/:name/*action" // true
|
c.FullPath() == "/user/:name/*action" // true
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// This handler will add a new router for /user/groups.
|
||||||
|
// Exact routes are resolved before param routes, regardless of the order they were defined.
|
||||||
|
// Routes starting with /user/groups are never interpreted as /user/:name/... routes
|
||||||
|
router.GET("/user/groups", func(c *gin.Context) {
|
||||||
|
c.String(http.StatusOK, "The available groups are [...]", name)
|
||||||
|
})
|
||||||
|
|
||||||
router.Run(":8080")
|
router.Run(":8080")
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -334,7 +347,7 @@ func main() {
|
||||||
```
|
```
|
||||||
|
|
||||||
```
|
```
|
||||||
ids: map[b:hello a:1234], names: map[second:tianou first:thinkerou]
|
ids: map[b:hello a:1234]; names: map[second:tianou first:thinkerou]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Upload files
|
### Upload files
|
||||||
|
@ -351,14 +364,14 @@ References issue [#774](https://github.com/gin-gonic/gin/issues/774) and detail
|
||||||
func main() {
|
func main() {
|
||||||
router := gin.Default()
|
router := gin.Default()
|
||||||
// Set a lower memory limit for multipart forms (default is 32 MiB)
|
// Set a lower memory limit for multipart forms (default is 32 MiB)
|
||||||
// router.MaxMultipartMemory = 8 << 20 // 8 MiB
|
router.MaxMultipartMemory = 8 << 20 // 8 MiB
|
||||||
router.POST("/upload", func(c *gin.Context) {
|
router.POST("/upload", func(c *gin.Context) {
|
||||||
// single file
|
// single file
|
||||||
file, _ := c.FormFile("file")
|
file, _ := c.FormFile("file")
|
||||||
log.Println(file.Filename)
|
log.Println(file.Filename)
|
||||||
|
|
||||||
// Upload the file to specific dst.
|
// Upload the file to specific dst.
|
||||||
// c.SaveUploadedFile(file, dst)
|
c.SaveUploadedFile(file, dst)
|
||||||
|
|
||||||
c.String(http.StatusOK, fmt.Sprintf("'%s' uploaded!", file.Filename))
|
c.String(http.StatusOK, fmt.Sprintf("'%s' uploaded!", file.Filename))
|
||||||
})
|
})
|
||||||
|
@ -382,7 +395,7 @@ See the detail [example code](https://github.com/gin-gonic/examples/tree/master/
|
||||||
func main() {
|
func main() {
|
||||||
router := gin.Default()
|
router := gin.Default()
|
||||||
// Set a lower memory limit for multipart forms (default is 32 MiB)
|
// Set a lower memory limit for multipart forms (default is 32 MiB)
|
||||||
// router.MaxMultipartMemory = 8 << 20 // 8 MiB
|
router.MaxMultipartMemory = 8 << 20 // 8 MiB
|
||||||
router.POST("/upload", func(c *gin.Context) {
|
router.POST("/upload", func(c *gin.Context) {
|
||||||
// Multipart form
|
// Multipart form
|
||||||
form, _ := c.MultipartForm()
|
form, _ := c.MultipartForm()
|
||||||
|
@ -392,7 +405,7 @@ func main() {
|
||||||
log.Println(file.Filename)
|
log.Println(file.Filename)
|
||||||
|
|
||||||
// Upload the file to specific dst.
|
// Upload the file to specific dst.
|
||||||
// c.SaveUploadedFile(file, dst)
|
c.SaveUploadedFile(file, dst)
|
||||||
}
|
}
|
||||||
c.String(http.StatusOK, fmt.Sprintf("%d files uploaded!", len(files)))
|
c.String(http.StatusOK, fmt.Sprintf("%d files uploaded!", len(files)))
|
||||||
})
|
})
|
||||||
|
@ -490,6 +503,39 @@ func main() {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Custom Recovery behavior
|
||||||
|
```go
|
||||||
|
func main() {
|
||||||
|
// Creates a router without any middleware by default
|
||||||
|
r := gin.New()
|
||||||
|
|
||||||
|
// Global middleware
|
||||||
|
// Logger middleware will write the logs to gin.DefaultWriter even if you set with GIN_MODE=release.
|
||||||
|
// By default gin.DefaultWriter = os.Stdout
|
||||||
|
r.Use(gin.Logger())
|
||||||
|
|
||||||
|
// Recovery middleware recovers from any panics and writes a 500 if there was one.
|
||||||
|
r.Use(gin.CustomRecovery(func(c *gin.Context, recovered interface{}) {
|
||||||
|
if err, ok := recovered.(string); ok {
|
||||||
|
c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err))
|
||||||
|
}
|
||||||
|
c.AbortWithStatus(http.StatusInternalServerError)
|
||||||
|
}))
|
||||||
|
|
||||||
|
r.GET("/panic", func(c *gin.Context) {
|
||||||
|
// panic with a string -- the custom middleware could save this to a database or report it to the user
|
||||||
|
panic("foo")
|
||||||
|
})
|
||||||
|
|
||||||
|
r.GET("/", func(c *gin.Context) {
|
||||||
|
c.String(http.StatusOK, "ohai")
|
||||||
|
})
|
||||||
|
|
||||||
|
// Listen and serve on 0.0.0.0:8080
|
||||||
|
r.Run(":8080")
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
### How to write log file
|
### How to write log file
|
||||||
```go
|
```go
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -549,44 +595,44 @@ func main() {
|
||||||
::1 - [Fri, 07 Dec 2018 17:04:38 JST] "GET /ping HTTP/1.1 200 122.767µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.80 Safari/537.36" "
|
::1 - [Fri, 07 Dec 2018 17:04:38 JST] "GET /ping HTTP/1.1 200 122.767µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.80 Safari/537.36" "
|
||||||
```
|
```
|
||||||
|
|
||||||
### Controlling Log output coloring
|
### Controlling Log output coloring
|
||||||
|
|
||||||
By default, logs output on console should be colorized depending on the detected TTY.
|
By default, logs output on console should be colorized depending on the detected TTY.
|
||||||
|
|
||||||
Never colorize logs:
|
Never colorize logs:
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func main() {
|
func main() {
|
||||||
// Disable log's color
|
// Disable log's color
|
||||||
gin.DisableConsoleColor()
|
gin.DisableConsoleColor()
|
||||||
|
|
||||||
// Creates a gin router with default middleware:
|
// Creates a gin router with default middleware:
|
||||||
// logger and recovery (crash-free) middleware
|
// logger and recovery (crash-free) middleware
|
||||||
router := gin.Default()
|
router := gin.Default()
|
||||||
|
|
||||||
router.GET("/ping", func(c *gin.Context) {
|
router.GET("/ping", func(c *gin.Context) {
|
||||||
c.String(200, "pong")
|
c.String(200, "pong")
|
||||||
})
|
})
|
||||||
|
|
||||||
router.Run(":8080")
|
router.Run(":8080")
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Always colorize logs:
|
Always colorize logs:
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func main() {
|
func main() {
|
||||||
// Force log's color
|
// Force log's color
|
||||||
gin.ForceConsoleColor()
|
gin.ForceConsoleColor()
|
||||||
|
|
||||||
// Creates a gin router with default middleware:
|
// Creates a gin router with default middleware:
|
||||||
// logger and recovery (crash-free) middleware
|
// logger and recovery (crash-free) middleware
|
||||||
router := gin.Default()
|
router := gin.Default()
|
||||||
|
|
||||||
router.GET("/ping", func(c *gin.Context) {
|
router.GET("/ping", func(c *gin.Context) {
|
||||||
c.String(200, "pong")
|
c.String(200, "pong")
|
||||||
})
|
})
|
||||||
|
|
||||||
router.Run(":8080")
|
router.Run(":8080")
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -628,12 +674,12 @@ func main() {
|
||||||
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if json.User != "manu" || json.Password != "123" {
|
if json.User != "manu" || json.Password != "123" {
|
||||||
c.JSON(http.StatusUnauthorized, gin.H{"status": "unauthorized"})
|
c.JSON(http.StatusUnauthorized, gin.H{"status": "unauthorized"})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.JSON(http.StatusOK, gin.H{"status": "you are logged in"})
|
c.JSON(http.StatusOK, gin.H{"status": "you are logged in"})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -649,12 +695,12 @@ func main() {
|
||||||
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if xml.User != "manu" || xml.Password != "123" {
|
if xml.User != "manu" || xml.Password != "123" {
|
||||||
c.JSON(http.StatusUnauthorized, gin.H{"status": "unauthorized"})
|
c.JSON(http.StatusUnauthorized, gin.H{"status": "unauthorized"})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.JSON(http.StatusOK, gin.H{"status": "you are logged in"})
|
c.JSON(http.StatusOK, gin.H{"status": "you are logged in"})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -666,12 +712,12 @@ func main() {
|
||||||
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if form.User != "manu" || form.Password != "123" {
|
if form.User != "manu" || form.Password != "123" {
|
||||||
c.JSON(http.StatusUnauthorized, gin.H{"status": "unauthorized"})
|
c.JSON(http.StatusUnauthorized, gin.H{"status": "unauthorized"})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.JSON(http.StatusOK, gin.H{"status": "you are logged in"})
|
c.JSON(http.StatusOK, gin.H{"status": "you are logged in"})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -719,12 +765,12 @@ import (
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/gin-gonic/gin/binding"
|
"github.com/gin-gonic/gin/binding"
|
||||||
"gopkg.in/go-playground/validator.v10"
|
"github.com/go-playground/validator/v10"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Booking contains binded and validated data.
|
// Booking contains binded and validated data.
|
||||||
type Booking struct {
|
type Booking struct {
|
||||||
CheckIn time.Time `form:"check_in" binding:"required" time_format:"2006-01-02"`
|
CheckIn time.Time `form:"check_in" binding:"required,bookabledate" time_format:"2006-01-02"`
|
||||||
CheckOut time.Time `form:"check_out" binding:"required,gtfield=CheckIn" time_format:"2006-01-02"`
|
CheckOut time.Time `form:"check_out" binding:"required,gtfield=CheckIn" time_format:"2006-01-02"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -761,11 +807,14 @@ func getBookable(c *gin.Context) {
|
||||||
```
|
```
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ curl "localhost:8085/bookable?check_in=2018-04-16&check_out=2018-04-17"
|
$ curl "localhost:8085/bookable?check_in=2030-04-16&check_out=2030-04-17"
|
||||||
{"message":"Booking dates are valid!"}
|
{"message":"Booking dates are valid!"}
|
||||||
|
|
||||||
$ curl "localhost:8085/bookable?check_in=2018-03-10&check_out=2018-03-09"
|
$ curl "localhost:8085/bookable?check_in=2030-03-10&check_out=2030-03-09"
|
||||||
{"error":"Key: 'Booking.CheckOut' Error:Field validation for 'CheckOut' failed on the 'gtfield' tag"}
|
{"error":"Key: 'Booking.CheckOut' Error:Field validation for 'CheckOut' failed on the 'gtfield' tag"}
|
||||||
|
|
||||||
|
$ curl "localhost:8085/bookable?check_in=2000-03-09&check_out=2000-03-10"
|
||||||
|
{"error":"Key: 'Booking.CheckIn' Error:Field validation for 'CheckIn' failed on the 'bookabledate' tag"}%
|
||||||
```
|
```
|
||||||
|
|
||||||
[Struct level validations](https://github.com/go-playground/validator/releases/tag/v8.7) can also be registered this way.
|
[Struct level validations](https://github.com/go-playground/validator/releases/tag/v8.7) can also be registered this way.
|
||||||
|
@ -1103,7 +1152,7 @@ func main() {
|
||||||
data := gin.H{
|
data := gin.H{
|
||||||
"foo": "bar",
|
"foo": "bar",
|
||||||
}
|
}
|
||||||
|
|
||||||
//callback is x
|
//callback is x
|
||||||
// Will output : x({\"foo\":\"bar\"})
|
// Will output : x({\"foo\":\"bar\"})
|
||||||
c.JSONP(http.StatusOK, data)
|
c.JSONP(http.StatusOK, data)
|
||||||
|
@ -1148,21 +1197,21 @@ This feature is unavailable in Go 1.6 and lower.
|
||||||
```go
|
```go
|
||||||
func main() {
|
func main() {
|
||||||
r := gin.Default()
|
r := gin.Default()
|
||||||
|
|
||||||
// Serves unicode entities
|
// Serves unicode entities
|
||||||
r.GET("/json", func(c *gin.Context) {
|
r.GET("/json", func(c *gin.Context) {
|
||||||
c.JSON(200, gin.H{
|
c.JSON(200, gin.H{
|
||||||
"html": "<b>Hello, world!</b>",
|
"html": "<b>Hello, world!</b>",
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// Serves literal characters
|
// Serves literal characters
|
||||||
r.GET("/purejson", func(c *gin.Context) {
|
r.GET("/purejson", func(c *gin.Context) {
|
||||||
c.PureJSON(200, gin.H{
|
c.PureJSON(200, gin.H{
|
||||||
"html": "<b>Hello, world!</b>",
|
"html": "<b>Hello, world!</b>",
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// listen and serve on 0.0.0.0:8080
|
// listen and serve on 0.0.0.0:8080
|
||||||
r.Run(":8080")
|
r.Run(":8080")
|
||||||
}
|
}
|
||||||
|
@ -1213,6 +1262,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
reader := response.Body
|
reader := response.Body
|
||||||
|
defer reader.Close()
|
||||||
contentLength := response.ContentLength
|
contentLength := response.ContentLength
|
||||||
contentType := response.Header.Get("Content-Type")
|
contentType := response.Header.Get("Content-Type")
|
||||||
|
|
||||||
|
@ -1388,6 +1438,12 @@ r.GET("/test", func(c *gin.Context) {
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Issuing a HTTP redirect from POST. Refer to issue: [#444](https://github.com/gin-gonic/gin/issues/444)
|
||||||
|
```go
|
||||||
|
r.POST("/test", func(c *gin.Context) {
|
||||||
|
c.Redirect(http.StatusFound, "/foo")
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
Issuing a Router redirect, use `HandleContext` like below.
|
Issuing a Router redirect, use `HandleContext` like below.
|
||||||
|
|
||||||
|
@ -1744,8 +1800,8 @@ func main() {
|
||||||
// Initializing the server in a goroutine so that
|
// Initializing the server in a goroutine so that
|
||||||
// it won't block the graceful shutdown handling below
|
// it won't block the graceful shutdown handling below
|
||||||
go func() {
|
go func() {
|
||||||
if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
|
if err := srv.ListenAndServe(); err != nil && errors.Is(err, http.ErrServerClosed) {
|
||||||
log.Fatalf("listen: %s\n", err)
|
log.Printf("listen: %s\n", err)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -1757,16 +1813,17 @@ func main() {
|
||||||
// kill -9 is syscall.SIGKILL but can't be catch, so don't need add it
|
// kill -9 is syscall.SIGKILL but can't be catch, so don't need add it
|
||||||
signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
|
signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
|
||||||
<-quit
|
<-quit
|
||||||
log.Println("Shuting down server...")
|
log.Println("Shutting down server...")
|
||||||
|
|
||||||
// The context is used to inform the server it has 5 seconds to finish
|
// The context is used to inform the server it has 5 seconds to finish
|
||||||
// the request it is currently handling
|
// the request it is currently handling
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
if err := srv.Shutdown(ctx); err != nil {
|
if err := srv.Shutdown(ctx); err != nil {
|
||||||
log.Fatal("Server forced to shutdown:", err)
|
log.Fatal("Server forced to shutdown:", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Println("Server exiting")
|
log.Println("Server exiting")
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -2057,7 +2114,7 @@ func main() {
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cookie = "NotSet"
|
cookie = "NotSet"
|
||||||
c.SetCookie("gin_cookie", "test", 3600, "/", "localhost", http.SameSiteLaxMode, false, true)
|
c.SetCookie("gin_cookie", "test", 3600, "/", "localhost", false, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("Cookie value: %s \n", cookie)
|
fmt.Printf("Cookie value: %s \n", cookie)
|
||||||
|
@ -2067,6 +2124,39 @@ func main() {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Don't trust all proxies
|
||||||
|
|
||||||
|
Gin lets you specify which headers to hold the real client IP (if any),
|
||||||
|
as well as specifying which proxies (or direct clients) you trust to
|
||||||
|
specify one of these headers.
|
||||||
|
|
||||||
|
The `TrustedProxies` slice on your `gin.Engine` specifes network addresses or
|
||||||
|
network CIDRs from where clients which their request headers related to client
|
||||||
|
IP can be trusted. They can be IPv4 addresses, IPv4 CIDRs, IPv6 addresses or
|
||||||
|
IPv6 CIDRs.
|
||||||
|
|
||||||
|
```go
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
|
||||||
|
router := gin.Default()
|
||||||
|
router.TrustedProxies = []string{"192.168.1.2"}
|
||||||
|
|
||||||
|
router.GET("/", func(c *gin.Context) {
|
||||||
|
// If the client is 192.168.1.2, use the X-Forwarded-For
|
||||||
|
// header to deduce the original client IP from the trust-
|
||||||
|
// worthy parts of that header.
|
||||||
|
// Otherwise, simply return the direct client IP
|
||||||
|
fmt.Printf("ClientIP: %s\n", c.ClientIP())
|
||||||
|
})
|
||||||
|
router.Run()
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
|
|
8
vendor/github.com/gin-gonic/gin/auth.go
generated
vendored
8
vendor/github.com/gin-gonic/gin/auth.go
generated
vendored
|
@ -5,6 +5,7 @@
|
||||||
package gin
|
package gin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/subtle"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
@ -30,7 +31,7 @@ func (a authPairs) searchCredential(authValue string) (string, bool) {
|
||||||
return "", false
|
return "", false
|
||||||
}
|
}
|
||||||
for _, pair := range a {
|
for _, pair := range a {
|
||||||
if pair.value == authValue {
|
if subtle.ConstantTimeCompare([]byte(pair.value), []byte(authValue)) == 1 {
|
||||||
return pair.user, true
|
return pair.user, true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,8 +71,9 @@ func BasicAuth(accounts Accounts) HandlerFunc {
|
||||||
}
|
}
|
||||||
|
|
||||||
func processAccounts(accounts Accounts) authPairs {
|
func processAccounts(accounts Accounts) authPairs {
|
||||||
assert1(len(accounts) > 0, "Empty list of authorized credentials")
|
length := len(accounts)
|
||||||
pairs := make(authPairs, 0, len(accounts))
|
assert1(length > 0, "Empty list of authorized credentials")
|
||||||
|
pairs := make(authPairs, 0, length)
|
||||||
for user, password := range accounts {
|
for user, password := range accounts {
|
||||||
assert1(user != "", "User can not be empty")
|
assert1(user != "", "User can not be empty")
|
||||||
value := authorizationHeader(user, password)
|
value := authorizationHeader(user, password)
|
||||||
|
|
4
vendor/github.com/gin-gonic/gin/binding/binding.go
generated
vendored
4
vendor/github.com/gin-gonic/gin/binding/binding.go
generated
vendored
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT style
|
// Use of this source code is governed by a MIT style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !nomsgpack
|
||||||
// +build !nomsgpack
|
// +build !nomsgpack
|
||||||
|
|
||||||
package binding
|
package binding
|
||||||
|
@ -51,7 +52,8 @@ type BindingUri interface {
|
||||||
// https://github.com/go-playground/validator/tree/v8.18.2.
|
// https://github.com/go-playground/validator/tree/v8.18.2.
|
||||||
type StructValidator interface {
|
type StructValidator interface {
|
||||||
// ValidateStruct can receive any kind of type and it should never panic, even if the configuration is not right.
|
// ValidateStruct can receive any kind of type and it should never panic, even if the configuration is not right.
|
||||||
// If the received type is not a struct, any validation should be skipped and nil must be returned.
|
// If the received type is a slice|array, the validation should be performed travel on every element.
|
||||||
|
// If the received type is not a struct or slice|array, any validation should be skipped and nil must be returned.
|
||||||
// If the received type is a struct or pointer to a struct, the validation should be performed.
|
// If the received type is a struct or pointer to a struct, the validation should be performed.
|
||||||
// If the struct is not valid or the validation itself fails, a descriptive error should be returned.
|
// If the struct is not valid or the validation itself fails, a descriptive error should be returned.
|
||||||
// Otherwise nil must be returned.
|
// Otherwise nil must be returned.
|
||||||
|
|
1
vendor/github.com/gin-gonic/gin/binding/binding_nomsgpack.go
generated
vendored
1
vendor/github.com/gin-gonic/gin/binding/binding_nomsgpack.go
generated
vendored
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT style
|
// Use of this source code is governed by a MIT style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build nomsgpack
|
||||||
// +build nomsgpack
|
// +build nomsgpack
|
||||||
|
|
||||||
package binding
|
package binding
|
||||||
|
|
52
vendor/github.com/gin-gonic/gin/binding/default_validator.go
generated
vendored
52
vendor/github.com/gin-gonic/gin/binding/default_validator.go
generated
vendored
|
@ -5,7 +5,9 @@
|
||||||
package binding
|
package binding
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/go-playground/validator/v10"
|
"github.com/go-playground/validator/v10"
|
||||||
|
@ -16,22 +18,54 @@ type defaultValidator struct {
|
||||||
validate *validator.Validate
|
validate *validator.Validate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type sliceValidateError []error
|
||||||
|
|
||||||
|
func (err sliceValidateError) Error() string {
|
||||||
|
var errMsgs []string
|
||||||
|
for i, e := range err {
|
||||||
|
if e == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
errMsgs = append(errMsgs, fmt.Sprintf("[%d]: %s", i, e.Error()))
|
||||||
|
}
|
||||||
|
return strings.Join(errMsgs, "\n")
|
||||||
|
}
|
||||||
|
|
||||||
var _ StructValidator = &defaultValidator{}
|
var _ StructValidator = &defaultValidator{}
|
||||||
|
|
||||||
// ValidateStruct receives any kind of type, but only performed struct or pointer to struct type.
|
// ValidateStruct receives any kind of type, but only performed struct or pointer to struct type.
|
||||||
func (v *defaultValidator) ValidateStruct(obj interface{}) error {
|
func (v *defaultValidator) ValidateStruct(obj interface{}) error {
|
||||||
|
if obj == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
value := reflect.ValueOf(obj)
|
value := reflect.ValueOf(obj)
|
||||||
valueType := value.Kind()
|
switch value.Kind() {
|
||||||
if valueType == reflect.Ptr {
|
case reflect.Ptr:
|
||||||
valueType = value.Elem().Kind()
|
return v.ValidateStruct(value.Elem().Interface())
|
||||||
}
|
case reflect.Struct:
|
||||||
if valueType == reflect.Struct {
|
return v.validateStruct(obj)
|
||||||
v.lazyinit()
|
case reflect.Slice, reflect.Array:
|
||||||
if err := v.validate.Struct(obj); err != nil {
|
count := value.Len()
|
||||||
return err
|
validateRet := make(sliceValidateError, 0)
|
||||||
|
for i := 0; i < count; i++ {
|
||||||
|
if err := v.ValidateStruct(value.Index(i).Interface()); err != nil {
|
||||||
|
validateRet = append(validateRet, err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if len(validateRet) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return validateRet
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
return nil
|
}
|
||||||
|
|
||||||
|
// validateStruct receives struct type
|
||||||
|
func (v *defaultValidator) validateStruct(obj interface{}) error {
|
||||||
|
v.lazyinit()
|
||||||
|
return v.validate.Struct(obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Engine returns the underlying validator engine which powers the default
|
// Engine returns the underlying validator engine which powers the default
|
||||||
|
|
43
vendor/github.com/gin-gonic/gin/binding/form_mapping.go
generated
vendored
43
vendor/github.com/gin-gonic/gin/binding/form_mapping.go
generated
vendored
|
@ -29,6 +29,21 @@ func mapForm(ptr interface{}, form map[string][]string) error {
|
||||||
var emptyField = reflect.StructField{}
|
var emptyField = reflect.StructField{}
|
||||||
|
|
||||||
func mapFormByTag(ptr interface{}, form map[string][]string, tag string) error {
|
func mapFormByTag(ptr interface{}, form map[string][]string, tag string) error {
|
||||||
|
// Check if ptr is a map
|
||||||
|
ptrVal := reflect.ValueOf(ptr)
|
||||||
|
var pointed interface{}
|
||||||
|
if ptrVal.Kind() == reflect.Ptr {
|
||||||
|
ptrVal = ptrVal.Elem()
|
||||||
|
pointed = ptrVal.Interface()
|
||||||
|
}
|
||||||
|
if ptrVal.Kind() == reflect.Map &&
|
||||||
|
ptrVal.Type().Key().Kind() == reflect.String {
|
||||||
|
if pointed != nil {
|
||||||
|
ptr = pointed
|
||||||
|
}
|
||||||
|
return setFormMap(ptr, form)
|
||||||
|
}
|
||||||
|
|
||||||
return mappingByPtr(ptr, formSource(form), tag)
|
return mappingByPtr(ptr, formSource(form), tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,7 +285,7 @@ func setTimeField(val string, structField reflect.StructField, value reflect.Val
|
||||||
|
|
||||||
switch tf := strings.ToLower(timeFormat); tf {
|
switch tf := strings.ToLower(timeFormat); tf {
|
||||||
case "unix", "unixnano":
|
case "unix", "unixnano":
|
||||||
tv, err := strconv.ParseInt(val, 10, 0)
|
tv, err := strconv.ParseInt(val, 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -349,3 +364,29 @@ func head(str, sep string) (head string, tail string) {
|
||||||
}
|
}
|
||||||
return str[:idx], str[idx+len(sep):]
|
return str[:idx], str[idx+len(sep):]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func setFormMap(ptr interface{}, form map[string][]string) error {
|
||||||
|
el := reflect.TypeOf(ptr).Elem()
|
||||||
|
|
||||||
|
if el.Kind() == reflect.Slice {
|
||||||
|
ptrMap, ok := ptr.(map[string][]string)
|
||||||
|
if !ok {
|
||||||
|
return errors.New("cannot convert to map slices of strings")
|
||||||
|
}
|
||||||
|
for k, v := range form {
|
||||||
|
ptrMap[k] = v
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
ptrMap, ok := ptr.(map[string]string)
|
||||||
|
if !ok {
|
||||||
|
return errors.New("cannot convert to map of strings")
|
||||||
|
}
|
||||||
|
for k, v := range form {
|
||||||
|
ptrMap[k] = v[len(v)-1] // pick last
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
1
vendor/github.com/gin-gonic/gin/binding/msgpack.go
generated
vendored
1
vendor/github.com/gin-gonic/gin/binding/msgpack.go
generated
vendored
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT style
|
// Use of this source code is governed by a MIT style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !nomsgpack
|
||||||
// +build !nomsgpack
|
// +build !nomsgpack
|
||||||
|
|
||||||
package binding
|
package binding
|
||||||
|
|
132
vendor/github.com/gin-gonic/gin/context.go
generated
vendored
132
vendor/github.com/gin-gonic/gin/context.go
generated
vendored
|
@ -34,9 +34,11 @@ const (
|
||||||
MIMEPOSTForm = binding.MIMEPOSTForm
|
MIMEPOSTForm = binding.MIMEPOSTForm
|
||||||
MIMEMultipartPOSTForm = binding.MIMEMultipartPOSTForm
|
MIMEMultipartPOSTForm = binding.MIMEMultipartPOSTForm
|
||||||
MIMEYAML = binding.MIMEYAML
|
MIMEYAML = binding.MIMEYAML
|
||||||
BodyBytesKey = "_gin-gonic/gin/bodybyteskey"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// BodyBytesKey indicates a default body bytes key.
|
||||||
|
const BodyBytesKey = "_gin-gonic/gin/bodybyteskey"
|
||||||
|
|
||||||
const abortIndex int8 = math.MaxInt8 / 2
|
const abortIndex int8 = math.MaxInt8 / 2
|
||||||
|
|
||||||
// Context is the most important part of gin. It allows us to pass variables between middleware,
|
// Context is the most important part of gin. It allows us to pass variables between middleware,
|
||||||
|
@ -52,6 +54,7 @@ type Context struct {
|
||||||
fullPath string
|
fullPath string
|
||||||
|
|
||||||
engine *Engine
|
engine *Engine
|
||||||
|
params *Params
|
||||||
|
|
||||||
// This mutex protect Keys map
|
// This mutex protect Keys map
|
||||||
mu sync.RWMutex
|
mu sync.RWMutex
|
||||||
|
@ -93,6 +96,7 @@ func (c *Context) reset() {
|
||||||
c.Accepted = nil
|
c.Accepted = nil
|
||||||
c.queryCache = nil
|
c.queryCache = nil
|
||||||
c.formCache = nil
|
c.formCache = nil
|
||||||
|
*c.params = (*c.params)[0:0]
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy returns a copy of the current context that can be safely used outside the request's scope.
|
// Copy returns a copy of the current context that can be safely used outside the request's scope.
|
||||||
|
@ -291,6 +295,22 @@ func (c *Context) GetInt64(key string) (i64 int64) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetUint returns the value associated with the key as an unsigned integer.
|
||||||
|
func (c *Context) GetUint(key string) (ui uint) {
|
||||||
|
if val, ok := c.Get(key); ok && val != nil {
|
||||||
|
ui, _ = val.(uint)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetUint64 returns the value associated with the key as an unsigned integer.
|
||||||
|
func (c *Context) GetUint64(key string) (ui64 uint64) {
|
||||||
|
if val, ok := c.Get(key); ok && val != nil {
|
||||||
|
ui64, _ = val.(uint64)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// GetFloat64 returns the value associated with the key as a float64.
|
// GetFloat64 returns the value associated with the key as a float64.
|
||||||
func (c *Context) GetFloat64(key string) (f64 float64) {
|
func (c *Context) GetFloat64(key string) (f64 float64) {
|
||||||
if val, ok := c.Get(key); ok && val != nil {
|
if val, ok := c.Get(key); ok && val != nil {
|
||||||
|
@ -410,16 +430,20 @@ func (c *Context) QueryArray(key string) []string {
|
||||||
return values
|
return values
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Context) getQueryCache() {
|
func (c *Context) initQueryCache() {
|
||||||
if c.queryCache == nil {
|
if c.queryCache == nil {
|
||||||
c.queryCache = c.Request.URL.Query()
|
if c.Request != nil {
|
||||||
|
c.queryCache = c.Request.URL.Query()
|
||||||
|
} else {
|
||||||
|
c.queryCache = url.Values{}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetQueryArray returns a slice of strings for a given query key, plus
|
// GetQueryArray returns a slice of strings for a given query key, plus
|
||||||
// a boolean value whether at least one value exists for the given key.
|
// a boolean value whether at least one value exists for the given key.
|
||||||
func (c *Context) GetQueryArray(key string) ([]string, bool) {
|
func (c *Context) GetQueryArray(key string) ([]string, bool) {
|
||||||
c.getQueryCache()
|
c.initQueryCache()
|
||||||
if values, ok := c.queryCache[key]; ok && len(values) > 0 {
|
if values, ok := c.queryCache[key]; ok && len(values) > 0 {
|
||||||
return values, true
|
return values, true
|
||||||
}
|
}
|
||||||
|
@ -435,7 +459,7 @@ func (c *Context) QueryMap(key string) map[string]string {
|
||||||
// GetQueryMap returns a map for a given query key, plus a boolean value
|
// GetQueryMap returns a map for a given query key, plus a boolean value
|
||||||
// whether at least one value exists for the given key.
|
// whether at least one value exists for the given key.
|
||||||
func (c *Context) GetQueryMap(key string) (map[string]string, bool) {
|
func (c *Context) GetQueryMap(key string) (map[string]string, bool) {
|
||||||
c.getQueryCache()
|
c.initQueryCache()
|
||||||
return c.get(c.queryCache, key)
|
return c.get(c.queryCache, key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -477,7 +501,7 @@ func (c *Context) PostFormArray(key string) []string {
|
||||||
return values
|
return values
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Context) getFormCache() {
|
func (c *Context) initFormCache() {
|
||||||
if c.formCache == nil {
|
if c.formCache == nil {
|
||||||
c.formCache = make(url.Values)
|
c.formCache = make(url.Values)
|
||||||
req := c.Request
|
req := c.Request
|
||||||
|
@ -493,7 +517,7 @@ func (c *Context) getFormCache() {
|
||||||
// GetPostFormArray returns a slice of strings for a given form key, plus
|
// GetPostFormArray returns a slice of strings for a given form key, plus
|
||||||
// a boolean value whether at least one value exists for the given key.
|
// a boolean value whether at least one value exists for the given key.
|
||||||
func (c *Context) GetPostFormArray(key string) ([]string, bool) {
|
func (c *Context) GetPostFormArray(key string) ([]string, bool) {
|
||||||
c.getFormCache()
|
c.initFormCache()
|
||||||
if values := c.formCache[key]; len(values) > 0 {
|
if values := c.formCache[key]; len(values) > 0 {
|
||||||
return values, true
|
return values, true
|
||||||
}
|
}
|
||||||
|
@ -509,7 +533,7 @@ func (c *Context) PostFormMap(key string) map[string]string {
|
||||||
// GetPostFormMap returns a map for a given form key, plus a boolean value
|
// GetPostFormMap returns a map for a given form key, plus a boolean value
|
||||||
// whether at least one value exists for the given key.
|
// whether at least one value exists for the given key.
|
||||||
func (c *Context) GetPostFormMap(key string) (map[string]string, bool) {
|
func (c *Context) GetPostFormMap(key string) (map[string]string, bool) {
|
||||||
c.getFormCache()
|
c.initFormCache()
|
||||||
return c.get(c.formCache, key)
|
return c.get(c.formCache, key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -701,32 +725,80 @@ func (c *Context) ShouldBindBodyWith(obj interface{}, bb binding.BindingBody) (e
|
||||||
return bb.BindBody(body, obj)
|
return bb.BindBody(body, obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClientIP implements a best effort algorithm to return the real client IP, it parses
|
// ClientIP implements a best effort algorithm to return the real client IP.
|
||||||
// X-Real-IP and X-Forwarded-For in order to work properly with reverse-proxies such us: nginx or haproxy.
|
// It called c.RemoteIP() under the hood, to check if the remote IP is a trusted proxy or not.
|
||||||
// Use X-Forwarded-For before X-Real-Ip as nginx uses X-Real-Ip with the proxy's IP.
|
// If it's it will then try to parse the headers defined in Engine.RemoteIPHeaders (defaulting to [X-Forwarded-For, X-Real-Ip]).
|
||||||
|
// If the headers are nots syntactically valid OR the remote IP does not correspong to a trusted proxy,
|
||||||
|
// the remote IP (coming form Request.RemoteAddr) is returned.
|
||||||
func (c *Context) ClientIP() string {
|
func (c *Context) ClientIP() string {
|
||||||
if c.engine.ForwardedByClientIP {
|
|
||||||
clientIP := c.requestHeader("X-Forwarded-For")
|
|
||||||
clientIP = strings.TrimSpace(strings.Split(clientIP, ",")[0])
|
|
||||||
if clientIP == "" {
|
|
||||||
clientIP = strings.TrimSpace(c.requestHeader("X-Real-Ip"))
|
|
||||||
}
|
|
||||||
if clientIP != "" {
|
|
||||||
return clientIP
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if c.engine.AppEngine {
|
if c.engine.AppEngine {
|
||||||
if addr := c.requestHeader("X-Appengine-Remote-Addr"); addr != "" {
|
if addr := c.requestHeader("X-Appengine-Remote-Addr"); addr != "" {
|
||||||
return addr
|
return addr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ip, _, err := net.SplitHostPort(strings.TrimSpace(c.Request.RemoteAddr)); err == nil {
|
remoteIP, trusted := c.RemoteIP()
|
||||||
return ip
|
if remoteIP == nil {
|
||||||
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
return ""
|
if trusted && c.engine.ForwardedByClientIP && c.engine.RemoteIPHeaders != nil {
|
||||||
|
for _, headerName := range c.engine.RemoteIPHeaders {
|
||||||
|
ip, valid := validateHeader(c.requestHeader(headerName))
|
||||||
|
if valid {
|
||||||
|
return ip
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return remoteIP.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemoteIP parses the IP from Request.RemoteAddr, normalizes and returns the IP (without the port).
|
||||||
|
// It also checks if the remoteIP is a trusted proxy or not.
|
||||||
|
// In order to perform this validation, it will see if the IP is contained within at least one of the CIDR blocks
|
||||||
|
// defined in Engine.TrustedProxies
|
||||||
|
func (c *Context) RemoteIP() (net.IP, bool) {
|
||||||
|
ip, _, err := net.SplitHostPort(strings.TrimSpace(c.Request.RemoteAddr))
|
||||||
|
if err != nil {
|
||||||
|
return nil, false
|
||||||
|
}
|
||||||
|
remoteIP := net.ParseIP(ip)
|
||||||
|
if remoteIP == nil {
|
||||||
|
return nil, false
|
||||||
|
}
|
||||||
|
|
||||||
|
if c.engine.trustedCIDRs != nil {
|
||||||
|
for _, cidr := range c.engine.trustedCIDRs {
|
||||||
|
if cidr.Contains(remoteIP) {
|
||||||
|
return remoteIP, true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return remoteIP, false
|
||||||
|
}
|
||||||
|
|
||||||
|
func validateHeader(header string) (clientIP string, valid bool) {
|
||||||
|
if header == "" {
|
||||||
|
return "", false
|
||||||
|
}
|
||||||
|
items := strings.Split(header, ",")
|
||||||
|
for i, ipStr := range items {
|
||||||
|
ipStr = strings.TrimSpace(ipStr)
|
||||||
|
ip := net.ParseIP(ipStr)
|
||||||
|
if ip == nil {
|
||||||
|
return "", false
|
||||||
|
}
|
||||||
|
|
||||||
|
// We need to return the first IP in the list, but,
|
||||||
|
// we should not early return since we need to validate that
|
||||||
|
// the rest of the header is syntactically valid
|
||||||
|
if i == 0 {
|
||||||
|
clientIP = ipStr
|
||||||
|
valid = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContentType returns the Content-Type header of the request.
|
// ContentType returns the Content-Type header of the request.
|
||||||
|
@ -863,11 +935,11 @@ func (c *Context) IndentedJSON(code int, obj interface{}) {
|
||||||
// Default prepends "while(1)," to response body if the given struct is array values.
|
// Default prepends "while(1)," to response body if the given struct is array values.
|
||||||
// It also sets the Content-Type as "application/json".
|
// It also sets the Content-Type as "application/json".
|
||||||
func (c *Context) SecureJSON(code int, obj interface{}) {
|
func (c *Context) SecureJSON(code int, obj interface{}) {
|
||||||
c.Render(code, render.SecureJSON{Prefix: c.engine.secureJsonPrefix, Data: obj})
|
c.Render(code, render.SecureJSON{Prefix: c.engine.secureJSONPrefix, Data: obj})
|
||||||
}
|
}
|
||||||
|
|
||||||
// JSONP serializes the given struct as JSON into the response body.
|
// JSONP serializes the given struct as JSON into the response body.
|
||||||
// It add padding to response body to request data from a server residing in a different domain than the client.
|
// It adds padding to response body to request data from a server residing in a different domain than the client.
|
||||||
// It also sets the Content-Type as "application/javascript".
|
// It also sets the Content-Type as "application/javascript".
|
||||||
func (c *Context) JSONP(code int, obj interface{}) {
|
func (c *Context) JSONP(code int, obj interface{}) {
|
||||||
callback := c.DefaultQuery("callback", "")
|
callback := c.DefaultQuery("callback", "")
|
||||||
|
@ -944,12 +1016,12 @@ func (c *Context) DataFromReader(code int, contentLength int64, contentType stri
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// File writes the specified file into the body stream in a efficient way.
|
// File writes the specified file into the body stream in an efficient way.
|
||||||
func (c *Context) File(filepath string) {
|
func (c *Context) File(filepath string) {
|
||||||
http.ServeFile(c.Writer, c.Request, filepath)
|
http.ServeFile(c.Writer, c.Request, filepath)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FileFromFS writes the specified file from http.FileSytem into the body stream in an efficient way.
|
// FileFromFS writes the specified file from http.FileSystem into the body stream in an efficient way.
|
||||||
func (c *Context) FileFromFS(filepath string, fs http.FileSystem) {
|
func (c *Context) FileFromFS(filepath string, fs http.FileSystem) {
|
||||||
defer func(old string) {
|
defer func(old string) {
|
||||||
c.Request.URL.Path = old
|
c.Request.URL.Path = old
|
||||||
|
@ -963,7 +1035,7 @@ func (c *Context) FileFromFS(filepath string, fs http.FileSystem) {
|
||||||
// FileAttachment writes the specified file into the body stream in an efficient way
|
// FileAttachment writes the specified file into the body stream in an efficient way
|
||||||
// On the client side, the file will typically be downloaded with the given filename
|
// On the client side, the file will typically be downloaded with the given filename
|
||||||
func (c *Context) FileAttachment(filepath, filename string) {
|
func (c *Context) FileAttachment(filepath, filename string) {
|
||||||
c.Writer.Header().Set("content-disposition", fmt.Sprintf("attachment; filename=\"%s\"", filename))
|
c.Writer.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=\"%s\"", filename))
|
||||||
http.ServeFile(c.Writer, c.Request, filepath)
|
http.ServeFile(c.Writer, c.Request, filepath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
5
vendor/github.com/gin-gonic/gin/context_appengine.go
generated
vendored
5
vendor/github.com/gin-gonic/gin/context_appengine.go
generated
vendored
|
@ -1,9 +1,10 @@
|
||||||
// +build appengine
|
|
||||||
|
|
||||||
// Copyright 2017 Manu Martinez-Almeida. All rights reserved.
|
// Copyright 2017 Manu Martinez-Almeida. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT style
|
// Use of this source code is governed by a MIT style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build appengine
|
||||||
|
// +build appengine
|
||||||
|
|
||||||
package gin
|
package gin
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
4
vendor/github.com/gin-gonic/gin/debug.go
generated
vendored
4
vendor/github.com/gin-gonic/gin/debug.go
generated
vendored
|
@ -12,7 +12,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
const ginSupportMinGoVer = 10
|
const ginSupportMinGoVer = 12
|
||||||
|
|
||||||
// IsDebugging returns true if the framework is running in debug mode.
|
// IsDebugging returns true if the framework is running in debug mode.
|
||||||
// Use SetMode(gin.ReleaseMode) to disable debug mode.
|
// Use SetMode(gin.ReleaseMode) to disable debug mode.
|
||||||
|
@ -67,7 +67,7 @@ func getMinVer(v string) (uint64, error) {
|
||||||
|
|
||||||
func debugPrintWARNINGDefault() {
|
func debugPrintWARNINGDefault() {
|
||||||
if v, e := getMinVer(runtime.Version()); e == nil && v <= ginSupportMinGoVer {
|
if v, e := getMinVer(runtime.Version()); e == nil && v <= ginSupportMinGoVer {
|
||||||
debugPrint(`[WARNING] Now Gin requires Go 1.11 or later and Go 1.12 will be required soon.
|
debugPrint(`[WARNING] Now Gin requires Go 1.12+.
|
||||||
|
|
||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
|
25
vendor/github.com/gin-gonic/gin/errors.go
generated
vendored
25
vendor/github.com/gin-gonic/gin/errors.go
generated
vendored
|
@ -55,7 +55,7 @@ func (msg *Error) SetMeta(data interface{}) *Error {
|
||||||
|
|
||||||
// JSON creates a properly formatted JSON
|
// JSON creates a properly formatted JSON
|
||||||
func (msg *Error) JSON() interface{} {
|
func (msg *Error) JSON() interface{} {
|
||||||
json := H{}
|
jsonData := H{}
|
||||||
if msg.Meta != nil {
|
if msg.Meta != nil {
|
||||||
value := reflect.ValueOf(msg.Meta)
|
value := reflect.ValueOf(msg.Meta)
|
||||||
switch value.Kind() {
|
switch value.Kind() {
|
||||||
|
@ -63,16 +63,16 @@ func (msg *Error) JSON() interface{} {
|
||||||
return msg.Meta
|
return msg.Meta
|
||||||
case reflect.Map:
|
case reflect.Map:
|
||||||
for _, key := range value.MapKeys() {
|
for _, key := range value.MapKeys() {
|
||||||
json[key.String()] = value.MapIndex(key).Interface()
|
jsonData[key.String()] = value.MapIndex(key).Interface()
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
json["meta"] = msg.Meta
|
jsonData["meta"] = msg.Meta
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if _, ok := json["error"]; !ok {
|
if _, ok := jsonData["error"]; !ok {
|
||||||
json["error"] = msg.Error()
|
jsonData["error"] = msg.Error()
|
||||||
}
|
}
|
||||||
return json
|
return jsonData
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalJSON implements the json.Marshaller interface.
|
// MarshalJSON implements the json.Marshaller interface.
|
||||||
|
@ -90,6 +90,11 @@ func (msg *Error) IsType(flags ErrorType) bool {
|
||||||
return (msg.Type & flags) > 0
|
return (msg.Type & flags) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Unwrap returns the wrapped error, to allow interoperability with errors.Is(), errors.As() and errors.Unwrap()
|
||||||
|
func (msg *Error) Unwrap() error {
|
||||||
|
return msg.Err
|
||||||
|
}
|
||||||
|
|
||||||
// ByType returns a readonly copy filtered the byte.
|
// ByType returns a readonly copy filtered the byte.
|
||||||
// ie ByType(gin.ErrorTypePublic) returns a slice of errors with type=ErrorTypePublic.
|
// ie ByType(gin.ErrorTypePublic) returns a slice of errors with type=ErrorTypePublic.
|
||||||
func (a errorMsgs) ByType(typ ErrorType) errorMsgs {
|
func (a errorMsgs) ByType(typ ErrorType) errorMsgs {
|
||||||
|
@ -135,17 +140,17 @@ func (a errorMsgs) Errors() []string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a errorMsgs) JSON() interface{} {
|
func (a errorMsgs) JSON() interface{} {
|
||||||
switch len(a) {
|
switch length := len(a); length {
|
||||||
case 0:
|
case 0:
|
||||||
return nil
|
return nil
|
||||||
case 1:
|
case 1:
|
||||||
return a.Last().JSON()
|
return a.Last().JSON()
|
||||||
default:
|
default:
|
||||||
json := make([]interface{}, len(a))
|
jsonData := make([]interface{}, length)
|
||||||
for i, err := range a {
|
for i, err := range a {
|
||||||
json[i] = err.JSON()
|
jsonData[i] = err.JSON()
|
||||||
}
|
}
|
||||||
return json
|
return jsonData
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
6
vendor/github.com/gin-gonic/gin/fs.go
generated
vendored
6
vendor/github.com/gin-gonic/gin/fs.go
generated
vendored
|
@ -9,7 +9,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
type onlyfilesFS struct {
|
type onlyFilesFS struct {
|
||||||
fs http.FileSystem
|
fs http.FileSystem
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,11 +26,11 @@ func Dir(root string, listDirectory bool) http.FileSystem {
|
||||||
if listDirectory {
|
if listDirectory {
|
||||||
return fs
|
return fs
|
||||||
}
|
}
|
||||||
return &onlyfilesFS{fs}
|
return &onlyFilesFS{fs}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open conforms to http.Filesystem.
|
// Open conforms to http.Filesystem.
|
||||||
func (fs onlyfilesFS) Open(name string) (http.File, error) {
|
func (fs onlyFilesFS) Open(name string) (http.File, error) {
|
||||||
f, err := fs.fs.Open(name)
|
f, err := fs.fs.Open(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
104
vendor/github.com/gin-gonic/gin/gin.go
generated
vendored
104
vendor/github.com/gin-gonic/gin/gin.go
generated
vendored
|
@ -11,6 +11,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin/internal/bytesconv"
|
"github.com/gin-gonic/gin/internal/bytesconv"
|
||||||
|
@ -20,11 +21,12 @@ import (
|
||||||
const defaultMultipartMemory = 32 << 20 // 32 MB
|
const defaultMultipartMemory = 32 << 20 // 32 MB
|
||||||
|
|
||||||
var (
|
var (
|
||||||
default404Body = []byte("404 page not found")
|
default404Body = []byte("404 page not found")
|
||||||
default405Body = []byte("405 method not allowed")
|
default405Body = []byte("405 method not allowed")
|
||||||
defaultAppEngine bool
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var defaultAppEngine bool
|
||||||
|
|
||||||
// HandlerFunc defines the handler used by gin middleware as return value.
|
// HandlerFunc defines the handler used by gin middleware as return value.
|
||||||
type HandlerFunc func(*Context)
|
type HandlerFunc func(*Context)
|
||||||
|
|
||||||
|
@ -80,9 +82,26 @@ type Engine struct {
|
||||||
// If no other Method is allowed, the request is delegated to the NotFound
|
// If no other Method is allowed, the request is delegated to the NotFound
|
||||||
// handler.
|
// handler.
|
||||||
HandleMethodNotAllowed bool
|
HandleMethodNotAllowed bool
|
||||||
ForwardedByClientIP bool
|
|
||||||
|
|
||||||
// #726 #755 If enabled, it will thrust some headers starting with
|
// If enabled, client IP will be parsed from the request's headers that
|
||||||
|
// match those stored at `(*gin.Engine).RemoteIPHeaders`. If no IP was
|
||||||
|
// fetched, it falls back to the IP obtained from
|
||||||
|
// `(*gin.Context).Request.RemoteAddr`.
|
||||||
|
ForwardedByClientIP bool
|
||||||
|
|
||||||
|
// List of headers used to obtain the client IP when
|
||||||
|
// `(*gin.Engine).ForwardedByClientIP` is `true` and
|
||||||
|
// `(*gin.Context).Request.RemoteAddr` is matched by at least one of the
|
||||||
|
// network origins of `(*gin.Engine).TrustedProxies`.
|
||||||
|
RemoteIPHeaders []string
|
||||||
|
|
||||||
|
// List of network origins (IPv4 addresses, IPv4 CIDRs, IPv6 addresses or
|
||||||
|
// IPv6 CIDRs) from which to trust request's headers that contain
|
||||||
|
// alternative client IP when `(*gin.Engine).ForwardedByClientIP` is
|
||||||
|
// `true`.
|
||||||
|
TrustedProxies []string
|
||||||
|
|
||||||
|
// #726 #755 If enabled, it will trust some headers starting with
|
||||||
// 'X-AppEngine...' for better integration with that PaaS.
|
// 'X-AppEngine...' for better integration with that PaaS.
|
||||||
AppEngine bool
|
AppEngine bool
|
||||||
|
|
||||||
|
@ -103,7 +122,7 @@ type Engine struct {
|
||||||
RemoveExtraSlash bool
|
RemoveExtraSlash bool
|
||||||
|
|
||||||
delims render.Delims
|
delims render.Delims
|
||||||
secureJsonPrefix string
|
secureJSONPrefix string
|
||||||
HTMLRender render.HTMLRender
|
HTMLRender render.HTMLRender
|
||||||
FuncMap template.FuncMap
|
FuncMap template.FuncMap
|
||||||
allNoRoute HandlersChain
|
allNoRoute HandlersChain
|
||||||
|
@ -112,6 +131,8 @@ type Engine struct {
|
||||||
noMethod HandlersChain
|
noMethod HandlersChain
|
||||||
pool sync.Pool
|
pool sync.Pool
|
||||||
trees methodTrees
|
trees methodTrees
|
||||||
|
maxParams uint16
|
||||||
|
trustedCIDRs []*net.IPNet
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ IRouter = &Engine{}
|
var _ IRouter = &Engine{}
|
||||||
|
@ -137,6 +158,8 @@ func New() *Engine {
|
||||||
RedirectFixedPath: false,
|
RedirectFixedPath: false,
|
||||||
HandleMethodNotAllowed: false,
|
HandleMethodNotAllowed: false,
|
||||||
ForwardedByClientIP: true,
|
ForwardedByClientIP: true,
|
||||||
|
RemoteIPHeaders: []string{"X-Forwarded-For", "X-Real-IP"},
|
||||||
|
TrustedProxies: []string{"0.0.0.0/0"},
|
||||||
AppEngine: defaultAppEngine,
|
AppEngine: defaultAppEngine,
|
||||||
UseRawPath: false,
|
UseRawPath: false,
|
||||||
RemoveExtraSlash: false,
|
RemoveExtraSlash: false,
|
||||||
|
@ -144,7 +167,7 @@ func New() *Engine {
|
||||||
MaxMultipartMemory: defaultMultipartMemory,
|
MaxMultipartMemory: defaultMultipartMemory,
|
||||||
trees: make(methodTrees, 0, 9),
|
trees: make(methodTrees, 0, 9),
|
||||||
delims: render.Delims{Left: "{{", Right: "}}"},
|
delims: render.Delims{Left: "{{", Right: "}}"},
|
||||||
secureJsonPrefix: "while(1);",
|
secureJSONPrefix: "while(1);",
|
||||||
}
|
}
|
||||||
engine.RouterGroup.engine = engine
|
engine.RouterGroup.engine = engine
|
||||||
engine.pool.New = func() interface{} {
|
engine.pool.New = func() interface{} {
|
||||||
|
@ -162,7 +185,8 @@ func Default() *Engine {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (engine *Engine) allocateContext() *Context {
|
func (engine *Engine) allocateContext() *Context {
|
||||||
return &Context{engine: engine}
|
v := make(Params, 0, engine.maxParams)
|
||||||
|
return &Context{engine: engine, params: &v}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delims sets template left and right delims and returns a Engine instance.
|
// Delims sets template left and right delims and returns a Engine instance.
|
||||||
|
@ -171,9 +195,9 @@ func (engine *Engine) Delims(left, right string) *Engine {
|
||||||
return engine
|
return engine
|
||||||
}
|
}
|
||||||
|
|
||||||
// SecureJsonPrefix sets the secureJsonPrefix used in Context.SecureJSON.
|
// SecureJsonPrefix sets the secureJSONPrefix used in Context.SecureJSON.
|
||||||
func (engine *Engine) SecureJsonPrefix(prefix string) *Engine {
|
func (engine *Engine) SecureJsonPrefix(prefix string) *Engine {
|
||||||
engine.secureJsonPrefix = prefix
|
engine.secureJSONPrefix = prefix
|
||||||
return engine
|
return engine
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,6 +279,7 @@ func (engine *Engine) addRoute(method, path string, handlers HandlersChain) {
|
||||||
assert1(len(handlers) > 0, "there must be at least one handler")
|
assert1(len(handlers) > 0, "there must be at least one handler")
|
||||||
|
|
||||||
debugPrintRoute(method, path, handlers)
|
debugPrintRoute(method, path, handlers)
|
||||||
|
|
||||||
root := engine.trees.get(method)
|
root := engine.trees.get(method)
|
||||||
if root == nil {
|
if root == nil {
|
||||||
root = new(node)
|
root = new(node)
|
||||||
|
@ -262,6 +287,11 @@ func (engine *Engine) addRoute(method, path string, handlers HandlersChain) {
|
||||||
engine.trees = append(engine.trees, methodTree{method: method, root: root})
|
engine.trees = append(engine.trees, methodTree{method: method, root: root})
|
||||||
}
|
}
|
||||||
root.addRoute(path, handlers)
|
root.addRoute(path, handlers)
|
||||||
|
|
||||||
|
// Update maxParams
|
||||||
|
if paramsCount := countParams(path); paramsCount > engine.maxParams {
|
||||||
|
engine.maxParams = paramsCount
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Routes returns a slice of registered routes, including some useful information, such as:
|
// Routes returns a slice of registered routes, including some useful information, such as:
|
||||||
|
@ -296,12 +326,60 @@ func iterate(path, method string, routes RoutesInfo, root *node) RoutesInfo {
|
||||||
func (engine *Engine) Run(addr ...string) (err error) {
|
func (engine *Engine) Run(addr ...string) (err error) {
|
||||||
defer func() { debugPrintError(err) }()
|
defer func() { debugPrintError(err) }()
|
||||||
|
|
||||||
|
trustedCIDRs, err := engine.prepareTrustedCIDRs()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
engine.trustedCIDRs = trustedCIDRs
|
||||||
address := resolveAddress(addr)
|
address := resolveAddress(addr)
|
||||||
debugPrint("Listening and serving HTTP on %s\n", address)
|
debugPrint("Listening and serving HTTP on %s\n", address)
|
||||||
err = http.ListenAndServe(address, engine)
|
err = http.ListenAndServe(address, engine)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (engine *Engine) prepareTrustedCIDRs() ([]*net.IPNet, error) {
|
||||||
|
if engine.TrustedProxies == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
cidr := make([]*net.IPNet, 0, len(engine.TrustedProxies))
|
||||||
|
for _, trustedProxy := range engine.TrustedProxies {
|
||||||
|
if !strings.Contains(trustedProxy, "/") {
|
||||||
|
ip := parseIP(trustedProxy)
|
||||||
|
if ip == nil {
|
||||||
|
return cidr, &net.ParseError{Type: "IP address", Text: trustedProxy}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch len(ip) {
|
||||||
|
case net.IPv4len:
|
||||||
|
trustedProxy += "/32"
|
||||||
|
case net.IPv6len:
|
||||||
|
trustedProxy += "/128"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_, cidrNet, err := net.ParseCIDR(trustedProxy)
|
||||||
|
if err != nil {
|
||||||
|
return cidr, err
|
||||||
|
}
|
||||||
|
cidr = append(cidr, cidrNet)
|
||||||
|
}
|
||||||
|
return cidr, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// parseIP parse a string representation of an IP and returns a net.IP with the
|
||||||
|
// minimum byte representation or nil if input is invalid.
|
||||||
|
func parseIP(ip string) net.IP {
|
||||||
|
parsedIP := net.ParseIP(ip)
|
||||||
|
|
||||||
|
if ipv4 := parsedIP.To4(); ipv4 != nil {
|
||||||
|
// return ip in a 4-byte representation
|
||||||
|
return ipv4
|
||||||
|
}
|
||||||
|
|
||||||
|
// return ip in a 16-byte representation or nil
|
||||||
|
return parsedIP
|
||||||
|
}
|
||||||
|
|
||||||
// RunTLS attaches the router to a http.Server and starts listening and serving HTTPS (secure) requests.
|
// RunTLS attaches the router to a http.Server and starts listening and serving HTTPS (secure) requests.
|
||||||
// It is a shortcut for http.ListenAndServeTLS(addr, certFile, keyFile, router)
|
// It is a shortcut for http.ListenAndServeTLS(addr, certFile, keyFile, router)
|
||||||
// Note: this method will block the calling goroutine indefinitely unless an error happens.
|
// Note: this method will block the calling goroutine indefinitely unless an error happens.
|
||||||
|
@ -401,10 +479,12 @@ func (engine *Engine) handleHTTPRequest(c *Context) {
|
||||||
}
|
}
|
||||||
root := t[i].root
|
root := t[i].root
|
||||||
// Find route in tree
|
// Find route in tree
|
||||||
value := root.getValue(rPath, c.Params, unescape)
|
value := root.getValue(rPath, c.params, unescape)
|
||||||
|
if value.params != nil {
|
||||||
|
c.Params = *value.params
|
||||||
|
}
|
||||||
if value.handlers != nil {
|
if value.handlers != nil {
|
||||||
c.handlers = value.handlers
|
c.handlers = value.handlers
|
||||||
c.Params = value.params
|
|
||||||
c.fullPath = value.fullPath
|
c.fullPath = value.fullPath
|
||||||
c.Next()
|
c.Next()
|
||||||
c.writermem.WriteHeaderNow()
|
c.writermem.WriteHeaderNow()
|
||||||
|
|
2
vendor/github.com/gin-gonic/gin/go.mod
generated
vendored
2
vendor/github.com/gin-gonic/gin/go.mod
generated
vendored
|
@ -4,7 +4,7 @@ go 1.13
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/gin-contrib/sse v0.1.0
|
github.com/gin-contrib/sse v0.1.0
|
||||||
github.com/go-playground/validator/v10 v10.2.0
|
github.com/go-playground/validator/v10 v10.4.1
|
||||||
github.com/golang/protobuf v1.3.3
|
github.com/golang/protobuf v1.3.3
|
||||||
github.com/json-iterator/go v1.1.9
|
github.com/json-iterator/go v1.1.9
|
||||||
github.com/mattn/go-isatty v0.0.12
|
github.com/mattn/go-isatty v0.0.12
|
||||||
|
|
11
vendor/github.com/gin-gonic/gin/go.sum
generated
vendored
11
vendor/github.com/gin-gonic/gin/go.sum
generated
vendored
|
@ -9,8 +9,8 @@ github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8c
|
||||||
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
|
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
|
||||||
github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no=
|
github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no=
|
||||||
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
|
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
|
||||||
github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1Vv0sFl1UcHBOY=
|
github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE=
|
||||||
github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI=
|
github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4=
|
||||||
github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I=
|
github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I=
|
||||||
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
|
@ -34,8 +34,15 @@ github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=
|
||||||
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
|
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
|
||||||
github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=
|
github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=
|
||||||
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
|
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
|
||||||
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
|
||||||
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
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-20200116001909-b77594299b42 h1:vEOn+mP2zCOVzKckCZy6YsCtDblrpj/w7B9nxGNELpg=
|
golang.org/x/sys v0.0.0-20200116001909-b77594299b42 h1:vEOn+mP2zCOVzKckCZy6YsCtDblrpj/w7B9nxGNELpg=
|
||||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
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.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||||
|
|
17
vendor/github.com/gin-gonic/gin/internal/bytesconv/bytesconv.go
generated
vendored
17
vendor/github.com/gin-gonic/gin/internal/bytesconv/bytesconv.go
generated
vendored
|
@ -1,16 +1,21 @@
|
||||||
|
// Copyright 2020 Gin Core Team. All rights reserved.
|
||||||
|
// Use of this source code is governed by a MIT style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
package bytesconv
|
package bytesconv
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"reflect"
|
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
// StringToBytes converts string to byte slice without a memory allocation.
|
// StringToBytes converts string to byte slice without a memory allocation.
|
||||||
func StringToBytes(s string) (b []byte) {
|
func StringToBytes(s string) []byte {
|
||||||
sh := *(*reflect.StringHeader)(unsafe.Pointer(&s))
|
return *(*[]byte)(unsafe.Pointer(
|
||||||
bh := (*reflect.SliceHeader)(unsafe.Pointer(&b))
|
&struct {
|
||||||
bh.Data, bh.Len, bh.Cap = sh.Data, sh.Len, sh.Len
|
string
|
||||||
return b
|
Cap int
|
||||||
|
}{s, len(s)},
|
||||||
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
// BytesToString converts byte slice to string without a memory allocation.
|
// BytesToString converts byte slice to string without a memory allocation.
|
||||||
|
|
1
vendor/github.com/gin-gonic/gin/internal/json/json.go
generated
vendored
1
vendor/github.com/gin-gonic/gin/internal/json/json.go
generated
vendored
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT style
|
// Use of this source code is governed by a MIT style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !jsoniter
|
||||||
// +build !jsoniter
|
// +build !jsoniter
|
||||||
|
|
||||||
package json
|
package json
|
||||||
|
|
3
vendor/github.com/gin-gonic/gin/internal/json/jsoniter.go
generated
vendored
3
vendor/github.com/gin-gonic/gin/internal/json/jsoniter.go
generated
vendored
|
@ -2,11 +2,12 @@
|
||||||
// Use of this source code is governed by a MIT style
|
// Use of this source code is governed by a MIT style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build jsoniter
|
||||||
// +build jsoniter
|
// +build jsoniter
|
||||||
|
|
||||||
package json
|
package json
|
||||||
|
|
||||||
import "github.com/json-iterator/go"
|
import jsoniter "github.com/json-iterator/go"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
json = jsoniter.ConfigCompatibleWithStandardLibrary
|
json = jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
|
|
13
vendor/github.com/gin-gonic/gin/mode.go
generated
vendored
13
vendor/github.com/gin-gonic/gin/mode.go
generated
vendored
|
@ -22,6 +22,7 @@ const (
|
||||||
// TestMode indicates gin mode is test.
|
// TestMode indicates gin mode is test.
|
||||||
TestMode = "test"
|
TestMode = "test"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
debugCode = iota
|
debugCode = iota
|
||||||
releaseCode
|
releaseCode
|
||||||
|
@ -50,19 +51,21 @@ func init() {
|
||||||
|
|
||||||
// SetMode sets gin mode according to input string.
|
// SetMode sets gin mode according to input string.
|
||||||
func SetMode(value string) {
|
func SetMode(value string) {
|
||||||
|
if value == "" {
|
||||||
|
value = DebugMode
|
||||||
|
}
|
||||||
|
|
||||||
switch value {
|
switch value {
|
||||||
case DebugMode, "":
|
case DebugMode:
|
||||||
ginMode = debugCode
|
ginMode = debugCode
|
||||||
case ReleaseMode:
|
case ReleaseMode:
|
||||||
ginMode = releaseCode
|
ginMode = releaseCode
|
||||||
case TestMode:
|
case TestMode:
|
||||||
ginMode = testCode
|
ginMode = testCode
|
||||||
default:
|
default:
|
||||||
panic("gin mode unknown: " + value)
|
panic("gin mode unknown: " + value + " (available mode: debug release test)")
|
||||||
}
|
|
||||||
if value == "" {
|
|
||||||
value = DebugMode
|
|
||||||
}
|
}
|
||||||
|
|
||||||
modeName = value
|
modeName = value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
7
vendor/github.com/gin-gonic/gin/path.go
generated
vendored
7
vendor/github.com/gin-gonic/gin/path.go
generated
vendored
|
@ -136,10 +136,11 @@ func bufApp(buf *[]byte, s string, w int, c byte) {
|
||||||
|
|
||||||
// Otherwise use either the stack buffer, if it is large enough, or
|
// Otherwise use either the stack buffer, if it is large enough, or
|
||||||
// allocate a new buffer on the heap, and copy all previous characters.
|
// allocate a new buffer on the heap, and copy all previous characters.
|
||||||
if l := len(s); l > cap(b) {
|
length := len(s)
|
||||||
*buf = make([]byte, len(s))
|
if length > cap(b) {
|
||||||
|
*buf = make([]byte, length)
|
||||||
} else {
|
} else {
|
||||||
*buf = (*buf)[:l]
|
*buf = (*buf)[:length]
|
||||||
}
|
}
|
||||||
b = *buf
|
b = *buf
|
||||||
|
|
||||||
|
|
34
vendor/github.com/gin-gonic/gin/recovery.go
generated
vendored
34
vendor/github.com/gin-gonic/gin/recovery.go
generated
vendored
|
@ -26,13 +26,29 @@ var (
|
||||||
slash = []byte("/")
|
slash = []byte("/")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// RecoveryFunc defines the function passable to CustomRecovery.
|
||||||
|
type RecoveryFunc func(c *Context, err interface{})
|
||||||
|
|
||||||
// Recovery returns a middleware that recovers from any panics and writes a 500 if there was one.
|
// Recovery returns a middleware that recovers from any panics and writes a 500 if there was one.
|
||||||
func Recovery() HandlerFunc {
|
func Recovery() HandlerFunc {
|
||||||
return RecoveryWithWriter(DefaultErrorWriter)
|
return RecoveryWithWriter(DefaultErrorWriter)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//CustomRecovery returns a middleware that recovers from any panics and calls the provided handle func to handle it.
|
||||||
|
func CustomRecovery(handle RecoveryFunc) HandlerFunc {
|
||||||
|
return RecoveryWithWriter(DefaultErrorWriter, handle)
|
||||||
|
}
|
||||||
|
|
||||||
// RecoveryWithWriter returns a middleware for a given writer that recovers from any panics and writes a 500 if there was one.
|
// RecoveryWithWriter returns a middleware for a given writer that recovers from any panics and writes a 500 if there was one.
|
||||||
func RecoveryWithWriter(out io.Writer) HandlerFunc {
|
func RecoveryWithWriter(out io.Writer, recovery ...RecoveryFunc) HandlerFunc {
|
||||||
|
if len(recovery) > 0 {
|
||||||
|
return CustomRecoveryWithWriter(out, recovery[0])
|
||||||
|
}
|
||||||
|
return CustomRecoveryWithWriter(out, defaultHandleRecovery)
|
||||||
|
}
|
||||||
|
|
||||||
|
// CustomRecoveryWithWriter returns a middleware for a given writer that recovers from any panics and calls the provided handle func to handle it.
|
||||||
|
func CustomRecoveryWithWriter(out io.Writer, handle RecoveryFunc) HandlerFunc {
|
||||||
var logger *log.Logger
|
var logger *log.Logger
|
||||||
if out != nil {
|
if out != nil {
|
||||||
logger = log.New(out, "\n\n\x1b[31m", log.LstdFlags)
|
logger = log.New(out, "\n\n\x1b[31m", log.LstdFlags)
|
||||||
|
@ -60,23 +76,23 @@ func RecoveryWithWriter(out io.Writer) HandlerFunc {
|
||||||
headers[idx] = current[0] + ": *"
|
headers[idx] = current[0] + ": *"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
headersToStr := strings.Join(headers, "\r\n")
|
||||||
if brokenPipe {
|
if brokenPipe {
|
||||||
logger.Printf("%s\n%s%s", err, string(httpRequest), reset)
|
logger.Printf("%s\n%s%s", err, headersToStr, reset)
|
||||||
} else if IsDebugging() {
|
} else if IsDebugging() {
|
||||||
logger.Printf("[Recovery] %s panic recovered:\n%s\n%s\n%s%s",
|
logger.Printf("[Recovery] %s panic recovered:\n%s\n%s\n%s%s",
|
||||||
timeFormat(time.Now()), strings.Join(headers, "\r\n"), err, stack, reset)
|
timeFormat(time.Now()), headersToStr, err, stack, reset)
|
||||||
} else {
|
} else {
|
||||||
logger.Printf("[Recovery] %s panic recovered:\n%s\n%s%s",
|
logger.Printf("[Recovery] %s panic recovered:\n%s\n%s%s",
|
||||||
timeFormat(time.Now()), err, stack, reset)
|
timeFormat(time.Now()), err, stack, reset)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the connection is dead, we can't write a status to it.
|
|
||||||
if brokenPipe {
|
if brokenPipe {
|
||||||
|
// If the connection is dead, we can't write a status to it.
|
||||||
c.Error(err.(error)) // nolint: errcheck
|
c.Error(err.(error)) // nolint: errcheck
|
||||||
c.Abort()
|
c.Abort()
|
||||||
} else {
|
} else {
|
||||||
c.AbortWithStatus(http.StatusInternalServerError)
|
handle(c, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
@ -84,6 +100,10 @@ func RecoveryWithWriter(out io.Writer) HandlerFunc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func defaultHandleRecovery(c *Context, err interface{}) {
|
||||||
|
c.AbortWithStatus(http.StatusInternalServerError)
|
||||||
|
}
|
||||||
|
|
||||||
// stack returns a nicely formatted stack frame, skipping skip frames.
|
// stack returns a nicely formatted stack frame, skipping skip frames.
|
||||||
func stack(skip int) []byte {
|
func stack(skip int) []byte {
|
||||||
buf := new(bytes.Buffer) // the returned data
|
buf := new(bytes.Buffer) // the returned data
|
||||||
|
@ -146,6 +166,6 @@ func function(pc uintptr) []byte {
|
||||||
}
|
}
|
||||||
|
|
||||||
func timeFormat(t time.Time) string {
|
func timeFormat(t time.Time) string {
|
||||||
var timeString = t.Format("2006/01/02 - 15:04:05")
|
timeString := t.Format("2006/01/02 - 15:04:05")
|
||||||
return timeString
|
return timeString
|
||||||
}
|
}
|
||||||
|
|
3
vendor/github.com/gin-gonic/gin/render/json.go
generated
vendored
3
vendor/github.com/gin-gonic/gin/render/json.go
generated
vendored
|
@ -41,9 +41,6 @@ type AsciiJSON struct {
|
||||||
Data interface{}
|
Data interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SecureJSONPrefix is a string which represents SecureJSON prefix.
|
|
||||||
type SecureJSONPrefix string
|
|
||||||
|
|
||||||
// PureJSON contains the given interface object.
|
// PureJSON contains the given interface object.
|
||||||
type PureJSON struct {
|
type PureJSON struct {
|
||||||
Data interface{}
|
Data interface{}
|
||||||
|
|
1
vendor/github.com/gin-gonic/gin/render/msgpack.go
generated
vendored
1
vendor/github.com/gin-gonic/gin/render/msgpack.go
generated
vendored
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT style
|
// Use of this source code is governed by a MIT style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !nomsgpack
|
||||||
// +build !nomsgpack
|
// +build !nomsgpack
|
||||||
|
|
||||||
package render
|
package render
|
||||||
|
|
5
vendor/github.com/gin-gonic/gin/render/text.go
generated
vendored
5
vendor/github.com/gin-gonic/gin/render/text.go
generated
vendored
|
@ -6,8 +6,9 @@ package render
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin/internal/bytesconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// String contains the given interface object slice and its format.
|
// String contains the given interface object slice and its format.
|
||||||
|
@ -35,6 +36,6 @@ func WriteString(w http.ResponseWriter, format string, data []interface{}) (err
|
||||||
_, err = fmt.Fprintf(w, format, data...)
|
_, err = fmt.Fprintf(w, format, data...)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
_, err = io.WriteString(w, format)
|
_, err = w.Write(bytesconv.StringToBytes(format))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
2
vendor/github.com/gin-gonic/gin/routergroup.go
generated
vendored
2
vendor/github.com/gin-gonic/gin/routergroup.go
generated
vendored
|
@ -187,7 +187,7 @@ func (group *RouterGroup) createStaticHandler(relativePath string, fs http.FileS
|
||||||
fileServer := http.StripPrefix(absolutePath, http.FileServer(fs))
|
fileServer := http.StripPrefix(absolutePath, http.FileServer(fs))
|
||||||
|
|
||||||
return func(c *Context) {
|
return func(c *Context) {
|
||||||
if _, nolisting := fs.(*onlyfilesFS); nolisting {
|
if _, noListing := fs.(*onlyFilesFS); noListing {
|
||||||
c.Writer.WriteHeader(http.StatusNotFound)
|
c.Writer.WriteHeader(http.StatusNotFound)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
655
vendor/github.com/gin-gonic/gin/tree.go
generated
vendored
655
vendor/github.com/gin-gonic/gin/tree.go
generated
vendored
|
@ -5,9 +5,18 @@
|
||||||
package gin
|
package gin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
"unicode"
|
"unicode"
|
||||||
|
"unicode/utf8"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin/internal/bytesconv"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
strColon = []byte(":")
|
||||||
|
strStar = []byte("*")
|
||||||
)
|
)
|
||||||
|
|
||||||
// Param is a single URL parameter, consisting of a key and a value.
|
// Param is a single URL parameter, consisting of a key and a value.
|
||||||
|
@ -71,17 +80,22 @@ func longestCommonPrefix(a, b string) int {
|
||||||
return i
|
return i
|
||||||
}
|
}
|
||||||
|
|
||||||
func countParams(path string) uint8 {
|
// addChild will add a child node, keeping wildcards at the end
|
||||||
var n uint
|
func (n *node) addChild(child *node) {
|
||||||
for i := 0; i < len(path); i++ {
|
if n.wildChild && len(n.children) > 0 {
|
||||||
if path[i] == ':' || path[i] == '*' {
|
wildcardChild := n.children[len(n.children)-1]
|
||||||
n++
|
n.children = append(n.children[:len(n.children)-1], child, wildcardChild)
|
||||||
}
|
} else {
|
||||||
|
n.children = append(n.children, child)
|
||||||
}
|
}
|
||||||
if n >= 255 {
|
}
|
||||||
return 255
|
|
||||||
}
|
func countParams(path string) uint16 {
|
||||||
return uint8(n)
|
var n uint16
|
||||||
|
s := bytesconv.StringToBytes(path)
|
||||||
|
n += uint16(bytes.Count(s, strColon))
|
||||||
|
n += uint16(bytes.Count(s, strStar))
|
||||||
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
type nodeType uint8
|
type nodeType uint8
|
||||||
|
@ -96,16 +110,15 @@ const (
|
||||||
type node struct {
|
type node struct {
|
||||||
path string
|
path string
|
||||||
indices string
|
indices string
|
||||||
children []*node
|
|
||||||
handlers HandlersChain
|
|
||||||
priority uint32
|
|
||||||
nType nodeType
|
|
||||||
maxParams uint8
|
|
||||||
wildChild bool
|
wildChild bool
|
||||||
|
nType nodeType
|
||||||
|
priority uint32
|
||||||
|
children []*node // child nodes, at most 1 :param style node at the end of the array
|
||||||
|
handlers HandlersChain
|
||||||
fullPath string
|
fullPath string
|
||||||
}
|
}
|
||||||
|
|
||||||
// increments priority of the given child and reorders if necessary.
|
// Increments priority of the given child and reorders if necessary
|
||||||
func (n *node) incrementChildPrio(pos int) int {
|
func (n *node) incrementChildPrio(pos int) int {
|
||||||
cs := n.children
|
cs := n.children
|
||||||
cs[pos].priority++
|
cs[pos].priority++
|
||||||
|
@ -118,11 +131,11 @@ func (n *node) incrementChildPrio(pos int) int {
|
||||||
cs[newPos-1], cs[newPos] = cs[newPos], cs[newPos-1]
|
cs[newPos-1], cs[newPos] = cs[newPos], cs[newPos-1]
|
||||||
}
|
}
|
||||||
|
|
||||||
// build new index char string
|
// Build new index char string
|
||||||
if newPos != pos {
|
if newPos != pos {
|
||||||
n.indices = n.indices[:newPos] + // unchanged prefix, might be empty
|
n.indices = n.indices[:newPos] + // Unchanged prefix, might be empty
|
||||||
n.indices[pos:pos+1] + // the index char we move
|
n.indices[pos:pos+1] + // The index char we move
|
||||||
n.indices[newPos:pos] + n.indices[pos+1:] // rest without char at 'pos'
|
n.indices[newPos:pos] + n.indices[pos+1:] // Rest without char at 'pos'
|
||||||
}
|
}
|
||||||
|
|
||||||
return newPos
|
return newPos
|
||||||
|
@ -133,11 +146,10 @@ func (n *node) incrementChildPrio(pos int) int {
|
||||||
func (n *node) addRoute(path string, handlers HandlersChain) {
|
func (n *node) addRoute(path string, handlers HandlersChain) {
|
||||||
fullPath := path
|
fullPath := path
|
||||||
n.priority++
|
n.priority++
|
||||||
numParams := countParams(path)
|
|
||||||
|
|
||||||
// Empty tree
|
// Empty tree
|
||||||
if len(n.path) == 0 && len(n.children) == 0 {
|
if len(n.path) == 0 && len(n.children) == 0 {
|
||||||
n.insertChild(numParams, path, fullPath, handlers)
|
n.insertChild(path, fullPath, handlers)
|
||||||
n.nType = root
|
n.nType = root
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -146,11 +158,6 @@ func (n *node) addRoute(path string, handlers HandlersChain) {
|
||||||
|
|
||||||
walk:
|
walk:
|
||||||
for {
|
for {
|
||||||
// Update maxParams of the current node
|
|
||||||
if numParams > n.maxParams {
|
|
||||||
n.maxParams = numParams
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find the longest common prefix.
|
// Find the longest common prefix.
|
||||||
// This also implies that the common prefix contains no ':' or '*'
|
// This also implies that the common prefix contains no ':' or '*'
|
||||||
// since the existing key can't contain those chars.
|
// since the existing key can't contain those chars.
|
||||||
|
@ -168,16 +175,9 @@ walk:
|
||||||
fullPath: n.fullPath,
|
fullPath: n.fullPath,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update maxParams (max of all children)
|
|
||||||
for _, v := range child.children {
|
|
||||||
if v.maxParams > child.maxParams {
|
|
||||||
child.maxParams = v.maxParams
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
n.children = []*node{&child}
|
n.children = []*node{&child}
|
||||||
// []byte for proper unicode char conversion, see #65
|
// []byte for proper unicode char conversion, see #65
|
||||||
n.indices = string([]byte{n.path[i]})
|
n.indices = bytesconv.BytesToString([]byte{n.path[i]})
|
||||||
n.path = path[:i]
|
n.path = path[:i]
|
||||||
n.handlers = nil
|
n.handlers = nil
|
||||||
n.wildChild = false
|
n.wildChild = false
|
||||||
|
@ -187,41 +187,9 @@ walk:
|
||||||
// Make new node a child of this node
|
// Make new node a child of this node
|
||||||
if i < len(path) {
|
if i < len(path) {
|
||||||
path = path[i:]
|
path = path[i:]
|
||||||
|
|
||||||
if n.wildChild {
|
|
||||||
parentFullPathIndex += len(n.path)
|
|
||||||
n = n.children[0]
|
|
||||||
n.priority++
|
|
||||||
|
|
||||||
// Update maxParams of the child node
|
|
||||||
if numParams > n.maxParams {
|
|
||||||
n.maxParams = numParams
|
|
||||||
}
|
|
||||||
numParams--
|
|
||||||
|
|
||||||
// Check if the wildcard matches
|
|
||||||
if len(path) >= len(n.path) && n.path == path[:len(n.path)] {
|
|
||||||
// check for longer wildcard, e.g. :name and :names
|
|
||||||
if len(n.path) >= len(path) || path[len(n.path)] == '/' {
|
|
||||||
continue walk
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pathSeg := path
|
|
||||||
if n.nType != catchAll {
|
|
||||||
pathSeg = strings.SplitN(path, "/", 2)[0]
|
|
||||||
}
|
|
||||||
prefix := fullPath[:strings.Index(fullPath, pathSeg)] + n.path
|
|
||||||
panic("'" + pathSeg +
|
|
||||||
"' in new path '" + fullPath +
|
|
||||||
"' conflicts with existing wildcard '" + n.path +
|
|
||||||
"' in existing prefix '" + prefix +
|
|
||||||
"'")
|
|
||||||
}
|
|
||||||
|
|
||||||
c := path[0]
|
c := path[0]
|
||||||
|
|
||||||
// slash after param
|
// '/' after param
|
||||||
if n.nType == param && c == '/' && len(n.children) == 1 {
|
if n.nType == param && c == '/' && len(n.children) == 1 {
|
||||||
parentFullPathIndex += len(n.path)
|
parentFullPathIndex += len(n.path)
|
||||||
n = n.children[0]
|
n = n.children[0]
|
||||||
|
@ -240,32 +208,58 @@ walk:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise insert it
|
// Otherwise insert it
|
||||||
if c != ':' && c != '*' {
|
if c != ':' && c != '*' && n.nType != catchAll {
|
||||||
// []byte for proper unicode char conversion, see #65
|
// []byte for proper unicode char conversion, see #65
|
||||||
n.indices += string([]byte{c})
|
n.indices += bytesconv.BytesToString([]byte{c})
|
||||||
child := &node{
|
child := &node{
|
||||||
maxParams: numParams,
|
fullPath: fullPath,
|
||||||
fullPath: fullPath,
|
|
||||||
}
|
}
|
||||||
n.children = append(n.children, child)
|
n.addChild(child)
|
||||||
n.incrementChildPrio(len(n.indices) - 1)
|
n.incrementChildPrio(len(n.indices) - 1)
|
||||||
n = child
|
n = child
|
||||||
|
} else if n.wildChild {
|
||||||
|
// inserting a wildcard node, need to check if it conflicts with the existing wildcard
|
||||||
|
n = n.children[len(n.children)-1]
|
||||||
|
n.priority++
|
||||||
|
|
||||||
|
// Check if the wildcard matches
|
||||||
|
if len(path) >= len(n.path) && n.path == path[:len(n.path)] &&
|
||||||
|
// Adding a child to a catchAll is not possible
|
||||||
|
n.nType != catchAll &&
|
||||||
|
// Check for longer wildcard, e.g. :name and :names
|
||||||
|
(len(n.path) >= len(path) || path[len(n.path)] == '/') {
|
||||||
|
continue walk
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wildcard conflict
|
||||||
|
pathSeg := path
|
||||||
|
if n.nType != catchAll {
|
||||||
|
pathSeg = strings.SplitN(pathSeg, "/", 2)[0]
|
||||||
|
}
|
||||||
|
prefix := fullPath[:strings.Index(fullPath, pathSeg)] + n.path
|
||||||
|
panic("'" + pathSeg +
|
||||||
|
"' in new path '" + fullPath +
|
||||||
|
"' conflicts with existing wildcard '" + n.path +
|
||||||
|
"' in existing prefix '" + prefix +
|
||||||
|
"'")
|
||||||
}
|
}
|
||||||
n.insertChild(numParams, path, fullPath, handlers)
|
|
||||||
|
n.insertChild(path, fullPath, handlers)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise and handle to current node
|
// Otherwise add handle to current node
|
||||||
if n.handlers != nil {
|
if n.handlers != nil {
|
||||||
panic("handlers are already registered for path '" + fullPath + "'")
|
panic("handlers are already registered for path '" + fullPath + "'")
|
||||||
}
|
}
|
||||||
n.handlers = handlers
|
n.handlers = handlers
|
||||||
|
n.fullPath = fullPath
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search for a wildcard segment and check the name for invalid characters.
|
// Search for a wildcard segment and check the name for invalid characters.
|
||||||
// Returns -1 as index, if no wildcard war found.
|
// Returns -1 as index, if no wildcard was found.
|
||||||
func findWildcard(path string) (wildcard string, i int, valid bool) {
|
func findWildcard(path string) (wildcard string, i int, valid bool) {
|
||||||
// Find start
|
// Find start
|
||||||
for start, c := range []byte(path) {
|
for start, c := range []byte(path) {
|
||||||
|
@ -289,8 +283,8 @@ func findWildcard(path string) (wildcard string, i int, valid bool) {
|
||||||
return "", -1, false
|
return "", -1, false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *node) insertChild(numParams uint8, path string, fullPath string, handlers HandlersChain) {
|
func (n *node) insertChild(path string, fullPath string, handlers HandlersChain) {
|
||||||
for numParams > 0 {
|
for {
|
||||||
// Find prefix until first wildcard
|
// Find prefix until first wildcard
|
||||||
wildcard, i, valid := findWildcard(path)
|
wildcard, i, valid := findWildcard(path)
|
||||||
if i < 0 { // No wildcard found
|
if i < 0 { // No wildcard found
|
||||||
|
@ -308,13 +302,6 @@ func (n *node) insertChild(numParams uint8, path string, fullPath string, handle
|
||||||
panic("wildcards must be named with a non-empty name in path '" + fullPath + "'")
|
panic("wildcards must be named with a non-empty name in path '" + fullPath + "'")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if this node has existing children which would be
|
|
||||||
// unreachable if we insert the wildcard here
|
|
||||||
if len(n.children) > 0 {
|
|
||||||
panic("wildcard segment '" + wildcard +
|
|
||||||
"' conflicts with existing children in path '" + fullPath + "'")
|
|
||||||
}
|
|
||||||
|
|
||||||
if wildcard[0] == ':' { // param
|
if wildcard[0] == ':' { // param
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
// Insert prefix before the current wildcard
|
// Insert prefix before the current wildcard
|
||||||
|
@ -322,17 +309,15 @@ func (n *node) insertChild(numParams uint8, path string, fullPath string, handle
|
||||||
path = path[i:]
|
path = path[i:]
|
||||||
}
|
}
|
||||||
|
|
||||||
n.wildChild = true
|
|
||||||
child := &node{
|
child := &node{
|
||||||
nType: param,
|
nType: param,
|
||||||
path: wildcard,
|
path: wildcard,
|
||||||
maxParams: numParams,
|
fullPath: fullPath,
|
||||||
fullPath: fullPath,
|
|
||||||
}
|
}
|
||||||
n.children = []*node{child}
|
n.addChild(child)
|
||||||
|
n.wildChild = true
|
||||||
n = child
|
n = child
|
||||||
n.priority++
|
n.priority++
|
||||||
numParams--
|
|
||||||
|
|
||||||
// if the path doesn't end with the wildcard, then there
|
// if the path doesn't end with the wildcard, then there
|
||||||
// will be another non-wildcard subpath starting with '/'
|
// will be another non-wildcard subpath starting with '/'
|
||||||
|
@ -340,11 +325,10 @@ func (n *node) insertChild(numParams uint8, path string, fullPath string, handle
|
||||||
path = path[len(wildcard):]
|
path = path[len(wildcard):]
|
||||||
|
|
||||||
child := &node{
|
child := &node{
|
||||||
maxParams: numParams,
|
priority: 1,
|
||||||
priority: 1,
|
fullPath: fullPath,
|
||||||
fullPath: fullPath,
|
|
||||||
}
|
}
|
||||||
n.children = []*node{child}
|
n.addChild(child)
|
||||||
n = child
|
n = child
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -355,7 +339,7 @@ func (n *node) insertChild(numParams uint8, path string, fullPath string, handle
|
||||||
}
|
}
|
||||||
|
|
||||||
// catchAll
|
// catchAll
|
||||||
if i+len(wildcard) != len(path) || numParams > 1 {
|
if i+len(wildcard) != len(path) {
|
||||||
panic("catch-all routes are only allowed at the end of the path in path '" + fullPath + "'")
|
panic("catch-all routes are only allowed at the end of the path in path '" + fullPath + "'")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -375,26 +359,21 @@ func (n *node) insertChild(numParams uint8, path string, fullPath string, handle
|
||||||
child := &node{
|
child := &node{
|
||||||
wildChild: true,
|
wildChild: true,
|
||||||
nType: catchAll,
|
nType: catchAll,
|
||||||
maxParams: 1,
|
|
||||||
fullPath: fullPath,
|
fullPath: fullPath,
|
||||||
}
|
}
|
||||||
// update maxParams of the parent node
|
|
||||||
if n.maxParams < 1 {
|
n.addChild(child)
|
||||||
n.maxParams = 1
|
|
||||||
}
|
|
||||||
n.children = []*node{child}
|
|
||||||
n.indices = string('/')
|
n.indices = string('/')
|
||||||
n = child
|
n = child
|
||||||
n.priority++
|
n.priority++
|
||||||
|
|
||||||
// second node: node holding the variable
|
// second node: node holding the variable
|
||||||
child = &node{
|
child = &node{
|
||||||
path: path[i:],
|
path: path[i:],
|
||||||
nType: catchAll,
|
nType: catchAll,
|
||||||
maxParams: 1,
|
handlers: handlers,
|
||||||
handlers: handlers,
|
priority: 1,
|
||||||
priority: 1,
|
fullPath: fullPath,
|
||||||
fullPath: fullPath,
|
|
||||||
}
|
}
|
||||||
n.children = []*node{child}
|
n.children = []*node{child}
|
||||||
|
|
||||||
|
@ -410,22 +389,170 @@ func (n *node) insertChild(numParams uint8, path string, fullPath string, handle
|
||||||
// nodeValue holds return values of (*Node).getValue method
|
// nodeValue holds return values of (*Node).getValue method
|
||||||
type nodeValue struct {
|
type nodeValue struct {
|
||||||
handlers HandlersChain
|
handlers HandlersChain
|
||||||
params Params
|
params *Params
|
||||||
tsr bool
|
tsr bool
|
||||||
fullPath string
|
fullPath string
|
||||||
}
|
}
|
||||||
|
|
||||||
// getValue returns the handle registered with the given path (key). The values of
|
// Returns the handle registered with the given path (key). The values of
|
||||||
// wildcards are saved to a map.
|
// wildcards are saved to a map.
|
||||||
// If no handle can be found, a TSR (trailing slash redirect) recommendation is
|
// If no handle can be found, a TSR (trailing slash redirect) recommendation is
|
||||||
// made if a handle exists with an extra (without the) trailing slash for the
|
// made if a handle exists with an extra (without the) trailing slash for the
|
||||||
// given path.
|
// given path.
|
||||||
func (n *node) getValue(path string, po Params, unescape bool) (value nodeValue) {
|
func (n *node) getValue(path string, params *Params, unescape bool) (value nodeValue) {
|
||||||
value.params = po
|
var (
|
||||||
|
skippedPath string
|
||||||
|
latestNode = n // Caching the latest node
|
||||||
|
)
|
||||||
|
|
||||||
walk: // Outer loop for walking the tree
|
walk: // Outer loop for walking the tree
|
||||||
for {
|
for {
|
||||||
prefix := n.path
|
prefix := n.path
|
||||||
|
if len(path) > len(prefix) {
|
||||||
|
if path[:len(prefix)] == prefix {
|
||||||
|
path = path[len(prefix):]
|
||||||
|
|
||||||
|
// Try all the non-wildcard children first by matching the indices
|
||||||
|
idxc := path[0]
|
||||||
|
for i, c := range []byte(n.indices) {
|
||||||
|
if c == idxc {
|
||||||
|
// strings.HasPrefix(n.children[len(n.children)-1].path, ":") == n.wildChild
|
||||||
|
if n.wildChild {
|
||||||
|
skippedPath = prefix + path
|
||||||
|
latestNode = &node{
|
||||||
|
path: n.path,
|
||||||
|
wildChild: n.wildChild,
|
||||||
|
nType: n.nType,
|
||||||
|
priority: n.priority,
|
||||||
|
children: n.children,
|
||||||
|
handlers: n.handlers,
|
||||||
|
fullPath: n.fullPath,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
n = n.children[i]
|
||||||
|
continue walk
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// If the path at the end of the loop is not equal to '/' and the current node has no child nodes
|
||||||
|
// the current node needs to be equal to the latest matching node
|
||||||
|
matched := path != "/" && !n.wildChild
|
||||||
|
if matched {
|
||||||
|
n = latestNode
|
||||||
|
}
|
||||||
|
|
||||||
|
// If there is no wildcard pattern, recommend a redirection
|
||||||
|
if !n.wildChild {
|
||||||
|
// Nothing found.
|
||||||
|
// We can recommend to redirect to the same URL without a
|
||||||
|
// trailing slash if a leaf exists for that path.
|
||||||
|
value.tsr = path == "/" && n.handlers != nil
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle wildcard child, which is always at the end of the array
|
||||||
|
n = n.children[len(n.children)-1]
|
||||||
|
|
||||||
|
switch n.nType {
|
||||||
|
case param:
|
||||||
|
// fix truncate the parameter
|
||||||
|
// tree_test.go line: 204
|
||||||
|
if matched {
|
||||||
|
path = prefix + path
|
||||||
|
// The saved path is used after the prefix route is intercepted by matching
|
||||||
|
if n.indices == "/" {
|
||||||
|
path = skippedPath[1:]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find param end (either '/' or path end)
|
||||||
|
end := 0
|
||||||
|
for end < len(path) && path[end] != '/' {
|
||||||
|
end++
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save param value
|
||||||
|
if params != nil {
|
||||||
|
if value.params == nil {
|
||||||
|
value.params = params
|
||||||
|
}
|
||||||
|
// Expand slice within preallocated capacity
|
||||||
|
i := len(*value.params)
|
||||||
|
*value.params = (*value.params)[:i+1]
|
||||||
|
val := path[:end]
|
||||||
|
if unescape {
|
||||||
|
if v, err := url.QueryUnescape(val); err == nil {
|
||||||
|
val = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
(*value.params)[i] = Param{
|
||||||
|
Key: n.path[1:],
|
||||||
|
Value: val,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// we need to go deeper!
|
||||||
|
if end < len(path) {
|
||||||
|
if len(n.children) > 0 {
|
||||||
|
path = path[end:]
|
||||||
|
n = n.children[0]
|
||||||
|
continue walk
|
||||||
|
}
|
||||||
|
|
||||||
|
// ... but we can't
|
||||||
|
value.tsr = (len(path) == end+1)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if value.handlers = n.handlers; value.handlers != nil {
|
||||||
|
value.fullPath = n.fullPath
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if len(n.children) == 1 {
|
||||||
|
// No handle found. Check if a handle for this path + a
|
||||||
|
// trailing slash exists for TSR recommendation
|
||||||
|
n = n.children[0]
|
||||||
|
value.tsr = (n.path == "/" && n.handlers != nil)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
|
||||||
|
case catchAll:
|
||||||
|
// Save param value
|
||||||
|
if params != nil {
|
||||||
|
if value.params == nil {
|
||||||
|
value.params = params
|
||||||
|
}
|
||||||
|
// Expand slice within preallocated capacity
|
||||||
|
i := len(*value.params)
|
||||||
|
*value.params = (*value.params)[:i+1]
|
||||||
|
val := path
|
||||||
|
if unescape {
|
||||||
|
if v, err := url.QueryUnescape(path); err == nil {
|
||||||
|
val = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
(*value.params)[i] = Param{
|
||||||
|
Key: n.path[2:],
|
||||||
|
Value: val,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
value.handlers = n.handlers
|
||||||
|
value.fullPath = n.fullPath
|
||||||
|
return
|
||||||
|
|
||||||
|
default:
|
||||||
|
panic("invalid node type")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if path == prefix {
|
if path == prefix {
|
||||||
|
// If the current path does not equal '/' and the node does not have a registered handle and the most recently matched node has a child node
|
||||||
|
// the current node needs to be equal to the latest matching node
|
||||||
|
if latestNode.wildChild && n.handlers == nil && path != "/" {
|
||||||
|
n = latestNode.children[len(latestNode.children)-1]
|
||||||
|
}
|
||||||
// We should have reached the node containing the handle.
|
// We should have reached the node containing the handle.
|
||||||
// Check if this node has a handle registered.
|
// Check if this node has a handle registered.
|
||||||
if value.handlers = n.handlers; value.handlers != nil {
|
if value.handlers = n.handlers; value.handlers != nil {
|
||||||
|
@ -433,6 +560,9 @@ walk: // Outer loop for walking the tree
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If there is no handle for this route, but this route has a
|
||||||
|
// wildcard child, there must be a handle for this path with an
|
||||||
|
// additional trailing slash
|
||||||
if path == "/" && n.wildChild && n.nType != root {
|
if path == "/" && n.wildChild && n.nType != root {
|
||||||
value.tsr = true
|
value.tsr = true
|
||||||
return
|
return
|
||||||
|
@ -440,9 +570,8 @@ walk: // Outer loop for walking the tree
|
||||||
|
|
||||||
// No handle found. Check if a handle for this path + a
|
// No handle found. Check if a handle for this path + a
|
||||||
// trailing slash exists for trailing slash recommendation
|
// trailing slash exists for trailing slash recommendation
|
||||||
indices := n.indices
|
for i, c := range []byte(n.indices) {
|
||||||
for i, max := 0, len(indices); i < max; i++ {
|
if c == '/' {
|
||||||
if indices[i] == '/' {
|
|
||||||
n = n.children[i]
|
n = n.children[i]
|
||||||
value.tsr = (len(n.path) == 1 && n.handlers != nil) ||
|
value.tsr = (len(n.path) == 1 && n.handlers != nil) ||
|
||||||
(n.nType == catchAll && n.children[0].handlers != nil)
|
(n.nType == catchAll && n.children[0].handlers != nil)
|
||||||
|
@ -453,171 +582,186 @@ walk: // Outer loop for walking the tree
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(path) > len(prefix) && path[:len(prefix)] == prefix {
|
if path != "/" && len(skippedPath) > 0 && strings.HasSuffix(skippedPath, path) {
|
||||||
path = path[len(prefix):]
|
path = skippedPath
|
||||||
// If this node does not have a wildcard (param or catchAll)
|
// Reduce the number of cycles
|
||||||
// child, we can just look up the next child node and continue
|
n, latestNode = latestNode, n
|
||||||
// to walk down the tree
|
// skippedPath cannot execute
|
||||||
if !n.wildChild {
|
// example:
|
||||||
c := path[0]
|
// * /:cc/cc
|
||||||
indices := n.indices
|
// call /a/cc expectations:match/200 Actual:match/200
|
||||||
for i, max := 0, len(indices); i < max; i++ {
|
// call /a/dd expectations:unmatch/404 Actual: panic
|
||||||
if c == indices[i] {
|
// call /addr/dd/aa expectations:unmatch/404 Actual: panic
|
||||||
n = n.children[i]
|
// skippedPath: It can only be executed if the secondary route is not found
|
||||||
continue walk
|
skippedPath = ""
|
||||||
}
|
continue walk
|
||||||
}
|
|
||||||
|
|
||||||
// Nothing found.
|
|
||||||
// We can recommend to redirect to the same URL without a
|
|
||||||
// trailing slash if a leaf exists for that path.
|
|
||||||
value.tsr = path == "/" && n.handlers != nil
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// handle wildcard child
|
|
||||||
n = n.children[0]
|
|
||||||
switch n.nType {
|
|
||||||
case param:
|
|
||||||
// find param end (either '/' or path end)
|
|
||||||
end := 0
|
|
||||||
for end < len(path) && path[end] != '/' {
|
|
||||||
end++
|
|
||||||
}
|
|
||||||
|
|
||||||
// save param value
|
|
||||||
if cap(value.params) < int(n.maxParams) {
|
|
||||||
value.params = make(Params, 0, n.maxParams)
|
|
||||||
}
|
|
||||||
i := len(value.params)
|
|
||||||
value.params = value.params[:i+1] // expand slice within preallocated capacity
|
|
||||||
value.params[i].Key = n.path[1:]
|
|
||||||
val := path[:end]
|
|
||||||
if unescape {
|
|
||||||
var err error
|
|
||||||
if value.params[i].Value, err = url.QueryUnescape(val); err != nil {
|
|
||||||
value.params[i].Value = val // fallback, in case of error
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
value.params[i].Value = val
|
|
||||||
}
|
|
||||||
|
|
||||||
// we need to go deeper!
|
|
||||||
if end < len(path) {
|
|
||||||
if len(n.children) > 0 {
|
|
||||||
path = path[end:]
|
|
||||||
n = n.children[0]
|
|
||||||
continue walk
|
|
||||||
}
|
|
||||||
|
|
||||||
// ... but we can't
|
|
||||||
value.tsr = len(path) == end+1
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if value.handlers = n.handlers; value.handlers != nil {
|
|
||||||
value.fullPath = n.fullPath
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if len(n.children) == 1 {
|
|
||||||
// No handle found. Check if a handle for this path + a
|
|
||||||
// trailing slash exists for TSR recommendation
|
|
||||||
n = n.children[0]
|
|
||||||
value.tsr = n.path == "/" && n.handlers != nil
|
|
||||||
}
|
|
||||||
return
|
|
||||||
|
|
||||||
case catchAll:
|
|
||||||
// save param value
|
|
||||||
if cap(value.params) < int(n.maxParams) {
|
|
||||||
value.params = make(Params, 0, n.maxParams)
|
|
||||||
}
|
|
||||||
i := len(value.params)
|
|
||||||
value.params = value.params[:i+1] // expand slice within preallocated capacity
|
|
||||||
value.params[i].Key = n.path[2:]
|
|
||||||
if unescape {
|
|
||||||
var err error
|
|
||||||
if value.params[i].Value, err = url.QueryUnescape(path); err != nil {
|
|
||||||
value.params[i].Value = path // fallback, in case of error
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
value.params[i].Value = path
|
|
||||||
}
|
|
||||||
|
|
||||||
value.handlers = n.handlers
|
|
||||||
value.fullPath = n.fullPath
|
|
||||||
return
|
|
||||||
|
|
||||||
default:
|
|
||||||
panic("invalid node type")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Nothing found. We can recommend to redirect to the same URL with an
|
// Nothing found. We can recommend to redirect to the same URL with an
|
||||||
// extra trailing slash if a leaf exists for that path
|
// extra trailing slash if a leaf exists for that path
|
||||||
value.tsr = (path == "/") ||
|
value.tsr = path == "/" ||
|
||||||
(len(prefix) == len(path)+1 && prefix[len(path)] == '/' &&
|
(len(prefix) == len(path)+1 && n.handlers != nil)
|
||||||
path == prefix[:len(prefix)-1] && n.handlers != nil)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// findCaseInsensitivePath makes a case-insensitive lookup of the given path and tries to find a handler.
|
// Makes a case-insensitive lookup of the given path and tries to find a handler.
|
||||||
// It can optionally also fix trailing slashes.
|
// It can optionally also fix trailing slashes.
|
||||||
// It returns the case-corrected path and a bool indicating whether the lookup
|
// It returns the case-corrected path and a bool indicating whether the lookup
|
||||||
// was successful.
|
// was successful.
|
||||||
func (n *node) findCaseInsensitivePath(path string, fixTrailingSlash bool) (ciPath []byte, found bool) {
|
func (n *node) findCaseInsensitivePath(path string, fixTrailingSlash bool) ([]byte, bool) {
|
||||||
ciPath = make([]byte, 0, len(path)+1) // preallocate enough memory
|
const stackBufSize = 128
|
||||||
|
|
||||||
// Outer loop for walking the tree
|
// Use a static sized buffer on the stack in the common case.
|
||||||
for len(path) >= len(n.path) && strings.EqualFold(path[:len(n.path)], n.path) {
|
// If the path is too long, allocate a buffer on the heap instead.
|
||||||
path = path[len(n.path):]
|
buf := make([]byte, 0, stackBufSize)
|
||||||
|
if length := len(path) + 1; length > stackBufSize {
|
||||||
|
buf = make([]byte, 0, length)
|
||||||
|
}
|
||||||
|
|
||||||
|
ciPath := n.findCaseInsensitivePathRec(
|
||||||
|
path,
|
||||||
|
buf, // Preallocate enough memory for new path
|
||||||
|
[4]byte{}, // Empty rune buffer
|
||||||
|
fixTrailingSlash,
|
||||||
|
)
|
||||||
|
|
||||||
|
return ciPath, ciPath != nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shift bytes in array by n bytes left
|
||||||
|
func shiftNRuneBytes(rb [4]byte, n int) [4]byte {
|
||||||
|
switch n {
|
||||||
|
case 0:
|
||||||
|
return rb
|
||||||
|
case 1:
|
||||||
|
return [4]byte{rb[1], rb[2], rb[3], 0}
|
||||||
|
case 2:
|
||||||
|
return [4]byte{rb[2], rb[3]}
|
||||||
|
case 3:
|
||||||
|
return [4]byte{rb[3]}
|
||||||
|
default:
|
||||||
|
return [4]byte{}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Recursive case-insensitive lookup function used by n.findCaseInsensitivePath
|
||||||
|
func (n *node) findCaseInsensitivePathRec(path string, ciPath []byte, rb [4]byte, fixTrailingSlash bool) []byte {
|
||||||
|
npLen := len(n.path)
|
||||||
|
|
||||||
|
walk: // Outer loop for walking the tree
|
||||||
|
for len(path) >= npLen && (npLen == 0 || strings.EqualFold(path[1:npLen], n.path[1:])) {
|
||||||
|
// Add common prefix to result
|
||||||
|
oldPath := path
|
||||||
|
path = path[npLen:]
|
||||||
ciPath = append(ciPath, n.path...)
|
ciPath = append(ciPath, n.path...)
|
||||||
|
|
||||||
if len(path) == 0 {
|
if len(path) == 0 {
|
||||||
// We should have reached the node containing the handle.
|
// We should have reached the node containing the handle.
|
||||||
// Check if this node has a handle registered.
|
// Check if this node has a handle registered.
|
||||||
if n.handlers != nil {
|
if n.handlers != nil {
|
||||||
return ciPath, true
|
return ciPath
|
||||||
}
|
}
|
||||||
|
|
||||||
// No handle found.
|
// No handle found.
|
||||||
// Try to fix the path by adding a trailing slash
|
// Try to fix the path by adding a trailing slash
|
||||||
if fixTrailingSlash {
|
if fixTrailingSlash {
|
||||||
for i := 0; i < len(n.indices); i++ {
|
for i, c := range []byte(n.indices) {
|
||||||
if n.indices[i] == '/' {
|
if c == '/' {
|
||||||
n = n.children[i]
|
n = n.children[i]
|
||||||
if (len(n.path) == 1 && n.handlers != nil) ||
|
if (len(n.path) == 1 && n.handlers != nil) ||
|
||||||
(n.nType == catchAll && n.children[0].handlers != nil) {
|
(n.nType == catchAll && n.children[0].handlers != nil) {
|
||||||
return append(ciPath, '/'), true
|
return append(ciPath, '/')
|
||||||
}
|
}
|
||||||
return
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// If this node does not have a wildcard (param or catchAll) child,
|
// If this node does not have a wildcard (param or catchAll) child,
|
||||||
// we can just look up the next child node and continue to walk down
|
// we can just look up the next child node and continue to walk down
|
||||||
// the tree
|
// the tree
|
||||||
if !n.wildChild {
|
if !n.wildChild {
|
||||||
r := unicode.ToLower(rune(path[0]))
|
// Skip rune bytes already processed
|
||||||
for i, index := range n.indices {
|
rb = shiftNRuneBytes(rb, npLen)
|
||||||
// must use recursive approach since both index and
|
|
||||||
// ToLower(index) could exist. We must check both.
|
if rb[0] != 0 {
|
||||||
if r == unicode.ToLower(index) {
|
// Old rune not finished
|
||||||
out, found := n.children[i].findCaseInsensitivePath(path, fixTrailingSlash)
|
idxc := rb[0]
|
||||||
if found {
|
for i, c := range []byte(n.indices) {
|
||||||
return append(ciPath, out...), true
|
if c == idxc {
|
||||||
|
// continue with child node
|
||||||
|
n = n.children[i]
|
||||||
|
npLen = len(n.path)
|
||||||
|
continue walk
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Process a new rune
|
||||||
|
var rv rune
|
||||||
|
|
||||||
|
// Find rune start.
|
||||||
|
// Runes are up to 4 byte long,
|
||||||
|
// -4 would definitely be another rune.
|
||||||
|
var off int
|
||||||
|
for max := min(npLen, 3); off < max; off++ {
|
||||||
|
if i := npLen - off; utf8.RuneStart(oldPath[i]) {
|
||||||
|
// read rune from cached path
|
||||||
|
rv, _ = utf8.DecodeRuneInString(oldPath[i:])
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate lowercase bytes of current rune
|
||||||
|
lo := unicode.ToLower(rv)
|
||||||
|
utf8.EncodeRune(rb[:], lo)
|
||||||
|
|
||||||
|
// Skip already processed bytes
|
||||||
|
rb = shiftNRuneBytes(rb, off)
|
||||||
|
|
||||||
|
idxc := rb[0]
|
||||||
|
for i, c := range []byte(n.indices) {
|
||||||
|
// Lowercase matches
|
||||||
|
if c == idxc {
|
||||||
|
// must use a recursive approach since both the
|
||||||
|
// uppercase byte and the lowercase byte might exist
|
||||||
|
// as an index
|
||||||
|
if out := n.children[i].findCaseInsensitivePathRec(
|
||||||
|
path, ciPath, rb, fixTrailingSlash,
|
||||||
|
); out != nil {
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we found no match, the same for the uppercase rune,
|
||||||
|
// if it differs
|
||||||
|
if up := unicode.ToUpper(rv); up != lo {
|
||||||
|
utf8.EncodeRune(rb[:], up)
|
||||||
|
rb = shiftNRuneBytes(rb, off)
|
||||||
|
|
||||||
|
idxc := rb[0]
|
||||||
|
for i, c := range []byte(n.indices) {
|
||||||
|
// Uppercase matches
|
||||||
|
if c == idxc {
|
||||||
|
// Continue with child node
|
||||||
|
n = n.children[i]
|
||||||
|
npLen = len(n.path)
|
||||||
|
continue walk
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Nothing found. We can recommend to redirect to the same URL
|
// Nothing found. We can recommend to redirect to the same URL
|
||||||
// without a trailing slash if a leaf exists for that path
|
// without a trailing slash if a leaf exists for that path
|
||||||
found = fixTrailingSlash && path == "/" && n.handlers != nil
|
if fixTrailingSlash && path == "/" && n.handlers != nil {
|
||||||
return
|
return ciPath
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
n = n.children[0]
|
n = n.children[0]
|
||||||
|
@ -629,39 +773,43 @@ func (n *node) findCaseInsensitivePath(path string, fixTrailingSlash bool) (ciPa
|
||||||
end++
|
end++
|
||||||
}
|
}
|
||||||
|
|
||||||
// add param value to case insensitive path
|
// Add param value to case insensitive path
|
||||||
ciPath = append(ciPath, path[:end]...)
|
ciPath = append(ciPath, path[:end]...)
|
||||||
|
|
||||||
// we need to go deeper!
|
// We need to go deeper!
|
||||||
if end < len(path) {
|
if end < len(path) {
|
||||||
if len(n.children) > 0 {
|
if len(n.children) > 0 {
|
||||||
path = path[end:]
|
// Continue with child node
|
||||||
n = n.children[0]
|
n = n.children[0]
|
||||||
|
npLen = len(n.path)
|
||||||
|
path = path[end:]
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// ... but we can't
|
// ... but we can't
|
||||||
if fixTrailingSlash && len(path) == end+1 {
|
if fixTrailingSlash && len(path) == end+1 {
|
||||||
return ciPath, true
|
return ciPath
|
||||||
}
|
}
|
||||||
return
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if n.handlers != nil {
|
if n.handlers != nil {
|
||||||
return ciPath, true
|
return ciPath
|
||||||
}
|
}
|
||||||
|
|
||||||
if fixTrailingSlash && len(n.children) == 1 {
|
if fixTrailingSlash && len(n.children) == 1 {
|
||||||
// No handle found. Check if a handle for this path + a
|
// No handle found. Check if a handle for this path + a
|
||||||
// trailing slash exists
|
// trailing slash exists
|
||||||
n = n.children[0]
|
n = n.children[0]
|
||||||
if n.path == "/" && n.handlers != nil {
|
if n.path == "/" && n.handlers != nil {
|
||||||
return append(ciPath, '/'), true
|
return append(ciPath, '/')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
|
||||||
|
return nil
|
||||||
|
|
||||||
case catchAll:
|
case catchAll:
|
||||||
return append(ciPath, path...), true
|
return append(ciPath, path...)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
panic("invalid node type")
|
panic("invalid node type")
|
||||||
|
@ -672,13 +820,12 @@ func (n *node) findCaseInsensitivePath(path string, fixTrailingSlash bool) (ciPa
|
||||||
// Try to fix the path by adding / removing a trailing slash
|
// Try to fix the path by adding / removing a trailing slash
|
||||||
if fixTrailingSlash {
|
if fixTrailingSlash {
|
||||||
if path == "/" {
|
if path == "/" {
|
||||||
return ciPath, true
|
return ciPath
|
||||||
}
|
}
|
||||||
if len(path)+1 == len(n.path) && n.path[len(path)] == '/' &&
|
if len(path)+1 == npLen && n.path[len(path)] == '/' &&
|
||||||
strings.EqualFold(path, n.path[:len(path)]) &&
|
strings.EqualFold(path[1:], n.path[1:len(path)]) && n.handlers != nil {
|
||||||
n.handlers != nil {
|
return append(ciPath, n.path...)
|
||||||
return append(ciPath, n.path...), true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
return nil
|
||||||
}
|
}
|
||||||
|
|
18
vendor/github.com/gin-gonic/gin/utils.go
generated
vendored
18
vendor/github.com/gin-gonic/gin/utils.go
generated
vendored
|
@ -90,20 +90,23 @@ func filterFlags(content string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func chooseData(custom, wildcard interface{}) interface{} {
|
func chooseData(custom, wildcard interface{}) interface{} {
|
||||||
if custom == nil {
|
if custom != nil {
|
||||||
if wildcard == nil {
|
return custom
|
||||||
panic("negotiation config is invalid")
|
}
|
||||||
}
|
if wildcard != nil {
|
||||||
return wildcard
|
return wildcard
|
||||||
}
|
}
|
||||||
return custom
|
panic("negotiation config is invalid")
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseAccept(acceptHeader string) []string {
|
func parseAccept(acceptHeader string) []string {
|
||||||
parts := strings.Split(acceptHeader, ",")
|
parts := strings.Split(acceptHeader, ",")
|
||||||
out := make([]string, 0, len(parts))
|
out := make([]string, 0, len(parts))
|
||||||
for _, part := range parts {
|
for _, part := range parts {
|
||||||
if part = strings.TrimSpace(strings.Split(part, ";")[0]); part != "" {
|
if i := strings.IndexByte(part, ';'); i > 0 {
|
||||||
|
part = part[:i]
|
||||||
|
}
|
||||||
|
if part = strings.TrimSpace(part); part != "" {
|
||||||
out = append(out, part)
|
out = append(out, part)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,8 +130,7 @@ func joinPaths(absolutePath, relativePath string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
finalPath := path.Join(absolutePath, relativePath)
|
finalPath := path.Join(absolutePath, relativePath)
|
||||||
appendSlash := lastChar(relativePath) == '/' && lastChar(finalPath) != '/'
|
if lastChar(relativePath) == '/' && lastChar(finalPath) != '/' {
|
||||||
if appendSlash {
|
|
||||||
return finalPath + "/"
|
return finalPath + "/"
|
||||||
}
|
}
|
||||||
return finalPath
|
return finalPath
|
||||||
|
|
2
vendor/github.com/gin-gonic/gin/version.go
generated
vendored
2
vendor/github.com/gin-gonic/gin/version.go
generated
vendored
|
@ -5,4 +5,4 @@
|
||||||
package gin
|
package gin
|
||||||
|
|
||||||
// Version is the current gin framework's version.
|
// Version is the current gin framework's version.
|
||||||
const Version = "v1.6.3"
|
const Version = "v1.7.3"
|
||||||
|
|
4
vendor/github.com/go-playground/locales/README.md
generated
vendored
4
vendor/github.com/go-playground/locales/README.md
generated
vendored
|
@ -1,5 +1,5 @@
|
||||||
## locales
|
## locales
|
||||||
<img align="right" src="https://raw.githubusercontent.com/go-playground/locales/master/logo.png">![Project status](https://img.shields.io/badge/version-0.13.0-green.svg)
|
<img align="right" src="https://raw.githubusercontent.com/go-playground/locales/master/logo.png">![Project status](https://img.shields.io/badge/version-0.14.0-green.svg)
|
||||||
[![Build Status](https://travis-ci.org/go-playground/locales.svg?branch=master)](https://travis-ci.org/go-playground/locales)
|
[![Build Status](https://travis-ci.org/go-playground/locales.svg?branch=master)](https://travis-ci.org/go-playground/locales)
|
||||||
[![Go Report Card](https://goreportcard.com/badge/github.com/go-playground/locales)](https://goreportcard.com/report/github.com/go-playground/locales)
|
[![Go Report Card](https://goreportcard.com/badge/github.com/go-playground/locales)](https://goreportcard.com/report/github.com/go-playground/locales)
|
||||||
[![GoDoc](https://godoc.org/github.com/go-playground/locales?status.svg)](https://godoc.org/github.com/go-playground/locales)
|
[![GoDoc](https://godoc.org/github.com/go-playground/locales?status.svg)](https://godoc.org/github.com/go-playground/locales)
|
||||||
|
@ -11,7 +11,7 @@ an i18n package; these were built for use with, but not exclusive to, [Universal
|
||||||
|
|
||||||
Features
|
Features
|
||||||
--------
|
--------
|
||||||
- [x] Rules generated from the latest [CLDR](http://cldr.unicode.org/index/downloads) data, v31.0.1
|
- [x] Rules generated from the latest [CLDR](http://cldr.unicode.org/index/downloads) data, v36.0.1
|
||||||
- [x] Contains Cardinal, Ordinal and Range Plural Rules
|
- [x] Contains Cardinal, Ordinal and Range Plural Rules
|
||||||
- [x] Contains Month, Weekday and Timezone translations built in
|
- [x] Contains Month, Weekday and Timezone translations built in
|
||||||
- [x] Contains Date & Time formatting functions
|
- [x] Contains Date & Time formatting functions
|
||||||
|
|
3
vendor/github.com/go-playground/locales/currency/currency.go
generated
vendored
3
vendor/github.com/go-playground/locales/currency/currency.go
generated
vendored
|
@ -176,6 +176,7 @@ const (
|
||||||
MNT
|
MNT
|
||||||
MOP
|
MOP
|
||||||
MRO
|
MRO
|
||||||
|
MRU
|
||||||
MTL
|
MTL
|
||||||
MTP
|
MTP
|
||||||
MUR
|
MUR
|
||||||
|
@ -262,9 +263,11 @@ const (
|
||||||
UYI
|
UYI
|
||||||
UYP
|
UYP
|
||||||
UYU
|
UYU
|
||||||
|
UYW
|
||||||
UZS
|
UZS
|
||||||
VEB
|
VEB
|
||||||
VEF
|
VEF
|
||||||
|
VES
|
||||||
VND
|
VND
|
||||||
VNN
|
VNN
|
||||||
VUV
|
VUV
|
||||||
|
|
2
vendor/github.com/go-playground/locales/go.mod
generated
vendored
2
vendor/github.com/go-playground/locales/go.mod
generated
vendored
|
@ -2,4 +2,4 @@ module github.com/go-playground/locales
|
||||||
|
|
||||||
go 1.13
|
go 1.13
|
||||||
|
|
||||||
require golang.org/x/text v0.3.2
|
require golang.org/x/text v0.3.6
|
||||||
|
|
4
vendor/github.com/go-playground/locales/go.sum
generated
vendored
4
vendor/github.com/go-playground/locales/go.sum
generated
vendored
|
@ -1,3 +1,3 @@
|
||||||
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
|
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
|
||||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
|
18
vendor/github.com/go-playground/universal-translator/Makefile
generated
vendored
Normal file
18
vendor/github.com/go-playground/universal-translator/Makefile
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
GOCMD=GO111MODULE=on go
|
||||||
|
|
||||||
|
linters-install:
|
||||||
|
@golangci-lint --version >/dev/null 2>&1 || { \
|
||||||
|
echo "installing linting tools..."; \
|
||||||
|
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s v1.41.1; \
|
||||||
|
}
|
||||||
|
|
||||||
|
lint: linters-install
|
||||||
|
golangci-lint run
|
||||||
|
|
||||||
|
test:
|
||||||
|
$(GOCMD) test -cover -race ./...
|
||||||
|
|
||||||
|
bench:
|
||||||
|
$(GOCMD) test -bench=. -benchmem ./...
|
||||||
|
|
||||||
|
.PHONY: test lint linters-install
|
6
vendor/github.com/go-playground/universal-translator/README.md
generated
vendored
6
vendor/github.com/go-playground/universal-translator/README.md
generated
vendored
|
@ -1,5 +1,5 @@
|
||||||
## universal-translator
|
## universal-translator
|
||||||
<img align="right" src="https://raw.githubusercontent.com/go-playground/universal-translator/master/logo.png">![Project status](https://img.shields.io/badge/version-0.17.0-green.svg)
|
<img align="right" src="https://raw.githubusercontent.com/go-playground/universal-translator/master/logo.png">![Project status](https://img.shields.io/badge/version-0.18.0-green.svg)
|
||||||
[![Build Status](https://travis-ci.org/go-playground/universal-translator.svg?branch=master)](https://travis-ci.org/go-playground/universal-translator)
|
[![Build Status](https://travis-ci.org/go-playground/universal-translator.svg?branch=master)](https://travis-ci.org/go-playground/universal-translator)
|
||||||
[![Coverage Status](https://coveralls.io/repos/github/go-playground/universal-translator/badge.svg)](https://coveralls.io/github/go-playground/universal-translator)
|
[![Coverage Status](https://coveralls.io/repos/github/go-playground/universal-translator/badge.svg)](https://coveralls.io/github/go-playground/universal-translator)
|
||||||
[![Go Report Card](https://goreportcard.com/badge/github.com/go-playground/universal-translator)](https://goreportcard.com/report/github.com/go-playground/universal-translator)
|
[![Go Report Card](https://goreportcard.com/badge/github.com/go-playground/universal-translator)](https://goreportcard.com/report/github.com/go-playground/universal-translator)
|
||||||
|
@ -18,7 +18,7 @@ use in your applications.
|
||||||
|
|
||||||
Features
|
Features
|
||||||
--------
|
--------
|
||||||
- [x] Rules generated from the [CLDR](http://cldr.unicode.org/index/downloads) data, v30.0.3
|
- [x] Rules generated from the [CLDR](http://cldr.unicode.org/index/downloads) data, v36.0.1
|
||||||
- [x] Contains Cardinal, Ordinal and Range Plural Rules
|
- [x] Contains Cardinal, Ordinal and Range Plural Rules
|
||||||
- [x] Contains Month, Weekday and Timezone translations built in
|
- [x] Contains Month, Weekday and Timezone translations built in
|
||||||
- [x] Contains Date & Time formatting functions
|
- [x] Contains Date & Time formatting functions
|
||||||
|
@ -51,7 +51,7 @@ Please see https://godoc.org/github.com/go-playground/universal-translator for u
|
||||||
|
|
||||||
File formatting
|
File formatting
|
||||||
--------------
|
--------------
|
||||||
All types, Plain substitution, Cardinal, Ordinal and Range translations can all be contained withing the same file(s);
|
All types, Plain substitution, Cardinal, Ordinal and Range translations can all be contained within the same file(s);
|
||||||
they are only separated for easy viewing.
|
they are only separated for easy viewing.
|
||||||
|
|
||||||
##### Examples:
|
##### Examples:
|
||||||
|
|
2
vendor/github.com/go-playground/universal-translator/go.mod
generated
vendored
2
vendor/github.com/go-playground/universal-translator/go.mod
generated
vendored
|
@ -2,4 +2,4 @@ module github.com/go-playground/universal-translator
|
||||||
|
|
||||||
go 1.13
|
go 1.13
|
||||||
|
|
||||||
require github.com/go-playground/locales v0.13.0
|
require github.com/go-playground/locales v0.14.0
|
||||||
|
|
3
vendor/github.com/go-playground/universal-translator/go.sum
generated
vendored
3
vendor/github.com/go-playground/universal-translator/go.sum
generated
vendored
|
@ -1,4 +1,7 @@
|
||||||
github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=
|
github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=
|
||||||
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
|
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
|
||||||
|
github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU=
|
||||||
|
github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs=
|
||||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||||
|
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
|
2
vendor/github.com/go-playground/universal-translator/import_export.go
generated
vendored
2
vendor/github.com/go-playground/universal-translator/import_export.go
generated
vendored
|
@ -257,6 +257,8 @@ func (t *UniversalTranslator) ImportByReader(format ImportExportFormat, reader i
|
||||||
func stringToPR(s string) locales.PluralRule {
|
func stringToPR(s string) locales.PluralRule {
|
||||||
|
|
||||||
switch s {
|
switch s {
|
||||||
|
case "Zero":
|
||||||
|
return locales.PluralRuleZero
|
||||||
case "One":
|
case "One":
|
||||||
return locales.PluralRuleOne
|
return locales.PluralRuleOne
|
||||||
case "Two":
|
case "Two":
|
||||||
|
|
12
vendor/github.com/go-playground/universal-translator/translator.go
generated
vendored
12
vendor/github.com/go-playground/universal-translator/translator.go
generated
vendored
|
@ -159,13 +159,13 @@ func (t *translator) AddCardinal(key interface{}, text string, rule locales.Plur
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
tarr = make([]*transText, 7, 7)
|
tarr = make([]*transText, 7)
|
||||||
t.cardinalTanslations[key] = tarr
|
t.cardinalTanslations[key] = tarr
|
||||||
}
|
}
|
||||||
|
|
||||||
trans := &transText{
|
trans := &transText{
|
||||||
text: text,
|
text: text,
|
||||||
indexes: make([]int, 2, 2),
|
indexes: make([]int, 2),
|
||||||
}
|
}
|
||||||
|
|
||||||
tarr[rule] = trans
|
tarr[rule] = trans
|
||||||
|
@ -211,13 +211,13 @@ func (t *translator) AddOrdinal(key interface{}, text string, rule locales.Plura
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
tarr = make([]*transText, 7, 7)
|
tarr = make([]*transText, 7)
|
||||||
t.ordinalTanslations[key] = tarr
|
t.ordinalTanslations[key] = tarr
|
||||||
}
|
}
|
||||||
|
|
||||||
trans := &transText{
|
trans := &transText{
|
||||||
text: text,
|
text: text,
|
||||||
indexes: make([]int, 2, 2),
|
indexes: make([]int, 2),
|
||||||
}
|
}
|
||||||
|
|
||||||
tarr[rule] = trans
|
tarr[rule] = trans
|
||||||
|
@ -261,13 +261,13 @@ func (t *translator) AddRange(key interface{}, text string, rule locales.PluralR
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
tarr = make([]*transText, 7, 7)
|
tarr = make([]*transText, 7)
|
||||||
t.rangeTanslations[key] = tarr
|
t.rangeTanslations[key] = tarr
|
||||||
}
|
}
|
||||||
|
|
||||||
trans := &transText{
|
trans := &transText{
|
||||||
text: text,
|
text: text,
|
||||||
indexes: make([]int, 4, 4),
|
indexes: make([]int, 4),
|
||||||
}
|
}
|
||||||
|
|
||||||
tarr[rule] = trans
|
tarr[rule] = trans
|
||||||
|
|
3
vendor/github.com/go-playground/validator/v10/.gitignore
generated
vendored
3
vendor/github.com/go-playground/validator/v10/.gitignore
generated
vendored
|
@ -6,6 +6,7 @@
|
||||||
# Folders
|
# Folders
|
||||||
_obj
|
_obj
|
||||||
_test
|
_test
|
||||||
|
bin
|
||||||
|
|
||||||
# Architecture specific extensions/prefixes
|
# Architecture specific extensions/prefixes
|
||||||
*.[568vq]
|
*.[568vq]
|
||||||
|
@ -26,4 +27,4 @@ _testmain.go
|
||||||
*.out
|
*.out
|
||||||
*.txt
|
*.txt
|
||||||
cover.html
|
cover.html
|
||||||
README.html
|
README.html
|
||||||
|
|
29
vendor/github.com/go-playground/validator/v10/.travis.yml
generated
vendored
29
vendor/github.com/go-playground/validator/v10/.travis.yml
generated
vendored
|
@ -1,29 +0,0 @@
|
||||||
language: go
|
|
||||||
go:
|
|
||||||
- 1.13.4
|
|
||||||
- tip
|
|
||||||
matrix:
|
|
||||||
allow_failures:
|
|
||||||
- go: tip
|
|
||||||
|
|
||||||
notifications:
|
|
||||||
email:
|
|
||||||
recipients: dean.karn@gmail.com
|
|
||||||
on_success: change
|
|
||||||
on_failure: always
|
|
||||||
|
|
||||||
before_install:
|
|
||||||
- go install github.com/mattn/goveralls
|
|
||||||
- mkdir -p $GOPATH/src/gopkg.in
|
|
||||||
- ln -s $GOPATH/src/github.com/$TRAVIS_REPO_SLUG $GOPATH/src/gopkg.in/validator.v9
|
|
||||||
|
|
||||||
# Only clone the most recent commit.
|
|
||||||
git:
|
|
||||||
depth: 1
|
|
||||||
|
|
||||||
script:
|
|
||||||
- go test -v -race -covermode=atomic -coverprofile=coverage.coverprofile ./...
|
|
||||||
|
|
||||||
after_success: |
|
|
||||||
[ $TRAVIS_GO_VERSION = 1.13.4 ] &&
|
|
||||||
goveralls -coverprofile=coverage.coverprofile -service travis-ci -repotoken $COVERALLS_TOKEN
|
|
16
vendor/github.com/go-playground/validator/v10/MAINTAINERS.md
generated
vendored
Normal file
16
vendor/github.com/go-playground/validator/v10/MAINTAINERS.md
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
## Maintainers Guide
|
||||||
|
|
||||||
|
### Semantic Versioning
|
||||||
|
Semantic versioning as defined [here](https://semver.org) must be strictly adhered to.
|
||||||
|
|
||||||
|
### External Dependencies
|
||||||
|
Any new external dependencies MUST:
|
||||||
|
- Have a compatible LICENSE present.
|
||||||
|
- Be actively maintained.
|
||||||
|
- Be approved by @go-playground/admins
|
||||||
|
|
||||||
|
### PR Merge Requirements
|
||||||
|
- Up-to-date branch.
|
||||||
|
- Passing tests and linting.
|
||||||
|
- CODEOWNERS approval.
|
||||||
|
- Tests that cover both the Happy and Unhappy paths.
|
4
vendor/github.com/go-playground/validator/v10/Makefile
generated
vendored
4
vendor/github.com/go-playground/validator/v10/Makefile
generated
vendored
|
@ -3,11 +3,11 @@ GOCMD=GO111MODULE=on go
|
||||||
linters-install:
|
linters-install:
|
||||||
@golangci-lint --version >/dev/null 2>&1 || { \
|
@golangci-lint --version >/dev/null 2>&1 || { \
|
||||||
echo "installing linting tools..."; \
|
echo "installing linting tools..."; \
|
||||||
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s v1.21.0; \
|
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s v1.41.1; \
|
||||||
}
|
}
|
||||||
|
|
||||||
lint: linters-install
|
lint: linters-install
|
||||||
$(PWD)/bin/golangci-lint run
|
golangci-lint run
|
||||||
|
|
||||||
test:
|
test:
|
||||||
$(GOCMD) test -cover -race ./...
|
$(GOCMD) test -cover -race ./...
|
||||||
|
|
186
vendor/github.com/go-playground/validator/v10/README.md
generated
vendored
186
vendor/github.com/go-playground/validator/v10/README.md
generated
vendored
|
@ -1,20 +1,20 @@
|
||||||
Package validator
|
Package validator
|
||||||
================
|
=================
|
||||||
<img align="right" src="https://raw.githubusercontent.com/go-playground/validator/v9/logo.png">[![Join the chat at https://gitter.im/go-playground/validator](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/go-playground/validator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
<img align="right" src="https://raw.githubusercontent.com/go-playground/validator/v9/logo.png">[![Join the chat at https://gitter.im/go-playground/validator](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/go-playground/validator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||||
![Project status](https://img.shields.io/badge/version-10.1.0-green.svg)
|
![Project status](https://img.shields.io/badge/version-10.9.0-green.svg)
|
||||||
[![Build Status](https://travis-ci.org/go-playground/validator.svg?branch=master)](https://travis-ci.org/go-playground/validator)
|
[![Build Status](https://travis-ci.org/go-playground/validator.svg?branch=master)](https://travis-ci.org/go-playground/validator)
|
||||||
[![Coverage Status](https://coveralls.io/repos/go-playground/validator/badge.svg?branch=master&service=github)](https://coveralls.io/github/go-playground/validator?branch=master)
|
[![Coverage Status](https://coveralls.io/repos/go-playground/validator/badge.svg?branch=master&service=github)](https://coveralls.io/github/go-playground/validator?branch=master)
|
||||||
[![Go Report Card](https://goreportcard.com/badge/github.com/go-playground/validator)](https://goreportcard.com/report/github.com/go-playground/validator)
|
[![Go Report Card](https://goreportcard.com/badge/github.com/go-playground/validator)](https://goreportcard.com/report/github.com/go-playground/validator)
|
||||||
[![GoDoc](https://godoc.org/github.com/go-playground/validator?status.svg)](https://godoc.org/github.com/go-playground/validator)
|
[![GoDoc](https://godoc.org/github.com/go-playground/validator?status.svg)](https://pkg.go.dev/github.com/go-playground/validator/v10)
|
||||||
![License](https://img.shields.io/dub/l/vibe-d.svg)
|
![License](https://img.shields.io/dub/l/vibe-d.svg)
|
||||||
|
|
||||||
Package validator implements value validations for structs and individual fields based on tags.
|
Package validator implements value validations for structs and individual fields based on tags.
|
||||||
|
|
||||||
It has the following **unique** features:
|
It has the following **unique** features:
|
||||||
|
|
||||||
- Cross Field and Cross Struct validations by using validation tags or custom validators.
|
- Cross Field and Cross Struct validations by using validation tags or custom validators.
|
||||||
- Slice, Array and Map diving, which allows any or all levels of a multidimensional field to be validated.
|
- Slice, Array and Map diving, which allows any or all levels of a multidimensional field to be validated.
|
||||||
- Ability to dive into both map keys and values for validation
|
- Ability to dive into both map keys and values for validation
|
||||||
- Handles type interface by determining it's underlying type prior to validation.
|
- Handles type interface by determining it's underlying type prior to validation.
|
||||||
- Handles custom field types such as sql driver Valuer see [Valuer](https://golang.org/src/database/sql/driver/types.go?s=1210:1293#L29)
|
- Handles custom field types such as sql driver Valuer see [Valuer](https://golang.org/src/database/sql/driver/types.go?s=1210:1293#L29)
|
||||||
- Alias validation tags, which allows for mapping of several validations to a single tag for easier defining of validations on structs
|
- Alias validation tags, which allows for mapping of several validations to a single tag for easier defining of validations on structs
|
||||||
|
@ -43,7 +43,7 @@ They return type error to avoid the issue discussed in the following, where err
|
||||||
* http://stackoverflow.com/a/29138676/3158232
|
* http://stackoverflow.com/a/29138676/3158232
|
||||||
* https://github.com/go-playground/validator/issues/134
|
* https://github.com/go-playground/validator/issues/134
|
||||||
|
|
||||||
Validator only InvalidValidationError for bad validation input, nil or ValidationErrors as type error; so, in your code all you need to do is check if the error returned is not nil, and if it's not check if error is InvalidValidationError ( if necessary, most of the time it isn't ) type cast it to type ValidationErrors like so:
|
Validator returns only InvalidValidationError for bad validation input, nil or ValidationErrors as type error; so, in your code all you need to do is check if the error returned is not nil, and if it's not check if error is InvalidValidationError ( if necessary, most of the time it isn't ) type cast it to type ValidationErrors like so:
|
||||||
|
|
||||||
```go
|
```go
|
||||||
err := validate.Struct(mystruct)
|
err := validate.Struct(mystruct)
|
||||||
|
@ -53,7 +53,7 @@ validationErrors := err.(validator.ValidationErrors)
|
||||||
Usage and documentation
|
Usage and documentation
|
||||||
------
|
------
|
||||||
|
|
||||||
Please see https://godoc.org/github.com/go-playground/validator for detailed usage docs.
|
Please see https://pkg.go.dev/github.com/go-playground/validator/v10 for detailed usage docs.
|
||||||
|
|
||||||
##### Examples:
|
##### Examples:
|
||||||
|
|
||||||
|
@ -64,6 +64,171 @@ Please see https://godoc.org/github.com/go-playground/validator for detailed usa
|
||||||
- [Gin upgrade and/or override validator](https://github.com/go-playground/validator/tree/v9/_examples/gin-upgrading-overriding)
|
- [Gin upgrade and/or override validator](https://github.com/go-playground/validator/tree/v9/_examples/gin-upgrading-overriding)
|
||||||
- [wash - an example application putting it all together](https://github.com/bluesuncorp/wash)
|
- [wash - an example application putting it all together](https://github.com/bluesuncorp/wash)
|
||||||
|
|
||||||
|
Baked-in Validations
|
||||||
|
------
|
||||||
|
|
||||||
|
### Fields:
|
||||||
|
|
||||||
|
| Tag | Description |
|
||||||
|
| - | - |
|
||||||
|
| eqcsfield | Field Equals Another Field (relative)|
|
||||||
|
| eqfield | Field Equals Another Field |
|
||||||
|
| fieldcontains | NOT DOCUMENTED IN doc.go |
|
||||||
|
| fieldexcludes | NOT DOCUMENTED IN doc.go |
|
||||||
|
| gtcsfield | Field Greater Than Another Relative Field |
|
||||||
|
| gtecsfield | Field Greater Than or Equal To Another Relative Field |
|
||||||
|
| gtefield | Field Greater Than or Equal To Another Field |
|
||||||
|
| gtfield | Field Greater Than Another Field |
|
||||||
|
| ltcsfield | Less Than Another Relative Field |
|
||||||
|
| ltecsfield | Less Than or Equal To Another Relative Field |
|
||||||
|
| ltefield | Less Than or Equal To Another Field |
|
||||||
|
| ltfield | Less Than Another Field |
|
||||||
|
| necsfield | Field Does Not Equal Another Field (relative) |
|
||||||
|
| nefield | Field Does Not Equal Another Field |
|
||||||
|
|
||||||
|
### Network:
|
||||||
|
|
||||||
|
| Tag | Description |
|
||||||
|
| - | - |
|
||||||
|
| cidr | Classless Inter-Domain Routing CIDR |
|
||||||
|
| cidrv4 | Classless Inter-Domain Routing CIDRv4 |
|
||||||
|
| cidrv6 | Classless Inter-Domain Routing CIDRv6 |
|
||||||
|
| datauri | Data URL |
|
||||||
|
| fqdn | Full Qualified Domain Name (FQDN) |
|
||||||
|
| hostname | Hostname RFC 952 |
|
||||||
|
| hostname_port | HostPort |
|
||||||
|
| hostname_rfc1123 | Hostname RFC 1123 |
|
||||||
|
| ip | Internet Protocol Address IP |
|
||||||
|
| ip4_addr | Internet Protocol Address IPv4 |
|
||||||
|
| ip6_addr | Internet Protocol Address IPv6 |
|
||||||
|
| ip_addr | Internet Protocol Address IP |
|
||||||
|
| ipv4 | Internet Protocol Address IPv4 |
|
||||||
|
| ipv6 | Internet Protocol Address IPv6 |
|
||||||
|
| mac | Media Access Control Address MAC |
|
||||||
|
| tcp4_addr | Transmission Control Protocol Address TCPv4 |
|
||||||
|
| tcp6_addr | Transmission Control Protocol Address TCPv6 |
|
||||||
|
| tcp_addr | Transmission Control Protocol Address TCP |
|
||||||
|
| udp4_addr | User Datagram Protocol Address UDPv4 |
|
||||||
|
| udp6_addr | User Datagram Protocol Address UDPv6 |
|
||||||
|
| udp_addr | User Datagram Protocol Address UDP |
|
||||||
|
| unix_addr | Unix domain socket end point Address |
|
||||||
|
| uri | URI String |
|
||||||
|
| url | URL String |
|
||||||
|
| url_encoded | URL Encoded |
|
||||||
|
| urn_rfc2141 | Urn RFC 2141 String |
|
||||||
|
|
||||||
|
### Strings:
|
||||||
|
|
||||||
|
| Tag | Description |
|
||||||
|
| - | - |
|
||||||
|
| alpha | Alpha Only |
|
||||||
|
| alphanum | Alphanumeric |
|
||||||
|
| alphanumunicode | Alphanumeric Unicode |
|
||||||
|
| alphaunicode | Alpha Unicode |
|
||||||
|
| ascii | ASCII |
|
||||||
|
| boolean | Boolean |
|
||||||
|
| contains | Contains |
|
||||||
|
| containsany | Contains Any |
|
||||||
|
| containsrune | Contains Rune |
|
||||||
|
| endsnotwith | Ends With |
|
||||||
|
| endswith | Ends With |
|
||||||
|
| excludes | Excludes |
|
||||||
|
| excludesall | Excludes All |
|
||||||
|
| excludesrune | Excludes Rune |
|
||||||
|
| lowercase | Lowercase |
|
||||||
|
| multibyte | Multi-Byte Characters |
|
||||||
|
| number | NOT DOCUMENTED IN doc.go |
|
||||||
|
| numeric | Numeric |
|
||||||
|
| printascii | Printable ASCII |
|
||||||
|
| startsnotwith | Starts Not With |
|
||||||
|
| startswith | Starts With |
|
||||||
|
| uppercase | Uppercase |
|
||||||
|
|
||||||
|
### Format:
|
||||||
|
| Tag | Description |
|
||||||
|
| - | - |
|
||||||
|
| base64 | Base64 String |
|
||||||
|
| base64url | Base64URL String |
|
||||||
|
| bic | Business Identifier Code (ISO 9362) |
|
||||||
|
| bcp47_language_tag | Language tag (BCP 47) |
|
||||||
|
| btc_addr | Bitcoin Address |
|
||||||
|
| btc_addr_bech32 | Bitcoin Bech32 Address (segwit) |
|
||||||
|
| datetime | Datetime |
|
||||||
|
| e164 | e164 formatted phone number |
|
||||||
|
| email | E-mail String
|
||||||
|
| eth_addr | Ethereum Address |
|
||||||
|
| hexadecimal | Hexadecimal String |
|
||||||
|
| hexcolor | Hexcolor String |
|
||||||
|
| hsl | HSL String |
|
||||||
|
| hsla | HSLA String |
|
||||||
|
| html | HTML Tags |
|
||||||
|
| html_encoded | HTML Encoded |
|
||||||
|
| isbn | International Standard Book Number |
|
||||||
|
| isbn10 | International Standard Book Number 10 |
|
||||||
|
| isbn13 | International Standard Book Number 13 |
|
||||||
|
| iso3166_1_alpha2 | Two-letter country code (ISO 3166-1 alpha-2) |
|
||||||
|
| iso3166_1_alpha3 | Three-letter country code (ISO 3166-1 alpha-3) |
|
||||||
|
| iso3166_1_alpha_numeric | Numeric country code (ISO 3166-1 numeric) |
|
||||||
|
| iso3166_2 | Country subdivision code (ISO 3166-2) |
|
||||||
|
| iso4217 | Currency code (ISO 4217) |
|
||||||
|
| json | JSON |
|
||||||
|
| jwt | JSON Web Token (JWT) |
|
||||||
|
| latitude | Latitude |
|
||||||
|
| longitude | Longitude |
|
||||||
|
| postcode_iso3166_alpha2 | Postcode |
|
||||||
|
| postcode_iso3166_alpha2_field | Postcode |
|
||||||
|
| rgb | RGB String |
|
||||||
|
| rgba | RGBA String |
|
||||||
|
| ssn | Social Security Number SSN |
|
||||||
|
| timezone | Timezone |
|
||||||
|
| uuid | Universally Unique Identifier UUID |
|
||||||
|
| uuid3 | Universally Unique Identifier UUID v3 |
|
||||||
|
| uuid3_rfc4122 | Universally Unique Identifier UUID v3 RFC4122 |
|
||||||
|
| uuid4 | Universally Unique Identifier UUID v4 |
|
||||||
|
| uuid4_rfc4122 | Universally Unique Identifier UUID v4 RFC4122 |
|
||||||
|
| uuid5 | Universally Unique Identifier UUID v5 |
|
||||||
|
| uuid5_rfc4122 | Universally Unique Identifier UUID v5 RFC4122 |
|
||||||
|
| uuid_rfc4122 | Universally Unique Identifier UUID RFC4122 |
|
||||||
|
|
||||||
|
### Comparisons:
|
||||||
|
| Tag | Description |
|
||||||
|
| - | - |
|
||||||
|
| eq | Equals |
|
||||||
|
| gt | Greater than|
|
||||||
|
| gte | Greater than or equal |
|
||||||
|
| lt | Less Than |
|
||||||
|
| lte | Less Than or Equal |
|
||||||
|
| ne | Not Equal |
|
||||||
|
|
||||||
|
### Other:
|
||||||
|
| Tag | Description |
|
||||||
|
| - | - |
|
||||||
|
| dir | Directory |
|
||||||
|
| file | File path |
|
||||||
|
| isdefault | Is Default |
|
||||||
|
| len | Length |
|
||||||
|
| max | Maximum |
|
||||||
|
| min | Minimum |
|
||||||
|
| oneof | One Of |
|
||||||
|
| required | Required |
|
||||||
|
| required_if | Required If |
|
||||||
|
| required_unless | Required Unless |
|
||||||
|
| required_with | Required With |
|
||||||
|
| required_with_all | Required With All |
|
||||||
|
| required_without | Required Without |
|
||||||
|
| required_without_all | Required Without All |
|
||||||
|
| excluded_with | Excluded With |
|
||||||
|
| excluded_with_all | Excluded With All |
|
||||||
|
| excluded_without | Excluded Without |
|
||||||
|
| excluded_without_all | Excluded Without All |
|
||||||
|
| unique | Unique |
|
||||||
|
|
||||||
|
#### Aliases:
|
||||||
|
| Tag | Description |
|
||||||
|
| - | - |
|
||||||
|
| iscolor | hexcolor\|rgb\|rgba\|hsl\|hsla |
|
||||||
|
| country_code | iso3166_1_alpha2\|iso3166_1_alpha3\|iso3166_1_alpha_numeric |
|
||||||
|
|
||||||
Benchmarks
|
Benchmarks
|
||||||
------
|
------
|
||||||
###### Run on MacBook Pro (15-inch, 2017) go version go1.10.2 darwin/amd64
|
###### Run on MacBook Pro (15-inch, 2017) go version go1.10.2 darwin/amd64
|
||||||
|
@ -149,5 +314,10 @@ How to Contribute
|
||||||
Make a pull request...
|
Make a pull request...
|
||||||
|
|
||||||
License
|
License
|
||||||
------
|
-------
|
||||||
Distributed under MIT License, please see license file within the code for more details.
|
Distributed under MIT License, please see license file within the code for more details.
|
||||||
|
|
||||||
|
Maintainers
|
||||||
|
-----------
|
||||||
|
This project has grown large enough that more than one person is required to properly support the community.
|
||||||
|
If you are interested in becoming a maintainer please reach out to me https://github.com/deankarn
|
||||||
|
|
778
vendor/github.com/go-playground/validator/v10/baked_in.go
generated
vendored
778
vendor/github.com/go-playground/validator/v10/baked_in.go
generated
vendored
File diff suppressed because it is too large
Load diff
1132
vendor/github.com/go-playground/validator/v10/country_codes.go
generated
vendored
Normal file
1132
vendor/github.com/go-playground/validator/v10/country_codes.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
79
vendor/github.com/go-playground/validator/v10/currency_codes.go
generated
vendored
Normal file
79
vendor/github.com/go-playground/validator/v10/currency_codes.go
generated
vendored
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
package validator
|
||||||
|
|
||||||
|
var iso4217 = map[string]bool{
|
||||||
|
"AFN": true, "EUR": true, "ALL": true, "DZD": true, "USD": true,
|
||||||
|
"AOA": true, "XCD": true, "ARS": true, "AMD": true, "AWG": true,
|
||||||
|
"AUD": true, "AZN": true, "BSD": true, "BHD": true, "BDT": true,
|
||||||
|
"BBD": true, "BYN": true, "BZD": true, "XOF": true, "BMD": true,
|
||||||
|
"INR": true, "BTN": true, "BOB": true, "BOV": true, "BAM": true,
|
||||||
|
"BWP": true, "NOK": true, "BRL": true, "BND": true, "BGN": true,
|
||||||
|
"BIF": true, "CVE": true, "KHR": true, "XAF": true, "CAD": true,
|
||||||
|
"KYD": true, "CLP": true, "CLF": true, "CNY": true, "COP": true,
|
||||||
|
"COU": true, "KMF": true, "CDF": true, "NZD": true, "CRC": true,
|
||||||
|
"HRK": true, "CUP": true, "CUC": true, "ANG": true, "CZK": true,
|
||||||
|
"DKK": true, "DJF": true, "DOP": true, "EGP": true, "SVC": true,
|
||||||
|
"ERN": true, "SZL": true, "ETB": true, "FKP": true, "FJD": true,
|
||||||
|
"XPF": true, "GMD": true, "GEL": true, "GHS": true, "GIP": true,
|
||||||
|
"GTQ": true, "GBP": true, "GNF": true, "GYD": true, "HTG": true,
|
||||||
|
"HNL": true, "HKD": true, "HUF": true, "ISK": true, "IDR": true,
|
||||||
|
"XDR": true, "IRR": true, "IQD": true, "ILS": true, "JMD": true,
|
||||||
|
"JPY": true, "JOD": true, "KZT": true, "KES": true, "KPW": true,
|
||||||
|
"KRW": true, "KWD": true, "KGS": true, "LAK": true, "LBP": true,
|
||||||
|
"LSL": true, "ZAR": true, "LRD": true, "LYD": true, "CHF": true,
|
||||||
|
"MOP": true, "MKD": true, "MGA": true, "MWK": true, "MYR": true,
|
||||||
|
"MVR": true, "MRU": true, "MUR": true, "XUA": true, "MXN": true,
|
||||||
|
"MXV": true, "MDL": true, "MNT": true, "MAD": true, "MZN": true,
|
||||||
|
"MMK": true, "NAD": true, "NPR": true, "NIO": true, "NGN": true,
|
||||||
|
"OMR": true, "PKR": true, "PAB": true, "PGK": true, "PYG": true,
|
||||||
|
"PEN": true, "PHP": true, "PLN": true, "QAR": true, "RON": true,
|
||||||
|
"RUB": true, "RWF": true, "SHP": true, "WST": true, "STN": true,
|
||||||
|
"SAR": true, "RSD": true, "SCR": true, "SLL": true, "SGD": true,
|
||||||
|
"XSU": true, "SBD": true, "SOS": true, "SSP": true, "LKR": true,
|
||||||
|
"SDG": true, "SRD": true, "SEK": true, "CHE": true, "CHW": true,
|
||||||
|
"SYP": true, "TWD": true, "TJS": true, "TZS": true, "THB": true,
|
||||||
|
"TOP": true, "TTD": true, "TND": true, "TRY": true, "TMT": true,
|
||||||
|
"UGX": true, "UAH": true, "AED": true, "USN": true, "UYU": true,
|
||||||
|
"UYI": true, "UYW": true, "UZS": true, "VUV": true, "VES": true,
|
||||||
|
"VND": true, "YER": true, "ZMW": true, "ZWL": true, "XBA": true,
|
||||||
|
"XBB": true, "XBC": true, "XBD": true, "XTS": true, "XXX": true,
|
||||||
|
"XAU": true, "XPD": true, "XPT": true, "XAG": true,
|
||||||
|
}
|
||||||
|
|
||||||
|
var iso4217_numeric = map[int]bool{
|
||||||
|
8: true, 12: true, 32: true, 36: true, 44: true,
|
||||||
|
48: true, 50: true, 51: true, 52: true, 60: true,
|
||||||
|
64: true, 68: true, 72: true, 84: true, 90: true,
|
||||||
|
96: true, 104: true, 108: true, 116: true, 124: true,
|
||||||
|
132: true, 136: true, 144: true, 152: true, 156: true,
|
||||||
|
170: true, 174: true, 188: true, 191: true, 192: true,
|
||||||
|
203: true, 208: true, 214: true, 222: true, 230: true,
|
||||||
|
232: true, 238: true, 242: true, 262: true, 270: true,
|
||||||
|
292: true, 320: true, 324: true, 328: true, 332: true,
|
||||||
|
340: true, 344: true, 348: true, 352: true, 356: true,
|
||||||
|
360: true, 364: true, 368: true, 376: true, 388: true,
|
||||||
|
392: true, 398: true, 400: true, 404: true, 408: true,
|
||||||
|
410: true, 414: true, 417: true, 418: true, 422: true,
|
||||||
|
426: true, 430: true, 434: true, 446: true, 454: true,
|
||||||
|
458: true, 462: true, 480: true, 484: true, 496: true,
|
||||||
|
498: true, 504: true, 512: true, 516: true, 524: true,
|
||||||
|
532: true, 533: true, 548: true, 554: true, 558: true,
|
||||||
|
566: true, 578: true, 586: true, 590: true, 598: true,
|
||||||
|
600: true, 604: true, 608: true, 634: true, 643: true,
|
||||||
|
646: true, 654: true, 682: true, 690: true, 694: true,
|
||||||
|
702: true, 704: true, 706: true, 710: true, 728: true,
|
||||||
|
748: true, 752: true, 756: true, 760: true, 764: true,
|
||||||
|
776: true, 780: true, 784: true, 788: true, 800: true,
|
||||||
|
807: true, 818: true, 826: true, 834: true, 840: true,
|
||||||
|
858: true, 860: true, 882: true, 886: true, 901: true,
|
||||||
|
927: true, 928: true, 929: true, 930: true, 931: true,
|
||||||
|
932: true, 933: true, 934: true, 936: true, 938: true,
|
||||||
|
940: true, 941: true, 943: true, 944: true, 946: true,
|
||||||
|
947: true, 948: true, 949: true, 950: true, 951: true,
|
||||||
|
952: true, 953: true, 955: true, 956: true, 957: true,
|
||||||
|
958: true, 959: true, 960: true, 961: true, 962: true,
|
||||||
|
963: true, 964: true, 965: true, 967: true, 968: true,
|
||||||
|
969: true, 970: true, 971: true, 972: true, 973: true,
|
||||||
|
975: true, 976: true, 977: true, 978: true, 979: true,
|
||||||
|
980: true, 981: true, 984: true, 985: true, 986: true,
|
||||||
|
990: true, 994: true, 997: true, 999: true,
|
||||||
|
}
|
229
vendor/github.com/go-playground/validator/v10/doc.go
generated
vendored
229
vendor/github.com/go-playground/validator/v10/doc.go
generated
vendored
|
@ -7,6 +7,14 @@ and has the ability to dive into arrays and maps of any type.
|
||||||
|
|
||||||
see more examples https://github.com/go-playground/validator/tree/master/_examples
|
see more examples https://github.com/go-playground/validator/tree/master/_examples
|
||||||
|
|
||||||
|
Singleton
|
||||||
|
|
||||||
|
Validator is designed to be thread-safe and used as a singleton instance.
|
||||||
|
It caches information about your struct and validations,
|
||||||
|
in essence only parsing your validation tags once per struct type.
|
||||||
|
Using multiple instances neglects the benefit of caching.
|
||||||
|
The not thread-safe functions are explicitly marked as such in the documentation.
|
||||||
|
|
||||||
Validation Functions Return Type error
|
Validation Functions Return Type error
|
||||||
|
|
||||||
Doing things this way is actually the way the standard library does, see the
|
Doing things this way is actually the way the standard library does, see the
|
||||||
|
@ -245,6 +253,40 @@ ensures the value is not nil.
|
||||||
|
|
||||||
Usage: required
|
Usage: required
|
||||||
|
|
||||||
|
Required If
|
||||||
|
|
||||||
|
The field under validation must be present and not empty only if all
|
||||||
|
the other specified fields are equal to the value following the specified
|
||||||
|
field. For strings ensures value is not "". For slices, maps, pointers,
|
||||||
|
interfaces, channels and functions ensures the value is not nil.
|
||||||
|
|
||||||
|
Usage: required_if
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
// require the field if the Field1 is equal to the parameter given:
|
||||||
|
Usage: required_if=Field1 foobar
|
||||||
|
|
||||||
|
// require the field if the Field1 and Field2 is equal to the value respectively:
|
||||||
|
Usage: required_if=Field1 foo Field2 bar
|
||||||
|
|
||||||
|
Required Unless
|
||||||
|
|
||||||
|
The field under validation must be present and not empty unless all
|
||||||
|
the other specified fields are equal to the value following the specified
|
||||||
|
field. For strings ensures value is not "". For slices, maps, pointers,
|
||||||
|
interfaces, channels and functions ensures the value is not nil.
|
||||||
|
|
||||||
|
Usage: required_unless
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
// require the field unless the Field1 is equal to the parameter given:
|
||||||
|
Usage: required_unless=Field1 foobar
|
||||||
|
|
||||||
|
// require the field unless the Field1 and Field2 is equal to the value respectively:
|
||||||
|
Usage: required_unless=Field1 foo Field2 bar
|
||||||
|
|
||||||
Required With
|
Required With
|
||||||
|
|
||||||
The field under validation must be present and not empty only if any
|
The field under validation must be present and not empty only if any
|
||||||
|
@ -321,8 +363,17 @@ equal to the parameter given. For strings, it checks that
|
||||||
the string length is exactly that number of characters. For slices,
|
the string length is exactly that number of characters. For slices,
|
||||||
arrays, and maps, validates the number of items.
|
arrays, and maps, validates the number of items.
|
||||||
|
|
||||||
|
Example #1
|
||||||
|
|
||||||
Usage: len=10
|
Usage: len=10
|
||||||
|
|
||||||
|
Example #2 (time.Duration)
|
||||||
|
|
||||||
|
For time.Duration, len will ensure that the value is equal to the duration given
|
||||||
|
in the parameter.
|
||||||
|
|
||||||
|
Usage: len=1h30m
|
||||||
|
|
||||||
Maximum
|
Maximum
|
||||||
|
|
||||||
For numbers, max will ensure that the value is
|
For numbers, max will ensure that the value is
|
||||||
|
@ -330,8 +381,17 @@ less than or equal to the parameter given. For strings, it checks
|
||||||
that the string length is at most that number of characters. For
|
that the string length is at most that number of characters. For
|
||||||
slices, arrays, and maps, validates the number of items.
|
slices, arrays, and maps, validates the number of items.
|
||||||
|
|
||||||
|
Example #1
|
||||||
|
|
||||||
Usage: max=10
|
Usage: max=10
|
||||||
|
|
||||||
|
Example #2 (time.Duration)
|
||||||
|
|
||||||
|
For time.Duration, max will ensure that the value is less than or equal to the
|
||||||
|
duration given in the parameter.
|
||||||
|
|
||||||
|
Usage: max=1h30m
|
||||||
|
|
||||||
Minimum
|
Minimum
|
||||||
|
|
||||||
For numbers, min will ensure that the value is
|
For numbers, min will ensure that the value is
|
||||||
|
@ -339,24 +399,51 @@ greater or equal to the parameter given. For strings, it checks that
|
||||||
the string length is at least that number of characters. For slices,
|
the string length is at least that number of characters. For slices,
|
||||||
arrays, and maps, validates the number of items.
|
arrays, and maps, validates the number of items.
|
||||||
|
|
||||||
|
Example #1
|
||||||
|
|
||||||
Usage: min=10
|
Usage: min=10
|
||||||
|
|
||||||
|
Example #2 (time.Duration)
|
||||||
|
|
||||||
|
For time.Duration, min will ensure that the value is greater than or equal to
|
||||||
|
the duration given in the parameter.
|
||||||
|
|
||||||
|
Usage: min=1h30m
|
||||||
|
|
||||||
Equals
|
Equals
|
||||||
|
|
||||||
For strings & numbers, eq will ensure that the value is
|
For strings & numbers, eq will ensure that the value is
|
||||||
equal to the parameter given. For slices, arrays, and maps,
|
equal to the parameter given. For slices, arrays, and maps,
|
||||||
validates the number of items.
|
validates the number of items.
|
||||||
|
|
||||||
|
Example #1
|
||||||
|
|
||||||
Usage: eq=10
|
Usage: eq=10
|
||||||
|
|
||||||
|
Example #2 (time.Duration)
|
||||||
|
|
||||||
|
For time.Duration, eq will ensure that the value is equal to the duration given
|
||||||
|
in the parameter.
|
||||||
|
|
||||||
|
Usage: eq=1h30m
|
||||||
|
|
||||||
Not Equal
|
Not Equal
|
||||||
|
|
||||||
For strings & numbers, ne will ensure that the value is not
|
For strings & numbers, ne will ensure that the value is not
|
||||||
equal to the parameter given. For slices, arrays, and maps,
|
equal to the parameter given. For slices, arrays, and maps,
|
||||||
validates the number of items.
|
validates the number of items.
|
||||||
|
|
||||||
|
Example #1
|
||||||
|
|
||||||
Usage: ne=10
|
Usage: ne=10
|
||||||
|
|
||||||
|
Example #2 (time.Duration)
|
||||||
|
|
||||||
|
For time.Duration, ne will ensure that the value is not equal to the duration
|
||||||
|
given in the parameter.
|
||||||
|
|
||||||
|
Usage: ne=1h30m
|
||||||
|
|
||||||
One Of
|
One Of
|
||||||
|
|
||||||
For strings, ints, and uints, oneof will ensure that the value
|
For strings, ints, and uints, oneof will ensure that the value
|
||||||
|
@ -386,11 +473,17 @@ For time.Time ensures the time value is greater than time.Now.UTC().
|
||||||
|
|
||||||
Usage: gt
|
Usage: gt
|
||||||
|
|
||||||
|
Example #3 (time.Duration)
|
||||||
|
|
||||||
|
For time.Duration, gt will ensure that the value is greater than the duration
|
||||||
|
given in the parameter.
|
||||||
|
|
||||||
|
Usage: gt=1h30m
|
||||||
|
|
||||||
Greater Than or Equal
|
Greater Than or Equal
|
||||||
|
|
||||||
Same as 'min' above. Kept both to make terminology with 'len' easier.
|
Same as 'min' above. Kept both to make terminology with 'len' easier.
|
||||||
|
|
||||||
|
|
||||||
Example #1
|
Example #1
|
||||||
|
|
||||||
Usage: gte=10
|
Usage: gte=10
|
||||||
|
@ -401,6 +494,13 @@ For time.Time ensures the time value is greater than or equal to time.Now.UTC().
|
||||||
|
|
||||||
Usage: gte
|
Usage: gte
|
||||||
|
|
||||||
|
Example #3 (time.Duration)
|
||||||
|
|
||||||
|
For time.Duration, gte will ensure that the value is greater than or equal to
|
||||||
|
the duration given in the parameter.
|
||||||
|
|
||||||
|
Usage: gte=1h30m
|
||||||
|
|
||||||
Less Than
|
Less Than
|
||||||
|
|
||||||
For numbers, this will ensure that the value is less than the parameter given.
|
For numbers, this will ensure that the value is less than the parameter given.
|
||||||
|
@ -412,10 +512,18 @@ Example #1
|
||||||
Usage: lt=10
|
Usage: lt=10
|
||||||
|
|
||||||
Example #2 (time.Time)
|
Example #2 (time.Time)
|
||||||
|
|
||||||
For time.Time ensures the time value is less than time.Now.UTC().
|
For time.Time ensures the time value is less than time.Now.UTC().
|
||||||
|
|
||||||
Usage: lt
|
Usage: lt
|
||||||
|
|
||||||
|
Example #3 (time.Duration)
|
||||||
|
|
||||||
|
For time.Duration, lt will ensure that the value is less than the duration given
|
||||||
|
in the parameter.
|
||||||
|
|
||||||
|
Usage: lt=1h30m
|
||||||
|
|
||||||
Less Than or Equal
|
Less Than or Equal
|
||||||
|
|
||||||
Same as 'max' above. Kept both to make terminology with 'len' easier.
|
Same as 'max' above. Kept both to make terminology with 'len' easier.
|
||||||
|
@ -430,6 +538,13 @@ For time.Time ensures the time value is less than or equal to time.Now.UTC().
|
||||||
|
|
||||||
Usage: lte
|
Usage: lte
|
||||||
|
|
||||||
|
Example #3 (time.Duration)
|
||||||
|
|
||||||
|
For time.Duration, lte will ensure that the value is less than or equal to the
|
||||||
|
duration given in the parameter.
|
||||||
|
|
||||||
|
Usage: lte=1h30m
|
||||||
|
|
||||||
Field Equals Another Field
|
Field Equals Another Field
|
||||||
|
|
||||||
This will validate the field value against another fields value either within
|
This will validate the field value against another fields value either within
|
||||||
|
@ -476,9 +591,9 @@ relative to the top level struct.
|
||||||
|
|
||||||
Field Greater Than Another Field
|
Field Greater Than Another Field
|
||||||
|
|
||||||
Only valid for Numbers and time.Time types, this will validate the field value
|
Only valid for Numbers, time.Duration and time.Time types, this will validate
|
||||||
against another fields value either within a struct or passed in field.
|
the field value against another fields value either within a struct or passed in
|
||||||
usage examples are for validation of a Start and End date:
|
field. usage examples are for validation of a Start and End date:
|
||||||
|
|
||||||
Example #1:
|
Example #1:
|
||||||
|
|
||||||
|
@ -490,7 +605,6 @@ Example #2:
|
||||||
// Validating by field:
|
// Validating by field:
|
||||||
validate.VarWithValue(start, end, "gtfield")
|
validate.VarWithValue(start, end, "gtfield")
|
||||||
|
|
||||||
|
|
||||||
Field Greater Than Another Relative Field
|
Field Greater Than Another Relative Field
|
||||||
|
|
||||||
This does the same as gtfield except that it validates the field provided
|
This does the same as gtfield except that it validates the field provided
|
||||||
|
@ -500,9 +614,9 @@ relative to the top level struct.
|
||||||
|
|
||||||
Field Greater Than or Equal To Another Field
|
Field Greater Than or Equal To Another Field
|
||||||
|
|
||||||
Only valid for Numbers and time.Time types, this will validate the field value
|
Only valid for Numbers, time.Duration and time.Time types, this will validate
|
||||||
against another fields value either within a struct or passed in field.
|
the field value against another fields value either within a struct or passed in
|
||||||
usage examples are for validation of a Start and End date:
|
field. usage examples are for validation of a Start and End date:
|
||||||
|
|
||||||
Example #1:
|
Example #1:
|
||||||
|
|
||||||
|
@ -523,9 +637,9 @@ to the top level struct.
|
||||||
|
|
||||||
Less Than Another Field
|
Less Than Another Field
|
||||||
|
|
||||||
Only valid for Numbers and time.Time types, this will validate the field value
|
Only valid for Numbers, time.Duration and time.Time types, this will validate
|
||||||
against another fields value either within a struct or passed in field.
|
the field value against another fields value either within a struct or passed in
|
||||||
usage examples are for validation of a Start and End date:
|
field. usage examples are for validation of a Start and End date:
|
||||||
|
|
||||||
Example #1:
|
Example #1:
|
||||||
|
|
||||||
|
@ -546,9 +660,9 @@ to the top level struct.
|
||||||
|
|
||||||
Less Than or Equal To Another Field
|
Less Than or Equal To Another Field
|
||||||
|
|
||||||
Only valid for Numbers and time.Time types, this will validate the field value
|
Only valid for Numbers, time.Duration and time.Time types, this will validate
|
||||||
against another fields value either within a struct or passed in field.
|
the field value against another fields value either within a struct or passed in
|
||||||
usage examples are for validation of a Start and End date:
|
field. usage examples are for validation of a Start and End date:
|
||||||
|
|
||||||
Example #1:
|
Example #1:
|
||||||
|
|
||||||
|
@ -620,6 +734,19 @@ This validates that a string value contains unicode alphanumeric characters only
|
||||||
|
|
||||||
Usage: alphanumunicode
|
Usage: alphanumunicode
|
||||||
|
|
||||||
|
Boolean
|
||||||
|
|
||||||
|
This validates that a string value can successfully be parsed into a boolean with strconv.ParseBool
|
||||||
|
|
||||||
|
Usage: boolean
|
||||||
|
|
||||||
|
Number
|
||||||
|
|
||||||
|
This validates that a string value contains number values only.
|
||||||
|
For integers or float it returns true.
|
||||||
|
|
||||||
|
Usage: number
|
||||||
|
|
||||||
Numeric
|
Numeric
|
||||||
|
|
||||||
This validates that a string value contains a basic numeric value.
|
This validates that a string value contains a basic numeric value.
|
||||||
|
@ -677,6 +804,13 @@ This validates that a string value contains a valid hsla color
|
||||||
|
|
||||||
Usage: hsla
|
Usage: hsla
|
||||||
|
|
||||||
|
E.164 Phone Number String
|
||||||
|
|
||||||
|
This validates that a string value contains a valid E.164 Phone number
|
||||||
|
https://en.wikipedia.org/wiki/E.164 (ex. +1123456789)
|
||||||
|
|
||||||
|
Usage: e164
|
||||||
|
|
||||||
E-mail String
|
E-mail String
|
||||||
|
|
||||||
This validates that a string value contains a valid email
|
This validates that a string value contains a valid email
|
||||||
|
@ -691,6 +825,12 @@ This validates that a string value is valid JSON
|
||||||
|
|
||||||
Usage: json
|
Usage: json
|
||||||
|
|
||||||
|
JWT String
|
||||||
|
|
||||||
|
This validates that a string value is a valid JWT
|
||||||
|
|
||||||
|
Usage: jwt
|
||||||
|
|
||||||
File path
|
File path
|
||||||
|
|
||||||
This validates that a string value contains a valid file path and that
|
This validates that a string value contains a valid file path and that
|
||||||
|
@ -759,8 +899,7 @@ Special thanks to Pieter Wuille for providng reference implementations.
|
||||||
Ethereum Address
|
Ethereum Address
|
||||||
|
|
||||||
This validates that a string value contains a valid ethereum address.
|
This validates that a string value contains a valid ethereum address.
|
||||||
The format of the string is checked to ensure it matches the standard Ethereum address format
|
The format of the string is checked to ensure it matches the standard Ethereum address format.
|
||||||
Full validation is blocked by https://github.com/golang/crypto/pull/28
|
|
||||||
|
|
||||||
Usage: eth_addr
|
Usage: eth_addr
|
||||||
|
|
||||||
|
@ -814,6 +953,18 @@ This validates that a string value ends with the supplied string value
|
||||||
|
|
||||||
Usage: endswith=goodbye
|
Usage: endswith=goodbye
|
||||||
|
|
||||||
|
Does Not Start With
|
||||||
|
|
||||||
|
This validates that a string value does not start with the supplied string value
|
||||||
|
|
||||||
|
Usage: startsnotwith=hello
|
||||||
|
|
||||||
|
Does Not End With
|
||||||
|
|
||||||
|
This validates that a string value does not end with the supplied string value
|
||||||
|
|
||||||
|
Usage: endsnotwith=goodbye
|
||||||
|
|
||||||
International Standard Book Number
|
International Standard Book Number
|
||||||
|
|
||||||
This validates that a string value contains a valid isbn10 or isbn13 value.
|
This validates that a string value contains a valid isbn10 or isbn13 value.
|
||||||
|
@ -1069,6 +1220,50 @@ Supplied format must match the official Go time format layout as documented in h
|
||||||
|
|
||||||
Usage: datetime=2006-01-02
|
Usage: datetime=2006-01-02
|
||||||
|
|
||||||
|
Iso3166-1 alpha-2
|
||||||
|
|
||||||
|
This validates that a string value is a valid country code based on iso3166-1 alpha-2 standard.
|
||||||
|
see: https://www.iso.org/iso-3166-country-codes.html
|
||||||
|
|
||||||
|
Usage: iso3166_1_alpha2
|
||||||
|
|
||||||
|
Iso3166-1 alpha-3
|
||||||
|
|
||||||
|
This validates that a string value is a valid country code based on iso3166-1 alpha-3 standard.
|
||||||
|
see: https://www.iso.org/iso-3166-country-codes.html
|
||||||
|
|
||||||
|
Usage: iso3166_1_alpha3
|
||||||
|
|
||||||
|
Iso3166-1 alpha-numeric
|
||||||
|
|
||||||
|
This validates that a string value is a valid country code based on iso3166-1 alpha-numeric standard.
|
||||||
|
see: https://www.iso.org/iso-3166-country-codes.html
|
||||||
|
|
||||||
|
Usage: iso3166_1_alpha3
|
||||||
|
|
||||||
|
BCP 47 Language Tag
|
||||||
|
|
||||||
|
This validates that a string value is a valid BCP 47 language tag, as parsed by language.Parse.
|
||||||
|
More information on https://pkg.go.dev/golang.org/x/text/language
|
||||||
|
|
||||||
|
Usage: bcp47_language_tag
|
||||||
|
|
||||||
|
BIC (SWIFT code)
|
||||||
|
|
||||||
|
This validates that a string value is a valid Business Identifier Code (SWIFT code), defined in ISO 9362.
|
||||||
|
More information on https://www.iso.org/standard/60390.html
|
||||||
|
|
||||||
|
Usage: bic
|
||||||
|
|
||||||
|
TimeZone
|
||||||
|
|
||||||
|
This validates that a string value is a valid time zone based on the time zone database present on the system.
|
||||||
|
Although empty value and Local value are allowed by time.LoadLocation golang function, they are not allowed by this validator.
|
||||||
|
More information on https://golang.org/pkg/time/#LoadLocation
|
||||||
|
|
||||||
|
Usage: timezone
|
||||||
|
|
||||||
|
|
||||||
Alias Validators and Tags
|
Alias Validators and Tags
|
||||||
|
|
||||||
NOTE: When returning an error, the tag returned in "FieldError" will be
|
NOTE: When returning an error, the tag returned in "FieldError" will be
|
||||||
|
@ -1080,6 +1275,8 @@ Here is a list of the current built in alias tags:
|
||||||
|
|
||||||
"iscolor"
|
"iscolor"
|
||||||
alias is "hexcolor|rgb|rgba|hsl|hsla" (Usage: iscolor)
|
alias is "hexcolor|rgb|rgba|hsl|hsla" (Usage: iscolor)
|
||||||
|
"country_code"
|
||||||
|
alias is "iso3166_1_alpha2|iso3166_1_alpha3|iso3166_1_alpha_numeric" (Usage: country_code)
|
||||||
|
|
||||||
Validator notes:
|
Validator notes:
|
||||||
|
|
||||||
|
|
45
vendor/github.com/go-playground/validator/v10/errors.go
generated
vendored
45
vendor/github.com/go-playground/validator/v10/errors.go
generated
vendored
|
@ -82,7 +82,7 @@ func (ve ValidationErrors) Translate(ut ut.Translator) ValidationErrorsTranslati
|
||||||
// FieldError contains all functions to get error details
|
// FieldError contains all functions to get error details
|
||||||
type FieldError interface {
|
type FieldError interface {
|
||||||
|
|
||||||
// returns the validation tag that failed. if the
|
// Tag returns the validation tag that failed. if the
|
||||||
// validation was an alias, this will return the
|
// validation was an alias, this will return the
|
||||||
// alias name and not the underlying tag that failed.
|
// alias name and not the underlying tag that failed.
|
||||||
//
|
//
|
||||||
|
@ -90,7 +90,7 @@ type FieldError interface {
|
||||||
// will return "iscolor"
|
// will return "iscolor"
|
||||||
Tag() string
|
Tag() string
|
||||||
|
|
||||||
// returns the validation tag that failed, even if an
|
// ActualTag returns the validation tag that failed, even if an
|
||||||
// alias the actual tag within the alias will be returned.
|
// alias the actual tag within the alias will be returned.
|
||||||
// If an 'or' validation fails the entire or will be returned.
|
// If an 'or' validation fails the entire or will be returned.
|
||||||
//
|
//
|
||||||
|
@ -98,8 +98,8 @@ type FieldError interface {
|
||||||
// will return "hexcolor|rgb|rgba|hsl|hsla"
|
// will return "hexcolor|rgb|rgba|hsl|hsla"
|
||||||
ActualTag() string
|
ActualTag() string
|
||||||
|
|
||||||
// returns the namespace for the field error, with the tag
|
// Namespace returns the namespace for the field error, with the tag
|
||||||
// name taking precedence over the fields actual name.
|
// name taking precedence over the field's actual name.
|
||||||
//
|
//
|
||||||
// eg. JSON name "User.fname"
|
// eg. JSON name "User.fname"
|
||||||
//
|
//
|
||||||
|
@ -109,33 +109,33 @@ type FieldError interface {
|
||||||
// using validate.Field(...) as there is no way to extract it's name
|
// using validate.Field(...) as there is no way to extract it's name
|
||||||
Namespace() string
|
Namespace() string
|
||||||
|
|
||||||
// returns the namespace for the field error, with the fields
|
// StructNamespace returns the namespace for the field error, with the field's
|
||||||
// actual name.
|
// actual name.
|
||||||
//
|
//
|
||||||
// eq. "User.FirstName" see Namespace for comparison
|
// eq. "User.FirstName" see Namespace for comparison
|
||||||
//
|
//
|
||||||
// NOTE: this field can be blank when validating a single primitive field
|
// NOTE: this field can be blank when validating a single primitive field
|
||||||
// using validate.Field(...) as there is no way to extract it's name
|
// using validate.Field(...) as there is no way to extract its name
|
||||||
StructNamespace() string
|
StructNamespace() string
|
||||||
|
|
||||||
// returns the fields name with the tag name taking precedence over the
|
// Field returns the fields name with the tag name taking precedence over the
|
||||||
// fields actual name.
|
// field's actual name.
|
||||||
//
|
//
|
||||||
// eq. JSON name "fname"
|
// eq. JSON name "fname"
|
||||||
// see StructField for comparison
|
// see StructField for comparison
|
||||||
Field() string
|
Field() string
|
||||||
|
|
||||||
// returns the fields actual name from the struct, when able to determine.
|
// StructField returns the field's actual name from the struct, when able to determine.
|
||||||
//
|
//
|
||||||
// eq. "FirstName"
|
// eq. "FirstName"
|
||||||
// see Field for comparison
|
// see Field for comparison
|
||||||
StructField() string
|
StructField() string
|
||||||
|
|
||||||
// returns the actual fields value in case needed for creating the error
|
// Value returns the actual field's value in case needed for creating the error
|
||||||
// message
|
// message
|
||||||
Value() interface{}
|
Value() interface{}
|
||||||
|
|
||||||
// returns the param value, in string form for comparison; this will also
|
// Param returns the param value, in string form for comparison; this will also
|
||||||
// help with generating an error message
|
// help with generating an error message
|
||||||
Param() string
|
Param() string
|
||||||
|
|
||||||
|
@ -146,15 +146,18 @@ type FieldError interface {
|
||||||
|
|
||||||
// Type returns the Field's reflect Type
|
// Type returns the Field's reflect Type
|
||||||
//
|
//
|
||||||
// // eg. time.Time's type is time.Time
|
// eg. time.Time's type is time.Time
|
||||||
Type() reflect.Type
|
Type() reflect.Type
|
||||||
|
|
||||||
// returns the FieldError's translated error
|
// Translate returns the FieldError's translated error
|
||||||
// from the provided 'ut.Translator' and registered 'TranslationFunc'
|
// from the provided 'ut.Translator' and registered 'TranslationFunc'
|
||||||
//
|
//
|
||||||
// NOTE: if no registered translator can be found it returns the same as
|
// NOTE: if no registered translator can be found it returns the same as
|
||||||
// calling fe.Error()
|
// calling fe.Error()
|
||||||
Translate(ut ut.Translator) string
|
Translate(ut ut.Translator) string
|
||||||
|
|
||||||
|
// Error returns the FieldError's message
|
||||||
|
Error() string
|
||||||
}
|
}
|
||||||
|
|
||||||
// compile time interface checks
|
// compile time interface checks
|
||||||
|
@ -190,19 +193,19 @@ func (fe *fieldError) ActualTag() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Namespace returns the namespace for the field error, with the tag
|
// Namespace returns the namespace for the field error, with the tag
|
||||||
// name taking precedence over the fields actual name.
|
// name taking precedence over the field's actual name.
|
||||||
func (fe *fieldError) Namespace() string {
|
func (fe *fieldError) Namespace() string {
|
||||||
return fe.ns
|
return fe.ns
|
||||||
}
|
}
|
||||||
|
|
||||||
// StructNamespace returns the namespace for the field error, with the fields
|
// StructNamespace returns the namespace for the field error, with the field's
|
||||||
// actual name.
|
// actual name.
|
||||||
func (fe *fieldError) StructNamespace() string {
|
func (fe *fieldError) StructNamespace() string {
|
||||||
return fe.structNs
|
return fe.structNs
|
||||||
}
|
}
|
||||||
|
|
||||||
// Field returns the fields name with the tag name taking precedence over the
|
// Field returns the field's name with the tag name taking precedence over the
|
||||||
// fields actual name.
|
// field's actual name.
|
||||||
func (fe *fieldError) Field() string {
|
func (fe *fieldError) Field() string {
|
||||||
|
|
||||||
return fe.ns[len(fe.ns)-int(fe.fieldLen):]
|
return fe.ns[len(fe.ns)-int(fe.fieldLen):]
|
||||||
|
@ -218,13 +221,13 @@ func (fe *fieldError) Field() string {
|
||||||
// return fld
|
// return fld
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns the fields actual name from the struct, when able to determine.
|
// StructField returns the field's actual name from the struct, when able to determine.
|
||||||
func (fe *fieldError) StructField() string {
|
func (fe *fieldError) StructField() string {
|
||||||
// return fe.structField
|
// return fe.structField
|
||||||
return fe.structNs[len(fe.structNs)-int(fe.structfieldLen):]
|
return fe.structNs[len(fe.structNs)-int(fe.structfieldLen):]
|
||||||
}
|
}
|
||||||
|
|
||||||
// Value returns the actual fields value in case needed for creating the error
|
// Value returns the actual field's value in case needed for creating the error
|
||||||
// message
|
// message
|
||||||
func (fe *fieldError) Value() interface{} {
|
func (fe *fieldError) Value() interface{} {
|
||||||
return fe.value
|
return fe.value
|
||||||
|
@ -254,8 +257,8 @@ func (fe *fieldError) Error() string {
|
||||||
// Translate returns the FieldError's translated error
|
// Translate returns the FieldError's translated error
|
||||||
// from the provided 'ut.Translator' and registered 'TranslationFunc'
|
// from the provided 'ut.Translator' and registered 'TranslationFunc'
|
||||||
//
|
//
|
||||||
// NOTE: is not registered translation can be found it returns the same
|
// NOTE: if no registered translation can be found, it returns the original
|
||||||
// as calling fe.Error()
|
// untranslated error message.
|
||||||
func (fe *fieldError) Translate(ut ut.Translator) string {
|
func (fe *fieldError) Translate(ut ut.Translator) string {
|
||||||
|
|
||||||
m, ok := fe.v.transTagFunc[ut]
|
m, ok := fe.v.transTagFunc[ut]
|
||||||
|
|
23
vendor/github.com/go-playground/validator/v10/field_level.go
generated
vendored
23
vendor/github.com/go-playground/validator/v10/field_level.go
generated
vendored
|
@ -5,24 +5,25 @@ import "reflect"
|
||||||
// FieldLevel contains all the information and helper functions
|
// FieldLevel contains all the information and helper functions
|
||||||
// to validate a field
|
// to validate a field
|
||||||
type FieldLevel interface {
|
type FieldLevel interface {
|
||||||
// returns the top level struct, if any
|
|
||||||
|
// Top returns the top level struct, if any
|
||||||
Top() reflect.Value
|
Top() reflect.Value
|
||||||
|
|
||||||
// returns the current fields parent struct, if any or
|
// Parent returns the current fields parent struct, if any or
|
||||||
// the comparison value if called 'VarWithValue'
|
// the comparison value if called 'VarWithValue'
|
||||||
Parent() reflect.Value
|
Parent() reflect.Value
|
||||||
|
|
||||||
// returns current field for validation
|
// Field returns current field for validation
|
||||||
Field() reflect.Value
|
Field() reflect.Value
|
||||||
|
|
||||||
// returns the field's name with the tag
|
// FieldName returns the field's name with the tag
|
||||||
// name taking precedence over the fields actual name.
|
// name taking precedence over the fields actual name.
|
||||||
FieldName() string
|
FieldName() string
|
||||||
|
|
||||||
// returns the struct field's name
|
// StructFieldName returns the struct field's name
|
||||||
StructFieldName() string
|
StructFieldName() string
|
||||||
|
|
||||||
// returns param for validation against current field
|
// Param returns param for validation against current field
|
||||||
Param() string
|
Param() string
|
||||||
|
|
||||||
// GetTag returns the current validations tag name
|
// GetTag returns the current validations tag name
|
||||||
|
@ -33,7 +34,7 @@ type FieldLevel interface {
|
||||||
// underlying value and it's kind.
|
// underlying value and it's kind.
|
||||||
ExtractType(field reflect.Value) (value reflect.Value, kind reflect.Kind, nullable bool)
|
ExtractType(field reflect.Value) (value reflect.Value, kind reflect.Kind, nullable bool)
|
||||||
|
|
||||||
// traverses the parent struct to retrieve a specific field denoted by the provided namespace
|
// GetStructFieldOK traverses the parent struct to retrieve a specific field denoted by the provided namespace
|
||||||
// in the param and returns the field, field kind and whether is was successful in retrieving
|
// in the param and returns the field, field kind and whether is was successful in retrieving
|
||||||
// the field at all.
|
// the field at all.
|
||||||
//
|
//
|
||||||
|
@ -49,7 +50,7 @@ type FieldLevel interface {
|
||||||
// Deprecated: Use GetStructFieldOKAdvanced2() instead which also return if the value is nullable.
|
// Deprecated: Use GetStructFieldOKAdvanced2() instead which also return if the value is nullable.
|
||||||
GetStructFieldOKAdvanced(val reflect.Value, namespace string) (reflect.Value, reflect.Kind, bool)
|
GetStructFieldOKAdvanced(val reflect.Value, namespace string) (reflect.Value, reflect.Kind, bool)
|
||||||
|
|
||||||
// traverses the parent struct to retrieve a specific field denoted by the provided namespace
|
// GetStructFieldOK2 traverses the parent struct to retrieve a specific field denoted by the provided namespace
|
||||||
// in the param and returns the field, field kind, if it's a nullable type and whether is was successful in retrieving
|
// in the param and returns the field, field kind, if it's a nullable type and whether is was successful in retrieving
|
||||||
// the field at all.
|
// the field at all.
|
||||||
//
|
//
|
||||||
|
@ -57,7 +58,7 @@ type FieldLevel interface {
|
||||||
// could not be retrieved because it didn't exist.
|
// could not be retrieved because it didn't exist.
|
||||||
GetStructFieldOK2() (reflect.Value, reflect.Kind, bool, bool)
|
GetStructFieldOK2() (reflect.Value, reflect.Kind, bool, bool)
|
||||||
|
|
||||||
// GetStructFieldOKAdvanced is the same as GetStructFieldOK except that it accepts the parent struct to start looking for
|
// GetStructFieldOKAdvanced2 is the same as GetStructFieldOK except that it accepts the parent struct to start looking for
|
||||||
// the field and namespace allowing more extensibility for validators.
|
// the field and namespace allowing more extensibility for validators.
|
||||||
GetStructFieldOKAdvanced2(val reflect.Value, namespace string) (reflect.Value, reflect.Kind, bool, bool)
|
GetStructFieldOKAdvanced2(val reflect.Value, namespace string) (reflect.Value, reflect.Kind, bool, bool)
|
||||||
}
|
}
|
||||||
|
@ -107,12 +108,12 @@ func (v *validate) GetStructFieldOKAdvanced(val reflect.Value, namespace string)
|
||||||
return current, kind, found
|
return current, kind, found
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetStructFieldOK returns Param returns param for validation against current field
|
// GetStructFieldOK2 returns Param returns param for validation against current field
|
||||||
func (v *validate) GetStructFieldOK2() (reflect.Value, reflect.Kind, bool, bool) {
|
func (v *validate) GetStructFieldOK2() (reflect.Value, reflect.Kind, bool, bool) {
|
||||||
return v.getStructFieldOKInternal(v.slflParent, v.ct.param)
|
return v.getStructFieldOKInternal(v.slflParent, v.ct.param)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetStructFieldOKAdvanced is the same as GetStructFieldOK except that it accepts the parent struct to start looking for
|
// GetStructFieldOKAdvanced2 is the same as GetStructFieldOK except that it accepts the parent struct to start looking for
|
||||||
// the field and namespace allowing more extensibility for validators.
|
// the field and namespace allowing more extensibility for validators.
|
||||||
func (v *validate) GetStructFieldOKAdvanced2(val reflect.Value, namespace string) (reflect.Value, reflect.Kind, bool, bool) {
|
func (v *validate) GetStructFieldOKAdvanced2(val reflect.Value, namespace string) (reflect.Value, reflect.Kind, bool, bool) {
|
||||||
return v.getStructFieldOKInternal(val, namespace)
|
return v.getStructFieldOKInternal(val, namespace)
|
||||||
|
|
15
vendor/github.com/go-playground/validator/v10/go.mod
generated
vendored
15
vendor/github.com/go-playground/validator/v10/go.mod
generated
vendored
|
@ -3,8 +3,17 @@ module github.com/go-playground/validator/v10
|
||||||
go 1.13
|
go 1.13
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
github.com/go-playground/assert/v2 v2.0.1
|
github.com/go-playground/assert/v2 v2.0.1
|
||||||
github.com/go-playground/locales v0.13.0
|
github.com/go-playground/locales v0.14.0
|
||||||
github.com/go-playground/universal-translator v0.17.0
|
github.com/go-playground/universal-translator v0.18.0
|
||||||
github.com/leodido/go-urn v1.2.0
|
github.com/kr/pretty v0.3.0 // indirect
|
||||||
|
github.com/leodido/go-urn v1.2.1
|
||||||
|
github.com/rogpeppe/go-internal v1.8.0 // indirect
|
||||||
|
github.com/stretchr/testify v1.7.0 // indirect
|
||||||
|
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97
|
||||||
|
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069 // indirect
|
||||||
|
golang.org/x/text v0.3.6
|
||||||
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
|
||||||
|
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
|
||||||
)
|
)
|
||||||
|
|
55
vendor/github.com/go-playground/validator/v10/go.sum
generated
vendored
55
vendor/github.com/go-playground/validator/v10/go.sum
generated
vendored
|
@ -1,21 +1,50 @@
|
||||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.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/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
|
github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
|
||||||
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||||
github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=
|
github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU=
|
||||||
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
|
github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs=
|
||||||
github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no=
|
github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho=
|
||||||
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
|
github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA=
|
||||||
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
|
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||||
|
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
||||||
|
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
|
||||||
|
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/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w=
|
||||||
|
github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
|
||||||
|
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
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/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
|
||||||
|
github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8=
|
||||||
|
github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
|
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 h1:/UOmuWzQfxxo9UtlXMwuQU8CMgg1eZXqTRwkSQJWKOI=
|
||||||
|
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
|
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069 h1:siQdpVirKtzPhKl3lZWozZraCFObP8S1v6PRp0bLrtU=
|
||||||
|
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
|
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
|
||||||
|
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
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/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
|
||||||
|
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
|
173
vendor/github.com/go-playground/validator/v10/postcode_regexes.go
generated
vendored
Normal file
173
vendor/github.com/go-playground/validator/v10/postcode_regexes.go
generated
vendored
Normal file
|
@ -0,0 +1,173 @@
|
||||||
|
package validator
|
||||||
|
|
||||||
|
import "regexp"
|
||||||
|
|
||||||
|
var postCodePatternDict = map[string]string{
|
||||||
|
"GB": `^GIR[ ]?0AA|((AB|AL|B|BA|BB|BD|BH|BL|BN|BR|BS|BT|CA|CB|CF|CH|CM|CO|CR|CT|CV|CW|DA|DD|DE|DG|DH|DL|DN|DT|DY|E|EC|EH|EN|EX|FK|FY|G|GL|GY|GU|HA|HD|HG|HP|HR|HS|HU|HX|IG|IM|IP|IV|JE|KA|KT|KW|KY|L|LA|LD|LE|LL|LN|LS|LU|M|ME|MK|ML|N|NE|NG|NN|NP|NR|NW|OL|OX|PA|PE|PH|PL|PO|PR|RG|RH|RM|S|SA|SE|SG|SK|SL|SM|SN|SO|SP|SR|SS|ST|SW|SY|TA|TD|TF|TN|TQ|TR|TS|TW|UB|W|WA|WC|WD|WF|WN|WR|WS|WV|YO|ZE)(\d[\dA-Z]?[ ]?\d[ABD-HJLN-UW-Z]{2}))|BFPO[ ]?\d{1,4}$`,
|
||||||
|
"JE": `^JE\d[\dA-Z]?[ ]?\d[ABD-HJLN-UW-Z]{2}$`,
|
||||||
|
"GG": `^GY\d[\dA-Z]?[ ]?\d[ABD-HJLN-UW-Z]{2}$`,
|
||||||
|
"IM": `^IM\d[\dA-Z]?[ ]?\d[ABD-HJLN-UW-Z]{2}$`,
|
||||||
|
"US": `^\d{5}([ \-]\d{4})?$`,
|
||||||
|
"CA": `^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][ ]?\d[ABCEGHJ-NPRSTV-Z]\d$`,
|
||||||
|
"DE": `^\d{5}$`,
|
||||||
|
"JP": `^\d{3}-\d{4}$`,
|
||||||
|
"FR": `^\d{2}[ ]?\d{3}$`,
|
||||||
|
"AU": `^\d{4}$`,
|
||||||
|
"IT": `^\d{5}$`,
|
||||||
|
"CH": `^\d{4}$`,
|
||||||
|
"AT": `^\d{4}$`,
|
||||||
|
"ES": `^\d{5}$`,
|
||||||
|
"NL": `^\d{4}[ ]?[A-Z]{2}$`,
|
||||||
|
"BE": `^\d{4}$`,
|
||||||
|
"DK": `^\d{4}$`,
|
||||||
|
"SE": `^\d{3}[ ]?\d{2}$`,
|
||||||
|
"NO": `^\d{4}$`,
|
||||||
|
"BR": `^\d{5}[\-]?\d{3}$`,
|
||||||
|
"PT": `^\d{4}([\-]\d{3})?$`,
|
||||||
|
"FI": `^\d{5}$`,
|
||||||
|
"AX": `^22\d{3}$`,
|
||||||
|
"KR": `^\d{3}[\-]\d{3}$`,
|
||||||
|
"CN": `^\d{6}$`,
|
||||||
|
"TW": `^\d{3}(\d{2})?$`,
|
||||||
|
"SG": `^\d{6}$`,
|
||||||
|
"DZ": `^\d{5}$`,
|
||||||
|
"AD": `^AD\d{3}$`,
|
||||||
|
"AR": `^([A-HJ-NP-Z])?\d{4}([A-Z]{3})?$`,
|
||||||
|
"AM": `^(37)?\d{4}$`,
|
||||||
|
"AZ": `^\d{4}$`,
|
||||||
|
"BH": `^((1[0-2]|[2-9])\d{2})?$`,
|
||||||
|
"BD": `^\d{4}$`,
|
||||||
|
"BB": `^(BB\d{5})?$`,
|
||||||
|
"BY": `^\d{6}$`,
|
||||||
|
"BM": `^[A-Z]{2}[ ]?[A-Z0-9]{2}$`,
|
||||||
|
"BA": `^\d{5}$`,
|
||||||
|
"IO": `^BBND 1ZZ$`,
|
||||||
|
"BN": `^[A-Z]{2}[ ]?\d{4}$`,
|
||||||
|
"BG": `^\d{4}$`,
|
||||||
|
"KH": `^\d{5}$`,
|
||||||
|
"CV": `^\d{4}$`,
|
||||||
|
"CL": `^\d{7}$`,
|
||||||
|
"CR": `^\d{4,5}|\d{3}-\d{4}$`,
|
||||||
|
"HR": `^\d{5}$`,
|
||||||
|
"CY": `^\d{4}$`,
|
||||||
|
"CZ": `^\d{3}[ ]?\d{2}$`,
|
||||||
|
"DO": `^\d{5}$`,
|
||||||
|
"EC": `^([A-Z]\d{4}[A-Z]|(?:[A-Z]{2})?\d{6})?$`,
|
||||||
|
"EG": `^\d{5}$`,
|
||||||
|
"EE": `^\d{5}$`,
|
||||||
|
"FO": `^\d{3}$`,
|
||||||
|
"GE": `^\d{4}$`,
|
||||||
|
"GR": `^\d{3}[ ]?\d{2}$`,
|
||||||
|
"GL": `^39\d{2}$`,
|
||||||
|
"GT": `^\d{5}$`,
|
||||||
|
"HT": `^\d{4}$`,
|
||||||
|
"HN": `^(?:\d{5})?$`,
|
||||||
|
"HU": `^\d{4}$`,
|
||||||
|
"IS": `^\d{3}$`,
|
||||||
|
"IN": `^\d{6}$`,
|
||||||
|
"ID": `^\d{5}$`,
|
||||||
|
"IL": `^\d{5}$`,
|
||||||
|
"JO": `^\d{5}$`,
|
||||||
|
"KZ": `^\d{6}$`,
|
||||||
|
"KE": `^\d{5}$`,
|
||||||
|
"KW": `^\d{5}$`,
|
||||||
|
"LA": `^\d{5}$`,
|
||||||
|
"LV": `^\d{4}$`,
|
||||||
|
"LB": `^(\d{4}([ ]?\d{4})?)?$`,
|
||||||
|
"LI": `^(948[5-9])|(949[0-7])$`,
|
||||||
|
"LT": `^\d{5}$`,
|
||||||
|
"LU": `^\d{4}$`,
|
||||||
|
"MK": `^\d{4}$`,
|
||||||
|
"MY": `^\d{5}$`,
|
||||||
|
"MV": `^\d{5}$`,
|
||||||
|
"MT": `^[A-Z]{3}[ ]?\d{2,4}$`,
|
||||||
|
"MU": `^(\d{3}[A-Z]{2}\d{3})?$`,
|
||||||
|
"MX": `^\d{5}$`,
|
||||||
|
"MD": `^\d{4}$`,
|
||||||
|
"MC": `^980\d{2}$`,
|
||||||
|
"MA": `^\d{5}$`,
|
||||||
|
"NP": `^\d{5}$`,
|
||||||
|
"NZ": `^\d{4}$`,
|
||||||
|
"NI": `^((\d{4}-)?\d{3}-\d{3}(-\d{1})?)?$`,
|
||||||
|
"NG": `^(\d{6})?$`,
|
||||||
|
"OM": `^(PC )?\d{3}$`,
|
||||||
|
"PK": `^\d{5}$`,
|
||||||
|
"PY": `^\d{4}$`,
|
||||||
|
"PH": `^\d{4}$`,
|
||||||
|
"PL": `^\d{2}-\d{3}$`,
|
||||||
|
"PR": `^00[679]\d{2}([ \-]\d{4})?$`,
|
||||||
|
"RO": `^\d{6}$`,
|
||||||
|
"RU": `^\d{6}$`,
|
||||||
|
"SM": `^4789\d$`,
|
||||||
|
"SA": `^\d{5}$`,
|
||||||
|
"SN": `^\d{5}$`,
|
||||||
|
"SK": `^\d{3}[ ]?\d{2}$`,
|
||||||
|
"SI": `^\d{4}$`,
|
||||||
|
"ZA": `^\d{4}$`,
|
||||||
|
"LK": `^\d{5}$`,
|
||||||
|
"TJ": `^\d{6}$`,
|
||||||
|
"TH": `^\d{5}$`,
|
||||||
|
"TN": `^\d{4}$`,
|
||||||
|
"TR": `^\d{5}$`,
|
||||||
|
"TM": `^\d{6}$`,
|
||||||
|
"UA": `^\d{5}$`,
|
||||||
|
"UY": `^\d{5}$`,
|
||||||
|
"UZ": `^\d{6}$`,
|
||||||
|
"VA": `^00120$`,
|
||||||
|
"VE": `^\d{4}$`,
|
||||||
|
"ZM": `^\d{5}$`,
|
||||||
|
"AS": `^96799$`,
|
||||||
|
"CC": `^6799$`,
|
||||||
|
"CK": `^\d{4}$`,
|
||||||
|
"RS": `^\d{6}$`,
|
||||||
|
"ME": `^8\d{4}$`,
|
||||||
|
"CS": `^\d{5}$`,
|
||||||
|
"YU": `^\d{5}$`,
|
||||||
|
"CX": `^6798$`,
|
||||||
|
"ET": `^\d{4}$`,
|
||||||
|
"FK": `^FIQQ 1ZZ$`,
|
||||||
|
"NF": `^2899$`,
|
||||||
|
"FM": `^(9694[1-4])([ \-]\d{4})?$`,
|
||||||
|
"GF": `^9[78]3\d{2}$`,
|
||||||
|
"GN": `^\d{3}$`,
|
||||||
|
"GP": `^9[78][01]\d{2}$`,
|
||||||
|
"GS": `^SIQQ 1ZZ$`,
|
||||||
|
"GU": `^969[123]\d([ \-]\d{4})?$`,
|
||||||
|
"GW": `^\d{4}$`,
|
||||||
|
"HM": `^\d{4}$`,
|
||||||
|
"IQ": `^\d{5}$`,
|
||||||
|
"KG": `^\d{6}$`,
|
||||||
|
"LR": `^\d{4}$`,
|
||||||
|
"LS": `^\d{3}$`,
|
||||||
|
"MG": `^\d{3}$`,
|
||||||
|
"MH": `^969[67]\d([ \-]\d{4})?$`,
|
||||||
|
"MN": `^\d{6}$`,
|
||||||
|
"MP": `^9695[012]([ \-]\d{4})?$`,
|
||||||
|
"MQ": `^9[78]2\d{2}$`,
|
||||||
|
"NC": `^988\d{2}$`,
|
||||||
|
"NE": `^\d{4}$`,
|
||||||
|
"VI": `^008(([0-4]\d)|(5[01]))([ \-]\d{4})?$`,
|
||||||
|
"VN": `^[0-9]{1,6}$`,
|
||||||
|
"PF": `^987\d{2}$`,
|
||||||
|
"PG": `^\d{3}$`,
|
||||||
|
"PM": `^9[78]5\d{2}$`,
|
||||||
|
"PN": `^PCRN 1ZZ$`,
|
||||||
|
"PW": `^96940$`,
|
||||||
|
"RE": `^9[78]4\d{2}$`,
|
||||||
|
"SH": `^(ASCN|STHL) 1ZZ$`,
|
||||||
|
"SJ": `^\d{4}$`,
|
||||||
|
"SO": `^\d{5}$`,
|
||||||
|
"SZ": `^[HLMS]\d{3}$`,
|
||||||
|
"TC": `^TKCA 1ZZ$`,
|
||||||
|
"WF": `^986\d{2}$`,
|
||||||
|
"XK": `^\d{5}$`,
|
||||||
|
"YT": `^976\d{2}$`,
|
||||||
|
}
|
||||||
|
|
||||||
|
var postCodeRegexDict = map[string]*regexp.Regexp{}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
for countryCode, pattern := range postCodePatternDict {
|
||||||
|
postCodeRegexDict[countryCode] = regexp.MustCompile(pattern)
|
||||||
|
}
|
||||||
|
}
|
26
vendor/github.com/go-playground/validator/v10/regexes.go
generated
vendored
26
vendor/github.com/go-playground/validator/v10/regexes.go
generated
vendored
|
@ -9,8 +9,8 @@ const (
|
||||||
alphaUnicodeNumericRegexString = "^[\\p{L}\\p{N}]+$"
|
alphaUnicodeNumericRegexString = "^[\\p{L}\\p{N}]+$"
|
||||||
numericRegexString = "^[-+]?[0-9]+(?:\\.[0-9]+)?$"
|
numericRegexString = "^[-+]?[0-9]+(?:\\.[0-9]+)?$"
|
||||||
numberRegexString = "^[0-9]+$"
|
numberRegexString = "^[0-9]+$"
|
||||||
hexadecimalRegexString = "^[0-9a-fA-F]+$"
|
hexadecimalRegexString = "^(0[xX])?[0-9a-fA-F]+$"
|
||||||
hexcolorRegexString = "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
|
hexColorRegexString = "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
|
||||||
rgbRegexString = "^rgb\\(\\s*(?:(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])|(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])%\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])%\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])%)\\s*\\)$"
|
rgbRegexString = "^rgb\\(\\s*(?:(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])|(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])%\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])%\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])%)\\s*\\)$"
|
||||||
rgbaRegexString = "^rgba\\(\\s*(?:(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])|(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])%\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])%\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])%)\\s*,\\s*(?:(?:0.[1-9]*)|[01])\\s*\\)$"
|
rgbaRegexString = "^rgba\\(\\s*(?:(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])|(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])%\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])%\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])%)\\s*,\\s*(?:(?:0.[1-9]*)|[01])\\s*\\)$"
|
||||||
hslRegexString = "^hsl\\(\\s*(?:0|[1-9]\\d?|[12]\\d\\d|3[0-5]\\d|360)\\s*,\\s*(?:(?:0|[1-9]\\d?|100)%)\\s*,\\s*(?:(?:0|[1-9]\\d?|100)%)\\s*\\)$"
|
hslRegexString = "^hsl\\(\\s*(?:0|[1-9]\\d?|[12]\\d\\d|3[0-5]\\d|360)\\s*,\\s*(?:(?:0|[1-9]\\d?|100)%)\\s*,\\s*(?:(?:0|[1-9]\\d?|100)%)\\s*\\)$"
|
||||||
|
@ -36,18 +36,21 @@ const (
|
||||||
latitudeRegexString = "^[-+]?([1-8]?\\d(\\.\\d+)?|90(\\.0+)?)$"
|
latitudeRegexString = "^[-+]?([1-8]?\\d(\\.\\d+)?|90(\\.0+)?)$"
|
||||||
longitudeRegexString = "^[-+]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)$"
|
longitudeRegexString = "^[-+]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)$"
|
||||||
sSNRegexString = `^[0-9]{3}[ -]?(0[1-9]|[1-9][0-9])[ -]?([1-9][0-9]{3}|[0-9][1-9][0-9]{2}|[0-9]{2}[1-9][0-9]|[0-9]{3}[1-9])$`
|
sSNRegexString = `^[0-9]{3}[ -]?(0[1-9]|[1-9][0-9])[ -]?([1-9][0-9]{3}|[0-9][1-9][0-9]{2}|[0-9]{2}[1-9][0-9]|[0-9]{3}[1-9])$`
|
||||||
hostnameRegexStringRFC952 = `^[a-zA-Z][a-zA-Z0-9\-\.]+[a-zA-Z0-9]$` // https://tools.ietf.org/html/rfc952
|
hostnameRegexStringRFC952 = `^[a-zA-Z]([a-zA-Z0-9\-]+[\.]?)*[a-zA-Z0-9]$` // https://tools.ietf.org/html/rfc952
|
||||||
hostnameRegexStringRFC1123 = `^([a-zA-Z0-9]{1}[a-zA-Z0-9_-]{0,62}){1}(\.[a-zA-Z0-9_]{1}[a-zA-Z0-9_-]{0,62})*?$` // accepts hostname starting with a digit https://tools.ietf.org/html/rfc1123
|
hostnameRegexStringRFC1123 = `^([a-zA-Z0-9]{1}[a-zA-Z0-9_-]{0,62}){1}(\.[a-zA-Z0-9_]{1}[a-zA-Z0-9_-]{0,62})*?$` // accepts hostname starting with a digit https://tools.ietf.org/html/rfc1123
|
||||||
btcAddressRegexString = `^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$` // bitcoin address
|
fqdnRegexStringRFC1123 = `^([a-zA-Z0-9]{1}[a-zA-Z0-9_-]{0,62})(\.[a-zA-Z0-9_]{1}[a-zA-Z0-9_-]{0,62})*?(\.[a-zA-Z]{1}[a-zA-Z0-9]{0,62})\.?$` // same as hostnameRegexStringRFC1123 but must contain a non numerical TLD (possibly ending with '.')
|
||||||
btcAddressUpperRegexStringBech32 = `^BC1[02-9AC-HJ-NP-Z]{7,76}$` // bitcoin bech32 address https://en.bitcoin.it/wiki/Bech32
|
btcAddressRegexString = `^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$` // bitcoin address
|
||||||
btcAddressLowerRegexStringBech32 = `^bc1[02-9ac-hj-np-z]{7,76}$` // bitcoin bech32 address https://en.bitcoin.it/wiki/Bech32
|
btcAddressUpperRegexStringBech32 = `^BC1[02-9AC-HJ-NP-Z]{7,76}$` // bitcoin bech32 address https://en.bitcoin.it/wiki/Bech32
|
||||||
|
btcAddressLowerRegexStringBech32 = `^bc1[02-9ac-hj-np-z]{7,76}$` // bitcoin bech32 address https://en.bitcoin.it/wiki/Bech32
|
||||||
ethAddressRegexString = `^0x[0-9a-fA-F]{40}$`
|
ethAddressRegexString = `^0x[0-9a-fA-F]{40}$`
|
||||||
ethAddressUpperRegexString = `^0x[0-9A-F]{40}$`
|
ethAddressUpperRegexString = `^0x[0-9A-F]{40}$`
|
||||||
ethAddressLowerRegexString = `^0x[0-9a-f]{40}$`
|
ethAddressLowerRegexString = `^0x[0-9a-f]{40}$`
|
||||||
uRLEncodedRegexString = `(%[A-Fa-f0-9]{2})`
|
uRLEncodedRegexString = `^(?:[^%]|%[0-9A-Fa-f]{2})*$`
|
||||||
hTMLEncodedRegexString = `&#[x]?([0-9a-fA-F]{2})|(>)|(<)|(")|(&)+[;]?`
|
hTMLEncodedRegexString = `&#[x]?([0-9a-fA-F]{2})|(>)|(<)|(")|(&)+[;]?`
|
||||||
hTMLRegexString = `<[/]?([a-zA-Z]+).*?>`
|
hTMLRegexString = `<[/]?([a-zA-Z]+).*?>`
|
||||||
|
jWTRegexString = "^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$"
|
||||||
splitParamsRegexString = `'[^']*'|\S+`
|
splitParamsRegexString = `'[^']*'|\S+`
|
||||||
|
bicRegexString = `^[A-Za-z]{6}[A-Za-z0-9]{2}([A-Za-z0-9]{3})?$`
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -58,7 +61,7 @@ var (
|
||||||
numericRegex = regexp.MustCompile(numericRegexString)
|
numericRegex = regexp.MustCompile(numericRegexString)
|
||||||
numberRegex = regexp.MustCompile(numberRegexString)
|
numberRegex = regexp.MustCompile(numberRegexString)
|
||||||
hexadecimalRegex = regexp.MustCompile(hexadecimalRegexString)
|
hexadecimalRegex = regexp.MustCompile(hexadecimalRegexString)
|
||||||
hexcolorRegex = regexp.MustCompile(hexcolorRegexString)
|
hexColorRegex = regexp.MustCompile(hexColorRegexString)
|
||||||
rgbRegex = regexp.MustCompile(rgbRegexString)
|
rgbRegex = regexp.MustCompile(rgbRegexString)
|
||||||
rgbaRegex = regexp.MustCompile(rgbaRegexString)
|
rgbaRegex = regexp.MustCompile(rgbaRegexString)
|
||||||
hslRegex = regexp.MustCompile(hslRegexString)
|
hslRegex = regexp.MustCompile(hslRegexString)
|
||||||
|
@ -86,14 +89,17 @@ var (
|
||||||
sSNRegex = regexp.MustCompile(sSNRegexString)
|
sSNRegex = regexp.MustCompile(sSNRegexString)
|
||||||
hostnameRegexRFC952 = regexp.MustCompile(hostnameRegexStringRFC952)
|
hostnameRegexRFC952 = regexp.MustCompile(hostnameRegexStringRFC952)
|
||||||
hostnameRegexRFC1123 = regexp.MustCompile(hostnameRegexStringRFC1123)
|
hostnameRegexRFC1123 = regexp.MustCompile(hostnameRegexStringRFC1123)
|
||||||
|
fqdnRegexRFC1123 = regexp.MustCompile(fqdnRegexStringRFC1123)
|
||||||
btcAddressRegex = regexp.MustCompile(btcAddressRegexString)
|
btcAddressRegex = regexp.MustCompile(btcAddressRegexString)
|
||||||
btcUpperAddressRegexBech32 = regexp.MustCompile(btcAddressUpperRegexStringBech32)
|
btcUpperAddressRegexBech32 = regexp.MustCompile(btcAddressUpperRegexStringBech32)
|
||||||
btcLowerAddressRegexBech32 = regexp.MustCompile(btcAddressLowerRegexStringBech32)
|
btcLowerAddressRegexBech32 = regexp.MustCompile(btcAddressLowerRegexStringBech32)
|
||||||
ethAddressRegex = regexp.MustCompile(ethAddressRegexString)
|
ethAddressRegex = regexp.MustCompile(ethAddressRegexString)
|
||||||
ethaddressRegexUpper = regexp.MustCompile(ethAddressUpperRegexString)
|
ethAddressRegexUpper = regexp.MustCompile(ethAddressUpperRegexString)
|
||||||
ethAddressRegexLower = regexp.MustCompile(ethAddressLowerRegexString)
|
ethAddressRegexLower = regexp.MustCompile(ethAddressLowerRegexString)
|
||||||
uRLEncodedRegex = regexp.MustCompile(uRLEncodedRegexString)
|
uRLEncodedRegex = regexp.MustCompile(uRLEncodedRegexString)
|
||||||
hTMLEncodedRegex = regexp.MustCompile(hTMLEncodedRegexString)
|
hTMLEncodedRegex = regexp.MustCompile(hTMLEncodedRegexString)
|
||||||
hTMLRegex = regexp.MustCompile(hTMLRegexString)
|
hTMLRegex = regexp.MustCompile(hTMLRegexString)
|
||||||
|
jWTRegex = regexp.MustCompile(jWTRegexString)
|
||||||
splitParamsRegex = regexp.MustCompile(splitParamsRegexString)
|
splitParamsRegex = regexp.MustCompile(splitParamsRegexString)
|
||||||
|
bicRegex = regexp.MustCompile(bicRegexString)
|
||||||
)
|
)
|
||||||
|
|
12
vendor/github.com/go-playground/validator/v10/struct_level.go
generated
vendored
12
vendor/github.com/go-playground/validator/v10/struct_level.go
generated
vendored
|
@ -23,18 +23,18 @@ func wrapStructLevelFunc(fn StructLevelFunc) StructLevelFuncCtx {
|
||||||
// to validate a struct
|
// to validate a struct
|
||||||
type StructLevel interface {
|
type StructLevel interface {
|
||||||
|
|
||||||
// returns the main validation object, in case one wants to call validations internally.
|
// Validator returns the main validation object, in case one wants to call validations internally.
|
||||||
// this is so you don't have to use anonymous functions to get access to the validate
|
// this is so you don't have to use anonymous functions to get access to the validate
|
||||||
// instance.
|
// instance.
|
||||||
Validator() *Validate
|
Validator() *Validate
|
||||||
|
|
||||||
// returns the top level struct, if any
|
// Top returns the top level struct, if any
|
||||||
Top() reflect.Value
|
Top() reflect.Value
|
||||||
|
|
||||||
// returns the current fields parent struct, if any
|
// Parent returns the current fields parent struct, if any
|
||||||
Parent() reflect.Value
|
Parent() reflect.Value
|
||||||
|
|
||||||
// returns the current struct.
|
// Current returns the current struct.
|
||||||
Current() reflect.Value
|
Current() reflect.Value
|
||||||
|
|
||||||
// ExtractType gets the actual underlying type of field value.
|
// ExtractType gets the actual underlying type of field value.
|
||||||
|
@ -42,7 +42,7 @@ type StructLevel interface {
|
||||||
// underlying value and its kind.
|
// underlying value and its kind.
|
||||||
ExtractType(field reflect.Value) (value reflect.Value, kind reflect.Kind, nullable bool)
|
ExtractType(field reflect.Value) (value reflect.Value, kind reflect.Kind, nullable bool)
|
||||||
|
|
||||||
// reports an error just by passing the field and tag information
|
// ReportError reports an error just by passing the field and tag information
|
||||||
//
|
//
|
||||||
// NOTES:
|
// NOTES:
|
||||||
//
|
//
|
||||||
|
@ -54,7 +54,7 @@ type StructLevel interface {
|
||||||
// and process on the flip side it's up to you.
|
// and process on the flip side it's up to you.
|
||||||
ReportError(field interface{}, fieldName, structFieldName string, tag, param string)
|
ReportError(field interface{}, fieldName, structFieldName string, tag, param string)
|
||||||
|
|
||||||
// reports an error just by passing ValidationErrors
|
// ReportValidationErrors reports an error just by passing ValidationErrors
|
||||||
//
|
//
|
||||||
// NOTES:
|
// NOTES:
|
||||||
//
|
//
|
||||||
|
|
24
vendor/github.com/go-playground/validator/v10/util.go
generated
vendored
24
vendor/github.com/go-playground/validator/v10/util.go
generated
vendored
|
@ -4,6 +4,7 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// extractTypeInternal gets the actual underlying type of field value.
|
// extractTypeInternal gets the actual underlying type of field value.
|
||||||
|
@ -222,13 +223,34 @@ BEGIN:
|
||||||
// asInt returns the parameter as a int64
|
// asInt returns the parameter as a int64
|
||||||
// or panics if it can't convert
|
// or panics if it can't convert
|
||||||
func asInt(param string) int64 {
|
func asInt(param string) int64 {
|
||||||
|
|
||||||
i, err := strconv.ParseInt(param, 0, 64)
|
i, err := strconv.ParseInt(param, 0, 64)
|
||||||
panicIf(err)
|
panicIf(err)
|
||||||
|
|
||||||
return i
|
return i
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// asIntFromTimeDuration parses param as time.Duration and returns it as int64
|
||||||
|
// or panics on error.
|
||||||
|
func asIntFromTimeDuration(param string) int64 {
|
||||||
|
d, err := time.ParseDuration(param)
|
||||||
|
if err != nil {
|
||||||
|
// attempt parsing as an an integer assuming nanosecond precision
|
||||||
|
return asInt(param)
|
||||||
|
}
|
||||||
|
return int64(d)
|
||||||
|
}
|
||||||
|
|
||||||
|
// asIntFromType calls the proper function to parse param as int64,
|
||||||
|
// given a field's Type t.
|
||||||
|
func asIntFromType(t reflect.Type, param string) int64 {
|
||||||
|
switch t {
|
||||||
|
case timeDurationType:
|
||||||
|
return asIntFromTimeDuration(param)
|
||||||
|
default:
|
||||||
|
return asInt(param)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// asUint returns the parameter as a uint64
|
// asUint returns the parameter as a uint64
|
||||||
// or panics if it can't convert
|
// or panics if it can't convert
|
||||||
func asUint(param string) uint64 {
|
func asUint(param string) uint64 {
|
||||||
|
|
8
vendor/github.com/go-playground/validator/v10/validator.go
generated
vendored
8
vendor/github.com/go-playground/validator/v10/validator.go
generated
vendored
|
@ -74,7 +74,7 @@ func (v *validate) validateStruct(ctx context.Context, parent reflect.Value, cur
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
v.traverseField(ctx, parent, current.Field(f.idx), ns, structNs, f, f.cTags)
|
v.traverseField(ctx, current, current.Field(f.idx), ns, structNs, f, f.cTags)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,12 +222,12 @@ func (v *validate) traverseField(ctx context.Context, parent reflect.Value, curr
|
||||||
structNs = append(append(structNs, cf.name...), '.')
|
structNs = append(append(structNs, cf.name...), '.')
|
||||||
}
|
}
|
||||||
|
|
||||||
v.validateStruct(ctx, current, current, typ, ns, structNs, ct)
|
v.validateStruct(ctx, parent, current, typ, ns, structNs, ct)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !ct.hasTag {
|
if ct == nil || !ct.hasTag {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ OUTER:
|
||||||
v.cf = cf
|
v.cf = cf
|
||||||
v.ct = ct
|
v.ct = ct
|
||||||
|
|
||||||
if !v.fldIsPointer && !hasValue(v) {
|
if !hasValue(v) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
53
vendor/github.com/go-playground/validator/v10/validator_instance.go
generated
vendored
53
vendor/github.com/go-playground/validator/v10/validator_instance.go
generated
vendored
|
@ -27,6 +27,12 @@ const (
|
||||||
requiredWithoutTag = "required_without"
|
requiredWithoutTag = "required_without"
|
||||||
requiredWithTag = "required_with"
|
requiredWithTag = "required_with"
|
||||||
requiredWithAllTag = "required_with_all"
|
requiredWithAllTag = "required_with_all"
|
||||||
|
requiredIfTag = "required_if"
|
||||||
|
requiredUnlessTag = "required_unless"
|
||||||
|
excludedWithoutAllTag = "excluded_without_all"
|
||||||
|
excludedWithoutTag = "excluded_without"
|
||||||
|
excludedWithTag = "excluded_with"
|
||||||
|
excludedWithAllTag = "excluded_with_all"
|
||||||
skipValidationTag = "-"
|
skipValidationTag = "-"
|
||||||
diveTag = "dive"
|
diveTag = "dive"
|
||||||
keysTag = "keys"
|
keysTag = "keys"
|
||||||
|
@ -41,7 +47,9 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
timeType = reflect.TypeOf(time.Time{})
|
timeDurationType = reflect.TypeOf(time.Duration(0))
|
||||||
|
timeType = reflect.TypeOf(time.Time{})
|
||||||
|
|
||||||
defaultCField = &cField{namesEqual: true}
|
defaultCField = &cField{namesEqual: true}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -81,6 +89,10 @@ type Validate struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// New returns a new instance of 'validate' with sane defaults.
|
// New returns a new instance of 'validate' with sane defaults.
|
||||||
|
// Validate is designed to be thread-safe and used as a singleton instance.
|
||||||
|
// It caches information about your struct and validations,
|
||||||
|
// in essence only parsing your validation tags once per struct type.
|
||||||
|
// Using multiple instances neglects the benefit of caching.
|
||||||
func New() *Validate {
|
func New() *Validate {
|
||||||
|
|
||||||
tc := new(tagCache)
|
tc := new(tagCache)
|
||||||
|
@ -107,7 +119,8 @@ func New() *Validate {
|
||||||
|
|
||||||
switch k {
|
switch k {
|
||||||
// these require that even if the value is nil that the validation should run, omitempty still overrides this behaviour
|
// these require that even if the value is nil that the validation should run, omitempty still overrides this behaviour
|
||||||
case requiredWithTag, requiredWithAllTag, requiredWithoutTag, requiredWithoutAllTag:
|
case requiredIfTag, requiredUnlessTag, requiredWithTag, requiredWithAllTag, requiredWithoutTag, requiredWithoutAllTag,
|
||||||
|
excludedWithTag, excludedWithAllTag, excludedWithoutTag, excludedWithoutAllTag:
|
||||||
_ = v.registerValidation(k, wrapFunc(val), true, true)
|
_ = v.registerValidation(k, wrapFunc(val), true, true)
|
||||||
default:
|
default:
|
||||||
// no need to error check here, baked in will always be valid
|
// no need to error check here, baked in will always be valid
|
||||||
|
@ -134,6 +147,33 @@ func (v *Validate) SetTagName(name string) {
|
||||||
v.tagName = name
|
v.tagName = name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ValidateMapCtx validates a map using a map of validation rules and allows passing of contextual
|
||||||
|
// validation validation information via context.Context.
|
||||||
|
func (v Validate) ValidateMapCtx(ctx context.Context, data map[string]interface{}, rules map[string]interface{}) map[string]interface{} {
|
||||||
|
errs := make(map[string]interface{})
|
||||||
|
for field, rule := range rules {
|
||||||
|
if reflect.ValueOf(rule).Kind() == reflect.Map && reflect.ValueOf(data[field]).Kind() == reflect.Map {
|
||||||
|
err := v.ValidateMapCtx(ctx, data[field].(map[string]interface{}), rule.(map[string]interface{}))
|
||||||
|
if len(err) > 0 {
|
||||||
|
errs[field] = err
|
||||||
|
}
|
||||||
|
} else if reflect.ValueOf(rule).Kind() == reflect.Map {
|
||||||
|
errs[field] = errors.New("The field: '" + field + "' is not a map to dive")
|
||||||
|
} else {
|
||||||
|
err := v.VarCtx(ctx, data[field], rule.(string))
|
||||||
|
if err != nil {
|
||||||
|
errs[field] = err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return errs
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidateMap validates map data form a map of tags
|
||||||
|
func (v *Validate) ValidateMap(data map[string]interface{}, rules map[string]interface{}) map[string]interface{} {
|
||||||
|
return v.ValidateMapCtx(context.Background(), data, rules)
|
||||||
|
}
|
||||||
|
|
||||||
// RegisterTagNameFunc registers a function to get alternate names for StructFields.
|
// RegisterTagNameFunc registers a function to get alternate names for StructFields.
|
||||||
//
|
//
|
||||||
// eg. to use the names which have been specified for JSON representations of structs, rather than normal Go field names:
|
// eg. to use the names which have been specified for JSON representations of structs, rather than normal Go field names:
|
||||||
|
@ -171,11 +211,11 @@ func (v *Validate) RegisterValidationCtx(tag string, fn FuncCtx, callValidationE
|
||||||
|
|
||||||
func (v *Validate) registerValidation(tag string, fn FuncCtx, bakedIn bool, nilCheckable bool) error {
|
func (v *Validate) registerValidation(tag string, fn FuncCtx, bakedIn bool, nilCheckable bool) error {
|
||||||
if len(tag) == 0 {
|
if len(tag) == 0 {
|
||||||
return errors.New("Function Key cannot be empty")
|
return errors.New("function Key cannot be empty")
|
||||||
}
|
}
|
||||||
|
|
||||||
if fn == nil {
|
if fn == nil {
|
||||||
return errors.New("Function cannot be empty")
|
return errors.New("function cannot be empty")
|
||||||
}
|
}
|
||||||
|
|
||||||
_, ok := restrictedTags[tag]
|
_, ok := restrictedTags[tag]
|
||||||
|
@ -405,7 +445,10 @@ func (v *Validate) StructPartialCtx(ctx context.Context, s interface{}, fields .
|
||||||
if len(flds) > 0 {
|
if len(flds) > 0 {
|
||||||
|
|
||||||
vd.misc = append(vd.misc[0:0], name...)
|
vd.misc = append(vd.misc[0:0], name...)
|
||||||
vd.misc = append(vd.misc, '.')
|
// Don't append empty name for unnamed structs
|
||||||
|
if len(vd.misc) != 0 {
|
||||||
|
vd.misc = append(vd.misc, '.')
|
||||||
|
}
|
||||||
|
|
||||||
for _, s := range flds {
|
for _, s := range flds {
|
||||||
|
|
||||||
|
|
129
vendor/github.com/go-sql-driver/mysql/.travis.yml
generated
vendored
129
vendor/github.com/go-sql-driver/mysql/.travis.yml
generated
vendored
|
@ -1,129 +0,0 @@
|
||||||
sudo: false
|
|
||||||
language: go
|
|
||||||
go:
|
|
||||||
- 1.10.x
|
|
||||||
- 1.11.x
|
|
||||||
- 1.12.x
|
|
||||||
- 1.13.x
|
|
||||||
- master
|
|
||||||
|
|
||||||
before_install:
|
|
||||||
- go get golang.org/x/tools/cmd/cover
|
|
||||||
- go get github.com/mattn/goveralls
|
|
||||||
|
|
||||||
before_script:
|
|
||||||
- echo -e "[server]\ninnodb_log_file_size=256MB\ninnodb_buffer_pool_size=512MB\nmax_allowed_packet=16MB" | sudo tee -a /etc/mysql/my.cnf
|
|
||||||
- sudo service mysql restart
|
|
||||||
- .travis/wait_mysql.sh
|
|
||||||
- mysql -e 'create database gotest;'
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- env: DB=MYSQL8
|
|
||||||
sudo: required
|
|
||||||
dist: trusty
|
|
||||||
go: 1.10.x
|
|
||||||
services:
|
|
||||||
- docker
|
|
||||||
before_install:
|
|
||||||
- go get golang.org/x/tools/cmd/cover
|
|
||||||
- go get github.com/mattn/goveralls
|
|
||||||
- docker pull mysql:8.0
|
|
||||||
- docker run -d -p 127.0.0.1:3307:3306 --name mysqld -e MYSQL_DATABASE=gotest -e MYSQL_USER=gotest -e MYSQL_PASSWORD=secret -e MYSQL_ROOT_PASSWORD=verysecret
|
|
||||||
mysql:8.0 --innodb_log_file_size=256MB --innodb_buffer_pool_size=512MB --max_allowed_packet=16MB --local-infile=1
|
|
||||||
- cp .travis/docker.cnf ~/.my.cnf
|
|
||||||
- .travis/wait_mysql.sh
|
|
||||||
before_script:
|
|
||||||
- export MYSQL_TEST_USER=gotest
|
|
||||||
- export MYSQL_TEST_PASS=secret
|
|
||||||
- export MYSQL_TEST_ADDR=127.0.0.1:3307
|
|
||||||
- export MYSQL_TEST_CONCURRENT=1
|
|
||||||
|
|
||||||
- env: DB=MYSQL57
|
|
||||||
sudo: required
|
|
||||||
dist: trusty
|
|
||||||
go: 1.10.x
|
|
||||||
services:
|
|
||||||
- docker
|
|
||||||
before_install:
|
|
||||||
- go get golang.org/x/tools/cmd/cover
|
|
||||||
- go get github.com/mattn/goveralls
|
|
||||||
- docker pull mysql:5.7
|
|
||||||
- docker run -d -p 127.0.0.1:3307:3306 --name mysqld -e MYSQL_DATABASE=gotest -e MYSQL_USER=gotest -e MYSQL_PASSWORD=secret -e MYSQL_ROOT_PASSWORD=verysecret
|
|
||||||
mysql:5.7 --innodb_log_file_size=256MB --innodb_buffer_pool_size=512MB --max_allowed_packet=16MB --local-infile=1
|
|
||||||
- cp .travis/docker.cnf ~/.my.cnf
|
|
||||||
- .travis/wait_mysql.sh
|
|
||||||
before_script:
|
|
||||||
- export MYSQL_TEST_USER=gotest
|
|
||||||
- export MYSQL_TEST_PASS=secret
|
|
||||||
- export MYSQL_TEST_ADDR=127.0.0.1:3307
|
|
||||||
- export MYSQL_TEST_CONCURRENT=1
|
|
||||||
|
|
||||||
- env: DB=MARIA55
|
|
||||||
sudo: required
|
|
||||||
dist: trusty
|
|
||||||
go: 1.10.x
|
|
||||||
services:
|
|
||||||
- docker
|
|
||||||
before_install:
|
|
||||||
- go get golang.org/x/tools/cmd/cover
|
|
||||||
- go get github.com/mattn/goveralls
|
|
||||||
- docker pull mariadb:5.5
|
|
||||||
- docker run -d -p 127.0.0.1:3307:3306 --name mysqld -e MYSQL_DATABASE=gotest -e MYSQL_USER=gotest -e MYSQL_PASSWORD=secret -e MYSQL_ROOT_PASSWORD=verysecret
|
|
||||||
mariadb:5.5 --innodb_log_file_size=256MB --innodb_buffer_pool_size=512MB --max_allowed_packet=16MB --local-infile=1
|
|
||||||
- cp .travis/docker.cnf ~/.my.cnf
|
|
||||||
- .travis/wait_mysql.sh
|
|
||||||
before_script:
|
|
||||||
- export MYSQL_TEST_USER=gotest
|
|
||||||
- export MYSQL_TEST_PASS=secret
|
|
||||||
- export MYSQL_TEST_ADDR=127.0.0.1:3307
|
|
||||||
- export MYSQL_TEST_CONCURRENT=1
|
|
||||||
|
|
||||||
- env: DB=MARIA10_1
|
|
||||||
sudo: required
|
|
||||||
dist: trusty
|
|
||||||
go: 1.10.x
|
|
||||||
services:
|
|
||||||
- docker
|
|
||||||
before_install:
|
|
||||||
- go get golang.org/x/tools/cmd/cover
|
|
||||||
- go get github.com/mattn/goveralls
|
|
||||||
- docker pull mariadb:10.1
|
|
||||||
- docker run -d -p 127.0.0.1:3307:3306 --name mysqld -e MYSQL_DATABASE=gotest -e MYSQL_USER=gotest -e MYSQL_PASSWORD=secret -e MYSQL_ROOT_PASSWORD=verysecret
|
|
||||||
mariadb:10.1 --innodb_log_file_size=256MB --innodb_buffer_pool_size=512MB --max_allowed_packet=16MB --local-infile=1
|
|
||||||
- cp .travis/docker.cnf ~/.my.cnf
|
|
||||||
- .travis/wait_mysql.sh
|
|
||||||
before_script:
|
|
||||||
- export MYSQL_TEST_USER=gotest
|
|
||||||
- export MYSQL_TEST_PASS=secret
|
|
||||||
- export MYSQL_TEST_ADDR=127.0.0.1:3307
|
|
||||||
- export MYSQL_TEST_CONCURRENT=1
|
|
||||||
|
|
||||||
- os: osx
|
|
||||||
osx_image: xcode10.1
|
|
||||||
addons:
|
|
||||||
homebrew:
|
|
||||||
packages:
|
|
||||||
- mysql
|
|
||||||
update: true
|
|
||||||
go: 1.12.x
|
|
||||||
before_install:
|
|
||||||
- go get golang.org/x/tools/cmd/cover
|
|
||||||
- go get github.com/mattn/goveralls
|
|
||||||
before_script:
|
|
||||||
- echo -e "[server]\ninnodb_log_file_size=256MB\ninnodb_buffer_pool_size=512MB\nmax_allowed_packet=16MB\nlocal_infile=1" >> /usr/local/etc/my.cnf
|
|
||||||
- mysql.server start
|
|
||||||
- mysql -uroot -e 'CREATE USER gotest IDENTIFIED BY "secret"'
|
|
||||||
- mysql -uroot -e 'GRANT ALL ON *.* TO gotest'
|
|
||||||
- mysql -uroot -e 'create database gotest;'
|
|
||||||
- export MYSQL_TEST_USER=gotest
|
|
||||||
- export MYSQL_TEST_PASS=secret
|
|
||||||
- export MYSQL_TEST_ADDR=127.0.0.1:3306
|
|
||||||
- export MYSQL_TEST_CONCURRENT=1
|
|
||||||
|
|
||||||
script:
|
|
||||||
- go test -v -covermode=count -coverprofile=coverage.out
|
|
||||||
- go vet ./...
|
|
||||||
- .travis/gofmt.sh
|
|
||||||
after_script:
|
|
||||||
- $HOME/gopath/bin/goveralls -coverprofile=coverage.out -service=travis-ci
|
|
12
vendor/github.com/go-sql-driver/mysql/AUTHORS
generated
vendored
12
vendor/github.com/go-sql-driver/mysql/AUTHORS
generated
vendored
|
@ -13,11 +13,15 @@
|
||||||
|
|
||||||
Aaron Hopkins <go-sql-driver at die.net>
|
Aaron Hopkins <go-sql-driver at die.net>
|
||||||
Achille Roussel <achille.roussel at gmail.com>
|
Achille Roussel <achille.roussel at gmail.com>
|
||||||
|
Alex Snast <alexsn at fb.com>
|
||||||
Alexey Palazhchenko <alexey.palazhchenko at gmail.com>
|
Alexey Palazhchenko <alexey.palazhchenko at gmail.com>
|
||||||
Andrew Reid <andrew.reid at tixtrack.com>
|
Andrew Reid <andrew.reid at tixtrack.com>
|
||||||
|
Animesh Ray <mail.rayanimesh at gmail.com>
|
||||||
Arne Hormann <arnehormann at gmail.com>
|
Arne Hormann <arnehormann at gmail.com>
|
||||||
|
Ariel Mashraki <ariel at mashraki.co.il>
|
||||||
Asta Xie <xiemengjun at gmail.com>
|
Asta Xie <xiemengjun at gmail.com>
|
||||||
Bulat Gaifullin <gaifullinbf at gmail.com>
|
Bulat Gaifullin <gaifullinbf at gmail.com>
|
||||||
|
Caine Jette <jette at alum.mit.edu>
|
||||||
Carlos Nieto <jose.carlos at menteslibres.net>
|
Carlos Nieto <jose.carlos at menteslibres.net>
|
||||||
Chris Moos <chris at tech9computers.com>
|
Chris Moos <chris at tech9computers.com>
|
||||||
Craig Wilson <craiggwilson at gmail.com>
|
Craig Wilson <craiggwilson at gmail.com>
|
||||||
|
@ -52,6 +56,7 @@ Julien Schmidt <go-sql-driver at julienschmidt.com>
|
||||||
Justin Li <jli at j-li.net>
|
Justin Li <jli at j-li.net>
|
||||||
Justin Nuß <nuss.justin at gmail.com>
|
Justin Nuß <nuss.justin at gmail.com>
|
||||||
Kamil Dziedzic <kamil at klecza.pl>
|
Kamil Dziedzic <kamil at klecza.pl>
|
||||||
|
Kei Kamikawa <x00.x7f.x86 at gmail.com>
|
||||||
Kevin Malachowski <kevin at chowski.com>
|
Kevin Malachowski <kevin at chowski.com>
|
||||||
Kieron Woodhouse <kieron.woodhouse at infosum.com>
|
Kieron Woodhouse <kieron.woodhouse at infosum.com>
|
||||||
Lennart Rudolph <lrudolph at hmc.edu>
|
Lennart Rudolph <lrudolph at hmc.edu>
|
||||||
|
@ -74,20 +79,26 @@ Reed Allman <rdallman10 at gmail.com>
|
||||||
Richard Wilkes <wilkes at me.com>
|
Richard Wilkes <wilkes at me.com>
|
||||||
Robert Russell <robert at rrbrussell.com>
|
Robert Russell <robert at rrbrussell.com>
|
||||||
Runrioter Wung <runrioter at gmail.com>
|
Runrioter Wung <runrioter at gmail.com>
|
||||||
|
Sho Iizuka <sho.i518 at gmail.com>
|
||||||
|
Sho Ikeda <suicaicoca at gmail.com>
|
||||||
Shuode Li <elemount at qq.com>
|
Shuode Li <elemount at qq.com>
|
||||||
Simon J Mudd <sjmudd at pobox.com>
|
Simon J Mudd <sjmudd at pobox.com>
|
||||||
Soroush Pour <me at soroushjp.com>
|
Soroush Pour <me at soroushjp.com>
|
||||||
Stan Putrya <root.vagner at gmail.com>
|
Stan Putrya <root.vagner at gmail.com>
|
||||||
Stanley Gunawan <gunawan.stanley at gmail.com>
|
Stanley Gunawan <gunawan.stanley at gmail.com>
|
||||||
Steven Hartland <steven.hartland at multiplay.co.uk>
|
Steven Hartland <steven.hartland at multiplay.co.uk>
|
||||||
|
Tan Jinhua <312841925 at qq.com>
|
||||||
Thomas Wodarek <wodarekwebpage at gmail.com>
|
Thomas Wodarek <wodarekwebpage at gmail.com>
|
||||||
Tim Ruffles <timruffles at gmail.com>
|
Tim Ruffles <timruffles at gmail.com>
|
||||||
Tom Jenkinson <tom at tjenkinson.me>
|
Tom Jenkinson <tom at tjenkinson.me>
|
||||||
Vladimir Kovpak <cn007b at gmail.com>
|
Vladimir Kovpak <cn007b at gmail.com>
|
||||||
|
Vladyslav Zhelezniak <zhvladi at gmail.com>
|
||||||
Xiangyu Hu <xiangyu.hu at outlook.com>
|
Xiangyu Hu <xiangyu.hu at outlook.com>
|
||||||
Xiaobing Jiang <s7v7nislands at gmail.com>
|
Xiaobing Jiang <s7v7nislands at gmail.com>
|
||||||
Xiuming Chen <cc at cxm.cc>
|
Xiuming Chen <cc at cxm.cc>
|
||||||
|
Xuehong Chan <chanxuehong at gmail.com>
|
||||||
Zhenye Xie <xiezhenye at gmail.com>
|
Zhenye Xie <xiezhenye at gmail.com>
|
||||||
|
Zhixin Wen <john.wenzhixin at gmail.com>
|
||||||
|
|
||||||
# Organizations
|
# Organizations
|
||||||
|
|
||||||
|
@ -103,3 +114,4 @@ Multiplay Ltd.
|
||||||
Percona LLC
|
Percona LLC
|
||||||
Pivotal Inc.
|
Pivotal Inc.
|
||||||
Stripe Inc.
|
Stripe Inc.
|
||||||
|
Zendesk Inc.
|
||||||
|
|
26
vendor/github.com/go-sql-driver/mysql/CHANGELOG.md
generated
vendored
26
vendor/github.com/go-sql-driver/mysql/CHANGELOG.md
generated
vendored
|
@ -1,3 +1,29 @@
|
||||||
|
## Version 1.6 (2021-04-01)
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Migrate the CI service from travis-ci to GitHub Actions (#1176, #1183, #1190)
|
||||||
|
- `NullTime` is deprecated (#960, #1144)
|
||||||
|
- Reduce allocations when building SET command (#1111)
|
||||||
|
- Performance improvement for time formatting (#1118)
|
||||||
|
- Performance improvement for time parsing (#1098, #1113)
|
||||||
|
|
||||||
|
New Features:
|
||||||
|
|
||||||
|
- Implement `driver.Validator` interface (#1106, #1174)
|
||||||
|
- Support returning `uint64` from `Valuer` in `ConvertValue` (#1143)
|
||||||
|
- Add `json.RawMessage` for converter and prepared statement (#1059)
|
||||||
|
- Interpolate `json.RawMessage` as `string` (#1058)
|
||||||
|
- Implements `CheckNamedValue` (#1090)
|
||||||
|
|
||||||
|
Bugfixes:
|
||||||
|
|
||||||
|
- Stop rounding times (#1121, #1172)
|
||||||
|
- Put zero filler into the SSL handshake packet (#1066)
|
||||||
|
- Fix checking cancelled connections back into the connection pool (#1095)
|
||||||
|
- Fix remove last 0 byte for mysql_old_password when password is empty (#1133)
|
||||||
|
|
||||||
|
|
||||||
## Version 1.5 (2020-01-07)
|
## Version 1.5 (2020-01-07)
|
||||||
|
|
||||||
Changes:
|
Changes:
|
||||||
|
|
43
vendor/github.com/go-sql-driver/mysql/README.md
generated
vendored
43
vendor/github.com/go-sql-driver/mysql/README.md
generated
vendored
|
@ -35,7 +35,7 @@ A MySQL-Driver for Go's [database/sql](https://golang.org/pkg/database/sql/) pac
|
||||||
* Supports queries larger than 16MB
|
* Supports queries larger than 16MB
|
||||||
* Full [`sql.RawBytes`](https://golang.org/pkg/database/sql/#RawBytes) support.
|
* Full [`sql.RawBytes`](https://golang.org/pkg/database/sql/#RawBytes) support.
|
||||||
* Intelligent `LONG DATA` handling in prepared statements
|
* Intelligent `LONG DATA` handling in prepared statements
|
||||||
* Secure `LOAD DATA LOCAL INFILE` support with file Whitelisting and `io.Reader` support
|
* Secure `LOAD DATA LOCAL INFILE` support with file allowlisting and `io.Reader` support
|
||||||
* Optional `time.Time` parsing
|
* Optional `time.Time` parsing
|
||||||
* Optional placeholder interpolation
|
* Optional placeholder interpolation
|
||||||
|
|
||||||
|
@ -56,15 +56,37 @@ Make sure [Git is installed](https://git-scm.com/downloads) on your machine and
|
||||||
_Go MySQL Driver_ is an implementation of Go's `database/sql/driver` interface. You only need to import the driver and can use the full [`database/sql`](https://golang.org/pkg/database/sql/) API then.
|
_Go MySQL Driver_ is an implementation of Go's `database/sql/driver` interface. You only need to import the driver and can use the full [`database/sql`](https://golang.org/pkg/database/sql/) API then.
|
||||||
|
|
||||||
Use `mysql` as `driverName` and a valid [DSN](#dsn-data-source-name) as `dataSourceName`:
|
Use `mysql` as `driverName` and a valid [DSN](#dsn-data-source-name) as `dataSourceName`:
|
||||||
|
|
||||||
```go
|
```go
|
||||||
import "database/sql"
|
import (
|
||||||
import _ "github.com/go-sql-driver/mysql"
|
"database/sql"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
_ "github.com/go-sql-driver/mysql"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ...
|
||||||
|
|
||||||
db, err := sql.Open("mysql", "user:password@/dbname")
|
db, err := sql.Open("mysql", "user:password@/dbname")
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
// See "Important settings" section.
|
||||||
|
db.SetConnMaxLifetime(time.Minute * 3)
|
||||||
|
db.SetMaxOpenConns(10)
|
||||||
|
db.SetMaxIdleConns(10)
|
||||||
```
|
```
|
||||||
|
|
||||||
[Examples are available in our Wiki](https://github.com/go-sql-driver/mysql/wiki/Examples "Go-MySQL-Driver Examples").
|
[Examples are available in our Wiki](https://github.com/go-sql-driver/mysql/wiki/Examples "Go-MySQL-Driver Examples").
|
||||||
|
|
||||||
|
### Important settings
|
||||||
|
|
||||||
|
`db.SetConnMaxLifetime()` is required to ensure connections are closed by the driver safely before connection is closed by MySQL server, OS, or other middlewares. Since some middlewares close idle connections by 5 minutes, we recommend timeout shorter than 5 minutes. This setting helps load balancing and changing system variables too.
|
||||||
|
|
||||||
|
`db.SetMaxOpenConns()` is highly recommended to limit the number of connection used by the application. There is no recommended limit number because it depends on application and MySQL server.
|
||||||
|
|
||||||
|
`db.SetMaxIdleConns()` is recommended to be set same to (or greater than) `db.SetMaxOpenConns()`. When it is smaller than `SetMaxOpenConns()`, connections can be opened and closed very frequently than you expect. Idle connections can be closed by the `db.SetConnMaxLifetime()`. If you want to close idle connections more rapidly, you can use `db.SetConnMaxIdleTime()` since Go 1.15.
|
||||||
|
|
||||||
|
|
||||||
### DSN (Data Source Name)
|
### DSN (Data Source Name)
|
||||||
|
|
||||||
|
@ -122,7 +144,7 @@ Valid Values: true, false
|
||||||
Default: false
|
Default: false
|
||||||
```
|
```
|
||||||
|
|
||||||
`allowAllFiles=true` disables the file Whitelist for `LOAD DATA LOCAL INFILE` and allows *all* files.
|
`allowAllFiles=true` disables the file allowlist for `LOAD DATA LOCAL INFILE` and allows *all* files.
|
||||||
[*Might be insecure!*](http://dev.mysql.com/doc/refman/5.7/en/load-data-local.html)
|
[*Might be insecure!*](http://dev.mysql.com/doc/refman/5.7/en/load-data-local.html)
|
||||||
|
|
||||||
##### `allowCleartextPasswords`
|
##### `allowCleartextPasswords`
|
||||||
|
@ -133,7 +155,7 @@ Valid Values: true, false
|
||||||
Default: false
|
Default: false
|
||||||
```
|
```
|
||||||
|
|
||||||
`allowCleartextPasswords=true` allows using the [cleartext client side plugin](http://dev.mysql.com/doc/en/cleartext-authentication-plugin.html) if required by an account, such as one defined with the [PAM authentication plugin](http://dev.mysql.com/doc/en/pam-authentication-plugin.html). Sending passwords in clear text may be a security problem in some configurations. To avoid problems if there is any possibility that the password would be intercepted, clients should connect to MySQL Server using a method that protects the password. Possibilities include [TLS / SSL](#tls), IPsec, or a private network.
|
`allowCleartextPasswords=true` allows using the [cleartext client side plugin](https://dev.mysql.com/doc/en/cleartext-pluggable-authentication.html) if required by an account, such as one defined with the [PAM authentication plugin](http://dev.mysql.com/doc/en/pam-authentication-plugin.html). Sending passwords in clear text may be a security problem in some configurations. To avoid problems if there is any possibility that the password would be intercepted, clients should connect to MySQL Server using a method that protects the password. Possibilities include [TLS / SSL](#tls), IPsec, or a private network.
|
||||||
|
|
||||||
##### `allowNativePasswords`
|
##### `allowNativePasswords`
|
||||||
|
|
||||||
|
@ -230,7 +252,7 @@ Default: false
|
||||||
|
|
||||||
If `interpolateParams` is true, placeholders (`?`) in calls to `db.Query()` and `db.Exec()` are interpolated into a single query string with given parameters. This reduces the number of roundtrips, since the driver has to prepare a statement, execute it with given parameters and close the statement again with `interpolateParams=false`.
|
If `interpolateParams` is true, placeholders (`?`) in calls to `db.Query()` and `db.Exec()` are interpolated into a single query string with given parameters. This reduces the number of roundtrips, since the driver has to prepare a statement, execute it with given parameters and close the statement again with `interpolateParams=false`.
|
||||||
|
|
||||||
*This can not be used together with the multibyte encodings BIG5, CP932, GB2312, GBK or SJIS. These are blacklisted as they may [introduce a SQL injection vulnerability](http://stackoverflow.com/a/12118602/3430118)!*
|
*This can not be used together with the multibyte encodings BIG5, CP932, GB2312, GBK or SJIS. These are rejected as they may [introduce a SQL injection vulnerability](http://stackoverflow.com/a/12118602/3430118)!*
|
||||||
|
|
||||||
##### `loc`
|
##### `loc`
|
||||||
|
|
||||||
|
@ -376,7 +398,7 @@ Rules:
|
||||||
Examples:
|
Examples:
|
||||||
* `autocommit=1`: `SET autocommit=1`
|
* `autocommit=1`: `SET autocommit=1`
|
||||||
* [`time_zone=%27Europe%2FParis%27`](https://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html): `SET time_zone='Europe/Paris'`
|
* [`time_zone=%27Europe%2FParis%27`](https://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html): `SET time_zone='Europe/Paris'`
|
||||||
* [`tx_isolation=%27REPEATABLE-READ%27`](https://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_tx_isolation): `SET tx_isolation='REPEATABLE-READ'`
|
* [`transaction_isolation=%27REPEATABLE-READ%27`](https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_transaction_isolation): `SET transaction_isolation='REPEATABLE-READ'`
|
||||||
|
|
||||||
|
|
||||||
#### Examples
|
#### Examples
|
||||||
|
@ -445,7 +467,7 @@ For this feature you need direct access to the package. Therefore you must chang
|
||||||
import "github.com/go-sql-driver/mysql"
|
import "github.com/go-sql-driver/mysql"
|
||||||
```
|
```
|
||||||
|
|
||||||
Files must be whitelisted by registering them with `mysql.RegisterLocalFile(filepath)` (recommended) or the Whitelist check must be deactivated by using the DSN parameter `allowAllFiles=true` ([*Might be insecure!*](http://dev.mysql.com/doc/refman/5.7/en/load-data-local.html)).
|
Files must be explicitly allowed by registering them with `mysql.RegisterLocalFile(filepath)` (recommended) or the allowlist check must be deactivated by using the DSN parameter `allowAllFiles=true` ([*Might be insecure!*](http://dev.mysql.com/doc/refman/5.7/en/load-data-local.html)).
|
||||||
|
|
||||||
To use a `io.Reader` a handler function must be registered with `mysql.RegisterReaderHandler(name, handler)` which returns a `io.Reader` or `io.ReadCloser`. The Reader is available with the filepath `Reader::<name>` then. Choose different names for different handlers and `DeregisterReaderHandler` when you don't need it anymore.
|
To use a `io.Reader` a handler function must be registered with `mysql.RegisterReaderHandler(name, handler)` which returns a `io.Reader` or `io.ReadCloser`. The Reader is available with the filepath `Reader::<name>` then. Choose different names for different handlers and `DeregisterReaderHandler` when you don't need it anymore.
|
||||||
|
|
||||||
|
@ -459,8 +481,6 @@ However, many want to scan MySQL `DATE` and `DATETIME` values into `time.Time` v
|
||||||
|
|
||||||
**Caution:** As of Go 1.1, this makes `time.Time` the only variable type you can scan `DATE` and `DATETIME` values into. This breaks for example [`sql.RawBytes` support](https://github.com/go-sql-driver/mysql/wiki/Examples#rawbytes).
|
**Caution:** As of Go 1.1, this makes `time.Time` the only variable type you can scan `DATE` and `DATETIME` values into. This breaks for example [`sql.RawBytes` support](https://github.com/go-sql-driver/mysql/wiki/Examples#rawbytes).
|
||||||
|
|
||||||
Alternatively you can use the [`NullTime`](https://godoc.org/github.com/go-sql-driver/mysql#NullTime) type as the scan destination, which works with both `time.Time` and `string` / `[]byte`.
|
|
||||||
|
|
||||||
|
|
||||||
### Unicode support
|
### Unicode support
|
||||||
Since version 1.5 Go-MySQL-Driver automatically uses the collation ` utf8mb4_general_ci` by default.
|
Since version 1.5 Go-MySQL-Driver automatically uses the collation ` utf8mb4_general_ci` by default.
|
||||||
|
@ -477,7 +497,7 @@ To run the driver tests you may need to adjust the configuration. See the [Testi
|
||||||
Go-MySQL-Driver is not feature-complete yet. Your help is very appreciated.
|
Go-MySQL-Driver is not feature-complete yet. Your help is very appreciated.
|
||||||
If you want to contribute, you can work on an [open issue](https://github.com/go-sql-driver/mysql/issues?state=open) or review a [pull request](https://github.com/go-sql-driver/mysql/pulls).
|
If you want to contribute, you can work on an [open issue](https://github.com/go-sql-driver/mysql/issues?state=open) or review a [pull request](https://github.com/go-sql-driver/mysql/pulls).
|
||||||
|
|
||||||
See the [Contribution Guidelines](https://github.com/go-sql-driver/mysql/blob/master/CONTRIBUTING.md) for details.
|
See the [Contribution Guidelines](https://github.com/go-sql-driver/mysql/blob/master/.github/CONTRIBUTING.md) for details.
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
|
@ -498,4 +518,3 @@ Please read the [MPL 2.0 FAQ](https://www.mozilla.org/en-US/MPL/2.0/FAQ/) if you
|
||||||
You can read the full terms here: [LICENSE](https://raw.github.com/go-sql-driver/mysql/master/LICENSE).
|
You can read the full terms here: [LICENSE](https://raw.github.com/go-sql-driver/mysql/master/LICENSE).
|
||||||
|
|
||||||
![Go Gopher and MySQL Dolphin](https://raw.github.com/wiki/go-sql-driver/mysql/go-mysql-driver_m.jpg "Golang Gopher transporting the MySQL Dolphin in a wheelbarrow")
|
![Go Gopher and MySQL Dolphin](https://raw.github.com/wiki/go-sql-driver/mysql/go-mysql-driver_m.jpg "Golang Gopher transporting the MySQL Dolphin in a wheelbarrow")
|
||||||
|
|
||||||
|
|
13
vendor/github.com/go-sql-driver/mysql/auth.go
generated
vendored
13
vendor/github.com/go-sql-driver/mysql/auth.go
generated
vendored
|
@ -15,6 +15,7 @@ import (
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"encoding/pem"
|
"encoding/pem"
|
||||||
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -136,10 +137,6 @@ func pwHash(password []byte) (result [2]uint32) {
|
||||||
|
|
||||||
// Hash password using insecure pre 4.1 method
|
// Hash password using insecure pre 4.1 method
|
||||||
func scrambleOldPassword(scramble []byte, password string) []byte {
|
func scrambleOldPassword(scramble []byte, password string) []byte {
|
||||||
if len(password) == 0 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
scramble = scramble[:8]
|
scramble = scramble[:8]
|
||||||
|
|
||||||
hashPw := pwHash([]byte(password))
|
hashPw := pwHash([]byte(password))
|
||||||
|
@ -247,6 +244,9 @@ func (mc *mysqlConn) auth(authData []byte, plugin string) ([]byte, error) {
|
||||||
if !mc.cfg.AllowOldPasswords {
|
if !mc.cfg.AllowOldPasswords {
|
||||||
return nil, ErrOldPassword
|
return nil, ErrOldPassword
|
||||||
}
|
}
|
||||||
|
if len(mc.cfg.Passwd) == 0 {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
// Note: there are edge cases where this should work but doesn't;
|
// Note: there are edge cases where this should work but doesn't;
|
||||||
// this is currently "wontfix":
|
// this is currently "wontfix":
|
||||||
// https://github.com/go-sql-driver/mysql/issues/184
|
// https://github.com/go-sql-driver/mysql/issues/184
|
||||||
|
@ -372,7 +372,10 @@ func (mc *mysqlConn) handleAuthResult(oldAuthData []byte, plugin string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
block, _ := pem.Decode(data[1:])
|
block, rest := pem.Decode(data[1:])
|
||||||
|
if block == nil {
|
||||||
|
return fmt.Errorf("No Pem data found, data: %s", rest)
|
||||||
|
}
|
||||||
pkix, err := x509.ParsePKIXPublicKey(block.Bytes)
|
pkix, err := x509.ParsePKIXPublicKey(block.Bytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
2
vendor/github.com/go-sql-driver/mysql/collations.go
generated
vendored
2
vendor/github.com/go-sql-driver/mysql/collations.go
generated
vendored
|
@ -247,7 +247,7 @@ var collations = map[string]byte{
|
||||||
"utf8mb4_0900_ai_ci": 255,
|
"utf8mb4_0900_ai_ci": 255,
|
||||||
}
|
}
|
||||||
|
|
||||||
// A blacklist of collations which is unsafe to interpolate parameters.
|
// A denylist of collations which is unsafe to interpolate parameters.
|
||||||
// These multibyte encodings may contains 0x5c (`\`) in their trailing bytes.
|
// These multibyte encodings may contains 0x5c (`\`) in their trailing bytes.
|
||||||
var unsafeCollations = map[string]bool{
|
var unsafeCollations = map[string]bool{
|
||||||
"big5_chinese_ci": true,
|
"big5_chinese_ci": true,
|
||||||
|
|
85
vendor/github.com/go-sql-driver/mysql/connection.go
generated
vendored
85
vendor/github.com/go-sql-driver/mysql/connection.go
generated
vendored
|
@ -12,6 +12,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"database/sql/driver"
|
"database/sql/driver"
|
||||||
|
"encoding/json"
|
||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
@ -46,9 +47,10 @@ type mysqlConn struct {
|
||||||
|
|
||||||
// Handles parameters set in DSN after the connection is established
|
// Handles parameters set in DSN after the connection is established
|
||||||
func (mc *mysqlConn) handleParams() (err error) {
|
func (mc *mysqlConn) handleParams() (err error) {
|
||||||
|
var cmdSet strings.Builder
|
||||||
for param, val := range mc.cfg.Params {
|
for param, val := range mc.cfg.Params {
|
||||||
switch param {
|
switch param {
|
||||||
// Charset
|
// Charset: character_set_connection, character_set_client, character_set_results
|
||||||
case "charset":
|
case "charset":
|
||||||
charsets := strings.Split(val, ",")
|
charsets := strings.Split(val, ",")
|
||||||
for i := range charsets {
|
for i := range charsets {
|
||||||
|
@ -62,12 +64,25 @@ func (mc *mysqlConn) handleParams() (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// System Vars
|
// Other system vars accumulated in a single SET command
|
||||||
default:
|
default:
|
||||||
err = mc.exec("SET " + param + "=" + val + "")
|
if cmdSet.Len() == 0 {
|
||||||
if err != nil {
|
// Heuristic: 29 chars for each other key=value to reduce reallocations
|
||||||
return
|
cmdSet.Grow(4 + len(param) + 1 + len(val) + 30*(len(mc.cfg.Params)-1))
|
||||||
|
cmdSet.WriteString("SET ")
|
||||||
|
} else {
|
||||||
|
cmdSet.WriteByte(',')
|
||||||
}
|
}
|
||||||
|
cmdSet.WriteString(param)
|
||||||
|
cmdSet.WriteByte('=')
|
||||||
|
cmdSet.WriteString(val)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if cmdSet.Len() > 0 {
|
||||||
|
err = mc.exec(cmdSet.String())
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,47 +245,21 @@ func (mc *mysqlConn) interpolateParams(query string, args []driver.Value) (strin
|
||||||
if v.IsZero() {
|
if v.IsZero() {
|
||||||
buf = append(buf, "'0000-00-00'"...)
|
buf = append(buf, "'0000-00-00'"...)
|
||||||
} else {
|
} else {
|
||||||
v := v.In(mc.cfg.Loc)
|
buf = append(buf, '\'')
|
||||||
v = v.Add(time.Nanosecond * 500) // To round under microsecond
|
buf, err = appendDateTime(buf, v.In(mc.cfg.Loc))
|
||||||
year := v.Year()
|
if err != nil {
|
||||||
year100 := year / 100
|
return "", err
|
||||||
year1 := year % 100
|
|
||||||
month := v.Month()
|
|
||||||
day := v.Day()
|
|
||||||
hour := v.Hour()
|
|
||||||
minute := v.Minute()
|
|
||||||
second := v.Second()
|
|
||||||
micro := v.Nanosecond() / 1000
|
|
||||||
|
|
||||||
buf = append(buf, []byte{
|
|
||||||
'\'',
|
|
||||||
digits10[year100], digits01[year100],
|
|
||||||
digits10[year1], digits01[year1],
|
|
||||||
'-',
|
|
||||||
digits10[month], digits01[month],
|
|
||||||
'-',
|
|
||||||
digits10[day], digits01[day],
|
|
||||||
' ',
|
|
||||||
digits10[hour], digits01[hour],
|
|
||||||
':',
|
|
||||||
digits10[minute], digits01[minute],
|
|
||||||
':',
|
|
||||||
digits10[second], digits01[second],
|
|
||||||
}...)
|
|
||||||
|
|
||||||
if micro != 0 {
|
|
||||||
micro10000 := micro / 10000
|
|
||||||
micro100 := micro / 100 % 100
|
|
||||||
micro1 := micro % 100
|
|
||||||
buf = append(buf, []byte{
|
|
||||||
'.',
|
|
||||||
digits10[micro10000], digits01[micro10000],
|
|
||||||
digits10[micro100], digits01[micro100],
|
|
||||||
digits10[micro1], digits01[micro1],
|
|
||||||
}...)
|
|
||||||
}
|
}
|
||||||
buf = append(buf, '\'')
|
buf = append(buf, '\'')
|
||||||
}
|
}
|
||||||
|
case json.RawMessage:
|
||||||
|
buf = append(buf, '\'')
|
||||||
|
if mc.status&statusNoBackslashEscapes == 0 {
|
||||||
|
buf = escapeBytesBackslash(buf, v)
|
||||||
|
} else {
|
||||||
|
buf = escapeBytesQuotes(buf, v)
|
||||||
|
}
|
||||||
|
buf = append(buf, '\'')
|
||||||
case []byte:
|
case []byte:
|
||||||
if v == nil {
|
if v == nil {
|
||||||
buf = append(buf, "NULL"...)
|
buf = append(buf, "NULL"...)
|
||||||
|
@ -480,6 +469,10 @@ func (mc *mysqlConn) Ping(ctx context.Context) (err error) {
|
||||||
|
|
||||||
// BeginTx implements driver.ConnBeginTx interface
|
// BeginTx implements driver.ConnBeginTx interface
|
||||||
func (mc *mysqlConn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error) {
|
func (mc *mysqlConn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error) {
|
||||||
|
if mc.closed.IsSet() {
|
||||||
|
return nil, driver.ErrBadConn
|
||||||
|
}
|
||||||
|
|
||||||
if err := mc.watchCancel(ctx); err != nil {
|
if err := mc.watchCancel(ctx); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -649,3 +642,9 @@ func (mc *mysqlConn) ResetSession(ctx context.Context) error {
|
||||||
mc.reset = true
|
mc.reset = true
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IsValid implements driver.Validator interface
|
||||||
|
// (From Go 1.15)
|
||||||
|
func (mc *mysqlConn) IsValid() bool {
|
||||||
|
return !mc.closed.IsSet()
|
||||||
|
}
|
||||||
|
|
2
vendor/github.com/go-sql-driver/mysql/dsn.go
generated
vendored
2
vendor/github.com/go-sql-driver/mysql/dsn.go
generated
vendored
|
@ -375,7 +375,7 @@ func parseDSNParams(cfg *Config, params string) (err error) {
|
||||||
|
|
||||||
// cfg params
|
// cfg params
|
||||||
switch value := param[1]; param[0] {
|
switch value := param[1]; param[0] {
|
||||||
// Disable INFILE whitelist / enable all files
|
// Disable INFILE allowlist / enable all files
|
||||||
case "allowAllFiles":
|
case "allowAllFiles":
|
||||||
var isBool bool
|
var isBool bool
|
||||||
cfg.AllowAllFiles, isBool = readBool(value)
|
cfg.AllowAllFiles, isBool = readBool(value)
|
||||||
|
|
2
vendor/github.com/go-sql-driver/mysql/fields.go
generated
vendored
2
vendor/github.com/go-sql-driver/mysql/fields.go
generated
vendored
|
@ -106,7 +106,7 @@ var (
|
||||||
scanTypeInt64 = reflect.TypeOf(int64(0))
|
scanTypeInt64 = reflect.TypeOf(int64(0))
|
||||||
scanTypeNullFloat = reflect.TypeOf(sql.NullFloat64{})
|
scanTypeNullFloat = reflect.TypeOf(sql.NullFloat64{})
|
||||||
scanTypeNullInt = reflect.TypeOf(sql.NullInt64{})
|
scanTypeNullInt = reflect.TypeOf(sql.NullInt64{})
|
||||||
scanTypeNullTime = reflect.TypeOf(NullTime{})
|
scanTypeNullTime = reflect.TypeOf(nullTime{})
|
||||||
scanTypeUint8 = reflect.TypeOf(uint8(0))
|
scanTypeUint8 = reflect.TypeOf(uint8(0))
|
||||||
scanTypeUint16 = reflect.TypeOf(uint16(0))
|
scanTypeUint16 = reflect.TypeOf(uint16(0))
|
||||||
scanTypeUint32 = reflect.TypeOf(uint32(0))
|
scanTypeUint32 = reflect.TypeOf(uint32(0))
|
||||||
|
|
24
vendor/github.com/go-sql-driver/mysql/fuzz.go
generated
vendored
Normal file
24
vendor/github.com/go-sql-driver/mysql/fuzz.go
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
// Go MySQL Driver - A MySQL-Driver for Go's database/sql package.
|
||||||
|
//
|
||||||
|
// Copyright 2020 The Go-MySQL-Driver Authors. All rights reserved.
|
||||||
|
//
|
||||||
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||||
|
// You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
// +build gofuzz
|
||||||
|
|
||||||
|
package mysql
|
||||||
|
|
||||||
|
import (
|
||||||
|
"database/sql"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Fuzz(data []byte) int {
|
||||||
|
db, err := sql.Open("mysql", string(data))
|
||||||
|
if err != nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
db.Close()
|
||||||
|
return 1
|
||||||
|
}
|
4
vendor/github.com/go-sql-driver/mysql/infile.go
generated
vendored
4
vendor/github.com/go-sql-driver/mysql/infile.go
generated
vendored
|
@ -23,7 +23,7 @@ var (
|
||||||
readerRegisterLock sync.RWMutex
|
readerRegisterLock sync.RWMutex
|
||||||
)
|
)
|
||||||
|
|
||||||
// RegisterLocalFile adds the given file to the file whitelist,
|
// RegisterLocalFile adds the given file to the file allowlist,
|
||||||
// so that it can be used by "LOAD DATA LOCAL INFILE <filepath>".
|
// so that it can be used by "LOAD DATA LOCAL INFILE <filepath>".
|
||||||
// Alternatively you can allow the use of all local files with
|
// Alternatively you can allow the use of all local files with
|
||||||
// the DSN parameter 'allowAllFiles=true'
|
// the DSN parameter 'allowAllFiles=true'
|
||||||
|
@ -45,7 +45,7 @@ func RegisterLocalFile(filePath string) {
|
||||||
fileRegisterLock.Unlock()
|
fileRegisterLock.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeregisterLocalFile removes the given filepath from the whitelist.
|
// DeregisterLocalFile removes the given filepath from the allowlist.
|
||||||
func DeregisterLocalFile(filePath string) {
|
func DeregisterLocalFile(filePath string) {
|
||||||
fileRegisterLock.Lock()
|
fileRegisterLock.Lock()
|
||||||
delete(fileRegister, strings.Trim(filePath, `"`))
|
delete(fileRegister, strings.Trim(filePath, `"`))
|
||||||
|
|
4
vendor/github.com/go-sql-driver/mysql/nulltime.go
generated
vendored
4
vendor/github.com/go-sql-driver/mysql/nulltime.go
generated
vendored
|
@ -28,11 +28,11 @@ func (nt *NullTime) Scan(value interface{}) (err error) {
|
||||||
nt.Time, nt.Valid = v, true
|
nt.Time, nt.Valid = v, true
|
||||||
return
|
return
|
||||||
case []byte:
|
case []byte:
|
||||||
nt.Time, err = parseDateTime(string(v), time.UTC)
|
nt.Time, err = parseDateTime(v, time.UTC)
|
||||||
nt.Valid = (err == nil)
|
nt.Valid = (err == nil)
|
||||||
return
|
return
|
||||||
case string:
|
case string:
|
||||||
nt.Time, err = parseDateTime(v, time.UTC)
|
nt.Time, err = parseDateTime([]byte(v), time.UTC)
|
||||||
nt.Valid = (err == nil)
|
nt.Valid = (err == nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
9
vendor/github.com/go-sql-driver/mysql/nulltime_go113.go
generated
vendored
9
vendor/github.com/go-sql-driver/mysql/nulltime_go113.go
generated
vendored
|
@ -28,4 +28,13 @@ import (
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// This NullTime implementation is not driver-specific
|
// This NullTime implementation is not driver-specific
|
||||||
|
//
|
||||||
|
// Deprecated: NullTime doesn't honor the loc DSN parameter.
|
||||||
|
// NullTime.Scan interprets a time as UTC, not the loc DSN parameter.
|
||||||
|
// Use sql.NullTime instead.
|
||||||
type NullTime sql.NullTime
|
type NullTime sql.NullTime
|
||||||
|
|
||||||
|
// for internal use.
|
||||||
|
// the mysql package uses sql.NullTime if it is available.
|
||||||
|
// if not, the package uses mysql.NullTime.
|
||||||
|
type nullTime = sql.NullTime // sql.NullTime is available
|
||||||
|
|
5
vendor/github.com/go-sql-driver/mysql/nulltime_legacy.go
generated
vendored
5
vendor/github.com/go-sql-driver/mysql/nulltime_legacy.go
generated
vendored
|
@ -32,3 +32,8 @@ type NullTime struct {
|
||||||
Time time.Time
|
Time time.Time
|
||||||
Valid bool // Valid is true if Time is not NULL
|
Valid bool // Valid is true if Time is not NULL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// for internal use.
|
||||||
|
// the mysql package uses sql.NullTime if it is available.
|
||||||
|
// if not, the package uses mysql.NullTime.
|
||||||
|
type nullTime = NullTime // sql.NullTime is not available
|
||||||
|
|
23
vendor/github.com/go-sql-driver/mysql/packets.go
generated
vendored
23
vendor/github.com/go-sql-driver/mysql/packets.go
generated
vendored
|
@ -13,6 +13,7 @@ import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"database/sql/driver"
|
"database/sql/driver"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
@ -348,6 +349,12 @@ func (mc *mysqlConn) writeHandshakeResponsePacket(authResp []byte, plugin string
|
||||||
return errors.New("unknown collation")
|
return errors.New("unknown collation")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Filler [23 bytes] (all 0x00)
|
||||||
|
pos := 13
|
||||||
|
for ; pos < 13+23; pos++ {
|
||||||
|
data[pos] = 0
|
||||||
|
}
|
||||||
|
|
||||||
// SSL Connection Request Packet
|
// SSL Connection Request Packet
|
||||||
// http://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::SSLRequest
|
// http://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::SSLRequest
|
||||||
if mc.cfg.tls != nil {
|
if mc.cfg.tls != nil {
|
||||||
|
@ -366,12 +373,6 @@ func (mc *mysqlConn) writeHandshakeResponsePacket(authResp []byte, plugin string
|
||||||
mc.buf.nc = tlsConn
|
mc.buf.nc = tlsConn
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filler [23 bytes] (all 0x00)
|
|
||||||
pos := 13
|
|
||||||
for ; pos < 13+23; pos++ {
|
|
||||||
data[pos] = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// User [null terminated string]
|
// User [null terminated string]
|
||||||
if len(mc.cfg.User) > 0 {
|
if len(mc.cfg.User) > 0 {
|
||||||
pos += copy(data[pos:], mc.cfg.User)
|
pos += copy(data[pos:], mc.cfg.User)
|
||||||
|
@ -777,7 +778,7 @@ func (rows *textRows) readRow(dest []driver.Value) error {
|
||||||
case fieldTypeTimestamp, fieldTypeDateTime,
|
case fieldTypeTimestamp, fieldTypeDateTime,
|
||||||
fieldTypeDate, fieldTypeNewDate:
|
fieldTypeDate, fieldTypeNewDate:
|
||||||
dest[i], err = parseDateTime(
|
dest[i], err = parseDateTime(
|
||||||
string(dest[i].([]byte)),
|
dest[i].([]byte),
|
||||||
mc.cfg.Loc,
|
mc.cfg.Loc,
|
||||||
)
|
)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
@ -1003,6 +1004,9 @@ func (stmt *mysqlStmt) writeExecutePacket(args []driver.Value) error {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if v, ok := arg.(json.RawMessage); ok {
|
||||||
|
arg = []byte(v)
|
||||||
|
}
|
||||||
// cache types and values
|
// cache types and values
|
||||||
switch v := arg.(type) {
|
switch v := arg.(type) {
|
||||||
case int64:
|
case int64:
|
||||||
|
@ -1112,7 +1116,10 @@ func (stmt *mysqlStmt) writeExecutePacket(args []driver.Value) error {
|
||||||
if v.IsZero() {
|
if v.IsZero() {
|
||||||
b = append(b, "0000-00-00"...)
|
b = append(b, "0000-00-00"...)
|
||||||
} else {
|
} else {
|
||||||
b = v.In(mc.cfg.Loc).AppendFormat(b, timeFormat)
|
b, err = appendDateTime(b, v.In(mc.cfg.Loc))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
paramValues = appendLengthEncodedInteger(paramValues,
|
paramValues = appendLengthEncodedInteger(paramValues,
|
||||||
|
|
30
vendor/github.com/go-sql-driver/mysql/statement.go
generated
vendored
30
vendor/github.com/go-sql-driver/mysql/statement.go
generated
vendored
|
@ -10,6 +10,7 @@ package mysql
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql/driver"
|
"database/sql/driver"
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
@ -43,6 +44,11 @@ func (stmt *mysqlStmt) ColumnConverter(idx int) driver.ValueConverter {
|
||||||
return converter{}
|
return converter{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (stmt *mysqlStmt) CheckNamedValue(nv *driver.NamedValue) (err error) {
|
||||||
|
nv.Value, err = converter{}.ConvertValue(nv.Value)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func (stmt *mysqlStmt) Exec(args []driver.Value) (driver.Result, error) {
|
func (stmt *mysqlStmt) Exec(args []driver.Value) (driver.Result, error) {
|
||||||
if stmt.mc.closed.IsSet() {
|
if stmt.mc.closed.IsSet() {
|
||||||
errLog.Print(ErrInvalidConn)
|
errLog.Print(ErrInvalidConn)
|
||||||
|
@ -129,6 +135,8 @@ func (stmt *mysqlStmt) query(args []driver.Value) (*binaryRows, error) {
|
||||||
return rows, err
|
return rows, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var jsonType = reflect.TypeOf(json.RawMessage{})
|
||||||
|
|
||||||
type converter struct{}
|
type converter struct{}
|
||||||
|
|
||||||
// ConvertValue mirrors the reference/default converter in database/sql/driver
|
// ConvertValue mirrors the reference/default converter in database/sql/driver
|
||||||
|
@ -146,12 +154,17 @@ func (c converter) ConvertValue(v interface{}) (driver.Value, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if !driver.IsValue(sv) {
|
if driver.IsValue(sv) {
|
||||||
return nil, fmt.Errorf("non-Value type %T returned from Value", sv)
|
return sv, nil
|
||||||
}
|
}
|
||||||
return sv, nil
|
// A value returend from the Valuer interface can be "a type handled by
|
||||||
|
// a database driver's NamedValueChecker interface" so we should accept
|
||||||
|
// uint64 here as well.
|
||||||
|
if u, ok := sv.(uint64); ok {
|
||||||
|
return u, nil
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("non-Value type %T returned from Value", sv)
|
||||||
}
|
}
|
||||||
|
|
||||||
rv := reflect.ValueOf(v)
|
rv := reflect.ValueOf(v)
|
||||||
switch rv.Kind() {
|
switch rv.Kind() {
|
||||||
case reflect.Ptr:
|
case reflect.Ptr:
|
||||||
|
@ -170,11 +183,14 @@ func (c converter) ConvertValue(v interface{}) (driver.Value, error) {
|
||||||
case reflect.Bool:
|
case reflect.Bool:
|
||||||
return rv.Bool(), nil
|
return rv.Bool(), nil
|
||||||
case reflect.Slice:
|
case reflect.Slice:
|
||||||
ek := rv.Type().Elem().Kind()
|
switch t := rv.Type(); {
|
||||||
if ek == reflect.Uint8 {
|
case t == jsonType:
|
||||||
|
return v, nil
|
||||||
|
case t.Elem().Kind() == reflect.Uint8:
|
||||||
return rv.Bytes(), nil
|
return rv.Bytes(), nil
|
||||||
|
default:
|
||||||
|
return nil, fmt.Errorf("unsupported type %T, a slice of %s", v, t.Elem().Kind())
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("unsupported type %T, a slice of %s", v, ek)
|
|
||||||
case reflect.String:
|
case reflect.String:
|
||||||
return rv.String(), nil
|
return rv.String(), nil
|
||||||
}
|
}
|
||||||
|
|
195
vendor/github.com/go-sql-driver/mysql/utils.go
generated
vendored
195
vendor/github.com/go-sql-driver/mysql/utils.go
generated
vendored
|
@ -106,27 +106,136 @@ func readBool(input string) (value bool, valid bool) {
|
||||||
* Time related utils *
|
* Time related utils *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
func parseDateTime(str string, loc *time.Location) (t time.Time, err error) {
|
func parseDateTime(b []byte, loc *time.Location) (time.Time, error) {
|
||||||
base := "0000-00-00 00:00:00.0000000"
|
const base = "0000-00-00 00:00:00.000000"
|
||||||
switch len(str) {
|
switch len(b) {
|
||||||
case 10, 19, 21, 22, 23, 24, 25, 26: // up to "YYYY-MM-DD HH:MM:SS.MMMMMM"
|
case 10, 19, 21, 22, 23, 24, 25, 26: // up to "YYYY-MM-DD HH:MM:SS.MMMMMM"
|
||||||
if str == base[:len(str)] {
|
if string(b) == base[:len(b)] {
|
||||||
return
|
return time.Time{}, nil
|
||||||
}
|
}
|
||||||
t, err = time.Parse(timeFormat[:len(str)], str)
|
|
||||||
|
year, err := parseByteYear(b)
|
||||||
|
if err != nil {
|
||||||
|
return time.Time{}, err
|
||||||
|
}
|
||||||
|
if year <= 0 {
|
||||||
|
year = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if b[4] != '-' {
|
||||||
|
return time.Time{}, fmt.Errorf("bad value for field: `%c`", b[4])
|
||||||
|
}
|
||||||
|
|
||||||
|
m, err := parseByte2Digits(b[5], b[6])
|
||||||
|
if err != nil {
|
||||||
|
return time.Time{}, err
|
||||||
|
}
|
||||||
|
if m <= 0 {
|
||||||
|
m = 1
|
||||||
|
}
|
||||||
|
month := time.Month(m)
|
||||||
|
|
||||||
|
if b[7] != '-' {
|
||||||
|
return time.Time{}, fmt.Errorf("bad value for field: `%c`", b[7])
|
||||||
|
}
|
||||||
|
|
||||||
|
day, err := parseByte2Digits(b[8], b[9])
|
||||||
|
if err != nil {
|
||||||
|
return time.Time{}, err
|
||||||
|
}
|
||||||
|
if day <= 0 {
|
||||||
|
day = 1
|
||||||
|
}
|
||||||
|
if len(b) == 10 {
|
||||||
|
return time.Date(year, month, day, 0, 0, 0, 0, loc), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if b[10] != ' ' {
|
||||||
|
return time.Time{}, fmt.Errorf("bad value for field: `%c`", b[10])
|
||||||
|
}
|
||||||
|
|
||||||
|
hour, err := parseByte2Digits(b[11], b[12])
|
||||||
|
if err != nil {
|
||||||
|
return time.Time{}, err
|
||||||
|
}
|
||||||
|
if b[13] != ':' {
|
||||||
|
return time.Time{}, fmt.Errorf("bad value for field: `%c`", b[13])
|
||||||
|
}
|
||||||
|
|
||||||
|
min, err := parseByte2Digits(b[14], b[15])
|
||||||
|
if err != nil {
|
||||||
|
return time.Time{}, err
|
||||||
|
}
|
||||||
|
if b[16] != ':' {
|
||||||
|
return time.Time{}, fmt.Errorf("bad value for field: `%c`", b[16])
|
||||||
|
}
|
||||||
|
|
||||||
|
sec, err := parseByte2Digits(b[17], b[18])
|
||||||
|
if err != nil {
|
||||||
|
return time.Time{}, err
|
||||||
|
}
|
||||||
|
if len(b) == 19 {
|
||||||
|
return time.Date(year, month, day, hour, min, sec, 0, loc), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if b[19] != '.' {
|
||||||
|
return time.Time{}, fmt.Errorf("bad value for field: `%c`", b[19])
|
||||||
|
}
|
||||||
|
nsec, err := parseByteNanoSec(b[20:])
|
||||||
|
if err != nil {
|
||||||
|
return time.Time{}, err
|
||||||
|
}
|
||||||
|
return time.Date(year, month, day, hour, min, sec, nsec, loc), nil
|
||||||
default:
|
default:
|
||||||
err = fmt.Errorf("invalid time string: %s", str)
|
return time.Time{}, fmt.Errorf("invalid time bytes: %s", b)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Adjust location
|
func parseByteYear(b []byte) (int, error) {
|
||||||
if err == nil && loc != time.UTC {
|
year, n := 0, 1000
|
||||||
y, mo, d := t.Date()
|
for i := 0; i < 4; i++ {
|
||||||
h, mi, s := t.Clock()
|
v, err := bToi(b[i])
|
||||||
t, err = time.Date(y, mo, d, h, mi, s, t.Nanosecond(), loc), nil
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
year += v * n
|
||||||
|
n = n / 10
|
||||||
}
|
}
|
||||||
|
return year, nil
|
||||||
|
}
|
||||||
|
|
||||||
return
|
func parseByte2Digits(b1, b2 byte) (int, error) {
|
||||||
|
d1, err := bToi(b1)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
d2, err := bToi(b2)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
return d1*10 + d2, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func parseByteNanoSec(b []byte) (int, error) {
|
||||||
|
ns, digit := 0, 100000 // max is 6-digits
|
||||||
|
for i := 0; i < len(b); i++ {
|
||||||
|
v, err := bToi(b[i])
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
ns += v * digit
|
||||||
|
digit /= 10
|
||||||
|
}
|
||||||
|
// nanoseconds has 10-digits. (needs to scale digits)
|
||||||
|
// 10 - 6 = 4, so we have to multiple 1000.
|
||||||
|
return ns * 1000, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func bToi(b byte) (int, error) {
|
||||||
|
if b < '0' || b > '9' {
|
||||||
|
return 0, errors.New("not [0-9]")
|
||||||
|
}
|
||||||
|
return int(b - '0'), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseBinaryDateTime(num uint64, data []byte, loc *time.Location) (driver.Value, error) {
|
func parseBinaryDateTime(num uint64, data []byte, loc *time.Location) (driver.Value, error) {
|
||||||
|
@ -167,6 +276,64 @@ func parseBinaryDateTime(num uint64, data []byte, loc *time.Location) (driver.Va
|
||||||
return nil, fmt.Errorf("invalid DATETIME packet length %d", num)
|
return nil, fmt.Errorf("invalid DATETIME packet length %d", num)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func appendDateTime(buf []byte, t time.Time) ([]byte, error) {
|
||||||
|
year, month, day := t.Date()
|
||||||
|
hour, min, sec := t.Clock()
|
||||||
|
nsec := t.Nanosecond()
|
||||||
|
|
||||||
|
if year < 1 || year > 9999 {
|
||||||
|
return buf, errors.New("year is not in the range [1, 9999]: " + strconv.Itoa(year)) // use errors.New instead of fmt.Errorf to avoid year escape to heap
|
||||||
|
}
|
||||||
|
year100 := year / 100
|
||||||
|
year1 := year % 100
|
||||||
|
|
||||||
|
var localBuf [len("2006-01-02T15:04:05.999999999")]byte // does not escape
|
||||||
|
localBuf[0], localBuf[1], localBuf[2], localBuf[3] = digits10[year100], digits01[year100], digits10[year1], digits01[year1]
|
||||||
|
localBuf[4] = '-'
|
||||||
|
localBuf[5], localBuf[6] = digits10[month], digits01[month]
|
||||||
|
localBuf[7] = '-'
|
||||||
|
localBuf[8], localBuf[9] = digits10[day], digits01[day]
|
||||||
|
|
||||||
|
if hour == 0 && min == 0 && sec == 0 && nsec == 0 {
|
||||||
|
return append(buf, localBuf[:10]...), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
localBuf[10] = ' '
|
||||||
|
localBuf[11], localBuf[12] = digits10[hour], digits01[hour]
|
||||||
|
localBuf[13] = ':'
|
||||||
|
localBuf[14], localBuf[15] = digits10[min], digits01[min]
|
||||||
|
localBuf[16] = ':'
|
||||||
|
localBuf[17], localBuf[18] = digits10[sec], digits01[sec]
|
||||||
|
|
||||||
|
if nsec == 0 {
|
||||||
|
return append(buf, localBuf[:19]...), nil
|
||||||
|
}
|
||||||
|
nsec100000000 := nsec / 100000000
|
||||||
|
nsec1000000 := (nsec / 1000000) % 100
|
||||||
|
nsec10000 := (nsec / 10000) % 100
|
||||||
|
nsec100 := (nsec / 100) % 100
|
||||||
|
nsec1 := nsec % 100
|
||||||
|
localBuf[19] = '.'
|
||||||
|
|
||||||
|
// milli second
|
||||||
|
localBuf[20], localBuf[21], localBuf[22] =
|
||||||
|
digits01[nsec100000000], digits10[nsec1000000], digits01[nsec1000000]
|
||||||
|
// micro second
|
||||||
|
localBuf[23], localBuf[24], localBuf[25] =
|
||||||
|
digits10[nsec10000], digits01[nsec10000], digits10[nsec100]
|
||||||
|
// nano second
|
||||||
|
localBuf[26], localBuf[27], localBuf[28] =
|
||||||
|
digits01[nsec100], digits10[nsec1], digits01[nsec1]
|
||||||
|
|
||||||
|
// trim trailing zeros
|
||||||
|
n := len(localBuf)
|
||||||
|
for n > 0 && localBuf[n-1] == '0' {
|
||||||
|
n--
|
||||||
|
}
|
||||||
|
|
||||||
|
return append(buf, localBuf[:n]...), nil
|
||||||
|
}
|
||||||
|
|
||||||
// zeroDateTime is used in formatBinaryDateTime to avoid an allocation
|
// zeroDateTime is used in formatBinaryDateTime to avoid an allocation
|
||||||
// if the DATE or DATETIME has the zero value.
|
// if the DATE or DATETIME has the zero value.
|
||||||
// It must never be changed.
|
// It must never be changed.
|
||||||
|
|
38
vendor/github.com/json-iterator/go/README.md
generated
vendored
38
vendor/github.com/json-iterator/go/README.md
generated
vendored
|
@ -1,5 +1,5 @@
|
||||||
[![Sourcegraph](https://sourcegraph.com/github.com/json-iterator/go/-/badge.svg)](https://sourcegraph.com/github.com/json-iterator/go?badge)
|
[![Sourcegraph](https://sourcegraph.com/github.com/json-iterator/go/-/badge.svg)](https://sourcegraph.com/github.com/json-iterator/go?badge)
|
||||||
[![GoDoc](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](http://godoc.org/github.com/json-iterator/go)
|
[![GoDoc](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](https://pkg.go.dev/github.com/json-iterator/go)
|
||||||
[![Build Status](https://travis-ci.org/json-iterator/go.svg?branch=master)](https://travis-ci.org/json-iterator/go)
|
[![Build Status](https://travis-ci.org/json-iterator/go.svg?branch=master)](https://travis-ci.org/json-iterator/go)
|
||||||
[![codecov](https://codecov.io/gh/json-iterator/go/branch/master/graph/badge.svg)](https://codecov.io/gh/json-iterator/go)
|
[![codecov](https://codecov.io/gh/json-iterator/go/branch/master/graph/badge.svg)](https://codecov.io/gh/json-iterator/go)
|
||||||
[![rcard](https://goreportcard.com/badge/github.com/json-iterator/go)](https://goreportcard.com/report/github.com/json-iterator/go)
|
[![rcard](https://goreportcard.com/badge/github.com/json-iterator/go)](https://goreportcard.com/report/github.com/json-iterator/go)
|
||||||
|
@ -8,8 +8,6 @@
|
||||||
|
|
||||||
A high-performance 100% compatible drop-in replacement of "encoding/json"
|
A high-performance 100% compatible drop-in replacement of "encoding/json"
|
||||||
|
|
||||||
You can also use thrift like JSON using [thrift-iterator](https://github.com/thrift-iterator/go)
|
|
||||||
|
|
||||||
# Benchmark
|
# Benchmark
|
||||||
|
|
||||||
![benchmark](http://jsoniter.com/benchmarks/go-benchmark.png)
|
![benchmark](http://jsoniter.com/benchmarks/go-benchmark.png)
|
||||||
|
@ -18,16 +16,16 @@ Source code: https://github.com/json-iterator/go-benchmark/blob/master/src/githu
|
||||||
|
|
||||||
Raw Result (easyjson requires static code generation)
|
Raw Result (easyjson requires static code generation)
|
||||||
|
|
||||||
| | ns/op | allocation bytes | allocation times |
|
| | ns/op | allocation bytes | allocation times |
|
||||||
| --- | --- | --- | --- |
|
| --------------- | ----------- | ---------------- | ---------------- |
|
||||||
| std decode | 35510 ns/op | 1960 B/op | 99 allocs/op |
|
| std decode | 35510 ns/op | 1960 B/op | 99 allocs/op |
|
||||||
| easyjson decode | 8499 ns/op | 160 B/op | 4 allocs/op |
|
| easyjson decode | 8499 ns/op | 160 B/op | 4 allocs/op |
|
||||||
| jsoniter decode | 5623 ns/op | 160 B/op | 3 allocs/op |
|
| jsoniter decode | 5623 ns/op | 160 B/op | 3 allocs/op |
|
||||||
| std encode | 2213 ns/op | 712 B/op | 5 allocs/op |
|
| std encode | 2213 ns/op | 712 B/op | 5 allocs/op |
|
||||||
| easyjson encode | 883 ns/op | 576 B/op | 3 allocs/op |
|
| easyjson encode | 883 ns/op | 576 B/op | 3 allocs/op |
|
||||||
| jsoniter encode | 837 ns/op | 384 B/op | 4 allocs/op |
|
| jsoniter encode | 837 ns/op | 384 B/op | 4 allocs/op |
|
||||||
|
|
||||||
Always benchmark with your own workload.
|
Always benchmark with your own workload.
|
||||||
The result depends heavily on the data input.
|
The result depends heavily on the data input.
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
|
@ -41,10 +39,10 @@ import "encoding/json"
|
||||||
json.Marshal(&data)
|
json.Marshal(&data)
|
||||||
```
|
```
|
||||||
|
|
||||||
with
|
with
|
||||||
|
|
||||||
```go
|
```go
|
||||||
import "github.com/json-iterator/go"
|
import jsoniter "github.com/json-iterator/go"
|
||||||
|
|
||||||
var json = jsoniter.ConfigCompatibleWithStandardLibrary
|
var json = jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
json.Marshal(&data)
|
json.Marshal(&data)
|
||||||
|
@ -60,7 +58,7 @@ json.Unmarshal(input, &data)
|
||||||
with
|
with
|
||||||
|
|
||||||
```go
|
```go
|
||||||
import "github.com/json-iterator/go"
|
import jsoniter "github.com/json-iterator/go"
|
||||||
|
|
||||||
var json = jsoniter.ConfigCompatibleWithStandardLibrary
|
var json = jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
json.Unmarshal(input, &data)
|
json.Unmarshal(input, &data)
|
||||||
|
@ -78,10 +76,10 @@ go get github.com/json-iterator/go
|
||||||
|
|
||||||
Contributors
|
Contributors
|
||||||
|
|
||||||
* [thockin](https://github.com/thockin)
|
- [thockin](https://github.com/thockin)
|
||||||
* [mattn](https://github.com/mattn)
|
- [mattn](https://github.com/mattn)
|
||||||
* [cch123](https://github.com/cch123)
|
- [cch123](https://github.com/cch123)
|
||||||
* [Oleg Shaldybin](https://github.com/olegshaldybin)
|
- [Oleg Shaldybin](https://github.com/olegshaldybin)
|
||||||
* [Jason Toffaletti](https://github.com/toffaletti)
|
- [Jason Toffaletti](https://github.com/toffaletti)
|
||||||
|
|
||||||
Report issue or pull request, or email taowen@gmail.com, or [![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/json-iterator/Lobby)
|
Report issue or pull request, or email taowen@gmail.com, or [![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/json-iterator/Lobby)
|
||||||
|
|
4
vendor/github.com/json-iterator/go/any_str.go
generated
vendored
4
vendor/github.com/json-iterator/go/any_str.go
generated
vendored
|
@ -64,7 +64,6 @@ func (any *stringAny) ToInt64() int64 {
|
||||||
|
|
||||||
flag := 1
|
flag := 1
|
||||||
startPos := 0
|
startPos := 0
|
||||||
endPos := 0
|
|
||||||
if any.val[0] == '+' || any.val[0] == '-' {
|
if any.val[0] == '+' || any.val[0] == '-' {
|
||||||
startPos = 1
|
startPos = 1
|
||||||
}
|
}
|
||||||
|
@ -73,6 +72,7 @@ func (any *stringAny) ToInt64() int64 {
|
||||||
flag = -1
|
flag = -1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
endPos := startPos
|
||||||
for i := startPos; i < len(any.val); i++ {
|
for i := startPos; i < len(any.val); i++ {
|
||||||
if any.val[i] >= '0' && any.val[i] <= '9' {
|
if any.val[i] >= '0' && any.val[i] <= '9' {
|
||||||
endPos = i + 1
|
endPos = i + 1
|
||||||
|
@ -98,7 +98,6 @@ func (any *stringAny) ToUint64() uint64 {
|
||||||
}
|
}
|
||||||
|
|
||||||
startPos := 0
|
startPos := 0
|
||||||
endPos := 0
|
|
||||||
|
|
||||||
if any.val[0] == '-' {
|
if any.val[0] == '-' {
|
||||||
return 0
|
return 0
|
||||||
|
@ -107,6 +106,7 @@ func (any *stringAny) ToUint64() uint64 {
|
||||||
startPos = 1
|
startPos = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
endPos := startPos
|
||||||
for i := startPos; i < len(any.val); i++ {
|
for i := startPos; i < len(any.val); i++ {
|
||||||
if any.val[i] >= '0' && any.val[i] <= '9' {
|
if any.val[i] >= '0' && any.val[i] <= '9' {
|
||||||
endPos = i + 1
|
endPos = i + 1
|
||||||
|
|
4
vendor/github.com/json-iterator/go/config.go
generated
vendored
4
vendor/github.com/json-iterator/go/config.go
generated
vendored
|
@ -183,11 +183,11 @@ func (cfg *frozenConfig) validateJsonRawMessage(extension EncoderExtension) {
|
||||||
encoder := &funcEncoder{func(ptr unsafe.Pointer, stream *Stream) {
|
encoder := &funcEncoder{func(ptr unsafe.Pointer, stream *Stream) {
|
||||||
rawMessage := *(*json.RawMessage)(ptr)
|
rawMessage := *(*json.RawMessage)(ptr)
|
||||||
iter := cfg.BorrowIterator([]byte(rawMessage))
|
iter := cfg.BorrowIterator([]byte(rawMessage))
|
||||||
|
defer cfg.ReturnIterator(iter)
|
||||||
iter.Read()
|
iter.Read()
|
||||||
if iter.Error != nil {
|
if iter.Error != nil && iter.Error != io.EOF {
|
||||||
stream.WriteRaw("null")
|
stream.WriteRaw("null")
|
||||||
} else {
|
} else {
|
||||||
cfg.ReturnIterator(iter)
|
|
||||||
stream.WriteRaw(string(rawMessage))
|
stream.WriteRaw(string(rawMessage))
|
||||||
}
|
}
|
||||||
}, func(ptr unsafe.Pointer) bool {
|
}, func(ptr unsafe.Pointer) bool {
|
||||||
|
|
2
vendor/github.com/json-iterator/go/go.mod
generated
vendored
2
vendor/github.com/json-iterator/go/go.mod
generated
vendored
|
@ -6,6 +6,6 @@ require (
|
||||||
github.com/davecgh/go-spew v1.1.1
|
github.com/davecgh/go-spew v1.1.1
|
||||||
github.com/google/gofuzz v1.0.0
|
github.com/google/gofuzz v1.0.0
|
||||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421
|
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421
|
||||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742
|
github.com/modern-go/reflect2 v1.0.2
|
||||||
github.com/stretchr/testify v1.3.0
|
github.com/stretchr/testify v1.3.0
|
||||||
)
|
)
|
||||||
|
|
4
vendor/github.com/json-iterator/go/go.sum
generated
vendored
4
vendor/github.com/json-iterator/go/go.sum
generated
vendored
|
@ -5,8 +5,8 @@ github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw=
|
||||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
|
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
|
||||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg=
|
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
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/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
|
3
vendor/github.com/json-iterator/go/iter_float.go
generated
vendored
3
vendor/github.com/json-iterator/go/iter_float.go
generated
vendored
|
@ -288,6 +288,9 @@ non_decimal_loop:
|
||||||
return iter.readFloat64SlowPath()
|
return iter.readFloat64SlowPath()
|
||||||
}
|
}
|
||||||
value = (value << 3) + (value << 1) + uint64(ind)
|
value = (value << 3) + (value << 1) + uint64(ind)
|
||||||
|
if value > maxFloat64 {
|
||||||
|
return iter.readFloat64SlowPath()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return iter.readFloat64SlowPath()
|
return iter.readFloat64SlowPath()
|
||||||
|
|
3
vendor/github.com/json-iterator/go/iter_int.go
generated
vendored
3
vendor/github.com/json-iterator/go/iter_int.go
generated
vendored
|
@ -9,6 +9,7 @@ var intDigits []int8
|
||||||
|
|
||||||
const uint32SafeToMultiply10 = uint32(0xffffffff)/10 - 1
|
const uint32SafeToMultiply10 = uint32(0xffffffff)/10 - 1
|
||||||
const uint64SafeToMultiple10 = uint64(0xffffffffffffffff)/10 - 1
|
const uint64SafeToMultiple10 = uint64(0xffffffffffffffff)/10 - 1
|
||||||
|
const maxFloat64 = 1<<53 - 1
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
intDigits = make([]int8, 256)
|
intDigits = make([]int8, 256)
|
||||||
|
@ -339,7 +340,7 @@ func (iter *Iterator) readUint64(c byte) (ret uint64) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (iter *Iterator) assertInteger() {
|
func (iter *Iterator) assertInteger() {
|
||||||
if iter.head < len(iter.buf) && iter.buf[iter.head] == '.' {
|
if iter.head < iter.tail && iter.buf[iter.head] == '.' {
|
||||||
iter.ReportError("assertInteger", "can not decode float as int")
|
iter.ReportError("assertInteger", "can not decode float as int")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
4
vendor/github.com/json-iterator/go/iter_object.go
generated
vendored
4
vendor/github.com/json-iterator/go/iter_object.go
generated
vendored
|
@ -150,7 +150,7 @@ func (iter *Iterator) ReadObjectCB(callback func(*Iterator, string) bool) bool {
|
||||||
if c == '}' {
|
if c == '}' {
|
||||||
return iter.decrementDepth()
|
return iter.decrementDepth()
|
||||||
}
|
}
|
||||||
iter.ReportError("ReadObjectCB", `expect " after }, but found `+string([]byte{c}))
|
iter.ReportError("ReadObjectCB", `expect " after {, but found `+string([]byte{c}))
|
||||||
iter.decrementDepth()
|
iter.decrementDepth()
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -206,7 +206,7 @@ func (iter *Iterator) ReadMapCB(callback func(*Iterator, string) bool) bool {
|
||||||
if c == '}' {
|
if c == '}' {
|
||||||
return iter.decrementDepth()
|
return iter.decrementDepth()
|
||||||
}
|
}
|
||||||
iter.ReportError("ReadMapCB", `expect " after }, but found `+string([]byte{c}))
|
iter.ReportError("ReadMapCB", `expect " after {, but found `+string([]byte{c}))
|
||||||
iter.decrementDepth()
|
iter.decrementDepth()
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
2
vendor/github.com/json-iterator/go/reflect.go
generated
vendored
2
vendor/github.com/json-iterator/go/reflect.go
generated
vendored
|
@ -65,7 +65,7 @@ func (iter *Iterator) ReadVal(obj interface{}) {
|
||||||
decoder := iter.cfg.getDecoderFromCache(cacheKey)
|
decoder := iter.cfg.getDecoderFromCache(cacheKey)
|
||||||
if decoder == nil {
|
if decoder == nil {
|
||||||
typ := reflect2.TypeOf(obj)
|
typ := reflect2.TypeOf(obj)
|
||||||
if typ.Kind() != reflect.Ptr {
|
if typ == nil || typ.Kind() != reflect.Ptr {
|
||||||
iter.ReportError("ReadVal", "can only unmarshal into pointer")
|
iter.ReportError("ReadVal", "can only unmarshal into pointer")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
2
vendor/github.com/json-iterator/go/reflect_extension.go
generated
vendored
2
vendor/github.com/json-iterator/go/reflect_extension.go
generated
vendored
|
@ -475,7 +475,7 @@ func calcFieldNames(originalFieldName string, tagProvidedFieldName string, whole
|
||||||
fieldNames = []string{tagProvidedFieldName}
|
fieldNames = []string{tagProvidedFieldName}
|
||||||
}
|
}
|
||||||
// private?
|
// private?
|
||||||
isNotExported := unicode.IsLower(rune(originalFieldName[0]))
|
isNotExported := unicode.IsLower(rune(originalFieldName[0])) || originalFieldName[0] == '_'
|
||||||
if isNotExported {
|
if isNotExported {
|
||||||
fieldNames = []string{}
|
fieldNames = []string{}
|
||||||
}
|
}
|
||||||
|
|
24
vendor/github.com/json-iterator/go/reflect_json_raw_message.go
generated
vendored
24
vendor/github.com/json-iterator/go/reflect_json_raw_message.go
generated
vendored
|
@ -33,11 +33,19 @@ type jsonRawMessageCodec struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (codec *jsonRawMessageCodec) Decode(ptr unsafe.Pointer, iter *Iterator) {
|
func (codec *jsonRawMessageCodec) Decode(ptr unsafe.Pointer, iter *Iterator) {
|
||||||
*((*json.RawMessage)(ptr)) = json.RawMessage(iter.SkipAndReturnBytes())
|
if iter.ReadNil() {
|
||||||
|
*((*json.RawMessage)(ptr)) = nil
|
||||||
|
} else {
|
||||||
|
*((*json.RawMessage)(ptr)) = iter.SkipAndReturnBytes()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (codec *jsonRawMessageCodec) Encode(ptr unsafe.Pointer, stream *Stream) {
|
func (codec *jsonRawMessageCodec) Encode(ptr unsafe.Pointer, stream *Stream) {
|
||||||
stream.WriteRaw(string(*((*json.RawMessage)(ptr))))
|
if *((*json.RawMessage)(ptr)) == nil {
|
||||||
|
stream.WriteNil()
|
||||||
|
} else {
|
||||||
|
stream.WriteRaw(string(*((*json.RawMessage)(ptr))))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (codec *jsonRawMessageCodec) IsEmpty(ptr unsafe.Pointer) bool {
|
func (codec *jsonRawMessageCodec) IsEmpty(ptr unsafe.Pointer) bool {
|
||||||
|
@ -48,11 +56,19 @@ type jsoniterRawMessageCodec struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (codec *jsoniterRawMessageCodec) Decode(ptr unsafe.Pointer, iter *Iterator) {
|
func (codec *jsoniterRawMessageCodec) Decode(ptr unsafe.Pointer, iter *Iterator) {
|
||||||
*((*RawMessage)(ptr)) = RawMessage(iter.SkipAndReturnBytes())
|
if iter.ReadNil() {
|
||||||
|
*((*RawMessage)(ptr)) = nil
|
||||||
|
} else {
|
||||||
|
*((*RawMessage)(ptr)) = iter.SkipAndReturnBytes()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (codec *jsoniterRawMessageCodec) Encode(ptr unsafe.Pointer, stream *Stream) {
|
func (codec *jsoniterRawMessageCodec) Encode(ptr unsafe.Pointer, stream *Stream) {
|
||||||
stream.WriteRaw(string(*((*RawMessage)(ptr))))
|
if *((*RawMessage)(ptr)) == nil {
|
||||||
|
stream.WriteNil()
|
||||||
|
} else {
|
||||||
|
stream.WriteRaw(string(*((*RawMessage)(ptr))))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (codec *jsoniterRawMessageCodec) IsEmpty(ptr unsafe.Pointer) bool {
|
func (codec *jsoniterRawMessageCodec) IsEmpty(ptr unsafe.Pointer) bool {
|
||||||
|
|
80
vendor/github.com/json-iterator/go/reflect_map.go
generated
vendored
80
vendor/github.com/json-iterator/go/reflect_map.go
generated
vendored
|
@ -49,6 +49,33 @@ func decoderOfMapKey(ctx *ctx, typ reflect2.Type) ValDecoder {
|
||||||
return decoder
|
return decoder
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ptrType := reflect2.PtrTo(typ)
|
||||||
|
if ptrType.Implements(unmarshalerType) {
|
||||||
|
return &referenceDecoder{
|
||||||
|
&unmarshalerDecoder{
|
||||||
|
valType: ptrType,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if typ.Implements(unmarshalerType) {
|
||||||
|
return &unmarshalerDecoder{
|
||||||
|
valType: typ,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ptrType.Implements(textUnmarshalerType) {
|
||||||
|
return &referenceDecoder{
|
||||||
|
&textUnmarshalerDecoder{
|
||||||
|
valType: ptrType,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if typ.Implements(textUnmarshalerType) {
|
||||||
|
return &textUnmarshalerDecoder{
|
||||||
|
valType: typ,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch typ.Kind() {
|
switch typ.Kind() {
|
||||||
case reflect.String:
|
case reflect.String:
|
||||||
return decoderOfType(ctx, reflect2.DefaultTypeOfKind(reflect.String))
|
return decoderOfType(ctx, reflect2.DefaultTypeOfKind(reflect.String))
|
||||||
|
@ -63,31 +90,6 @@ func decoderOfMapKey(ctx *ctx, typ reflect2.Type) ValDecoder {
|
||||||
typ = reflect2.DefaultTypeOfKind(typ.Kind())
|
typ = reflect2.DefaultTypeOfKind(typ.Kind())
|
||||||
return &numericMapKeyDecoder{decoderOfType(ctx, typ)}
|
return &numericMapKeyDecoder{decoderOfType(ctx, typ)}
|
||||||
default:
|
default:
|
||||||
ptrType := reflect2.PtrTo(typ)
|
|
||||||
if ptrType.Implements(unmarshalerType) {
|
|
||||||
return &referenceDecoder{
|
|
||||||
&unmarshalerDecoder{
|
|
||||||
valType: ptrType,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if typ.Implements(unmarshalerType) {
|
|
||||||
return &unmarshalerDecoder{
|
|
||||||
valType: typ,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ptrType.Implements(textUnmarshalerType) {
|
|
||||||
return &referenceDecoder{
|
|
||||||
&textUnmarshalerDecoder{
|
|
||||||
valType: ptrType,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if typ.Implements(textUnmarshalerType) {
|
|
||||||
return &textUnmarshalerDecoder{
|
|
||||||
valType: typ,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return &lazyErrorDecoder{err: fmt.Errorf("unsupported map key type: %v", typ)}
|
return &lazyErrorDecoder{err: fmt.Errorf("unsupported map key type: %v", typ)}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -103,6 +105,19 @@ func encoderOfMapKey(ctx *ctx, typ reflect2.Type) ValEncoder {
|
||||||
return encoder
|
return encoder
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if typ == textMarshalerType {
|
||||||
|
return &directTextMarshalerEncoder{
|
||||||
|
stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if typ.Implements(textMarshalerType) {
|
||||||
|
return &textMarshalerEncoder{
|
||||||
|
valType: typ,
|
||||||
|
stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch typ.Kind() {
|
switch typ.Kind() {
|
||||||
case reflect.String:
|
case reflect.String:
|
||||||
return encoderOfType(ctx, reflect2.DefaultTypeOfKind(reflect.String))
|
return encoderOfType(ctx, reflect2.DefaultTypeOfKind(reflect.String))
|
||||||
|
@ -117,17 +132,6 @@ func encoderOfMapKey(ctx *ctx, typ reflect2.Type) ValEncoder {
|
||||||
typ = reflect2.DefaultTypeOfKind(typ.Kind())
|
typ = reflect2.DefaultTypeOfKind(typ.Kind())
|
||||||
return &numericMapKeyEncoder{encoderOfType(ctx, typ)}
|
return &numericMapKeyEncoder{encoderOfType(ctx, typ)}
|
||||||
default:
|
default:
|
||||||
if typ == textMarshalerType {
|
|
||||||
return &directTextMarshalerEncoder{
|
|
||||||
stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if typ.Implements(textMarshalerType) {
|
|
||||||
return &textMarshalerEncoder{
|
|
||||||
valType: typ,
|
|
||||||
stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if typ.Kind() == reflect.Interface {
|
if typ.Kind() == reflect.Interface {
|
||||||
return &dynamicMapKeyEncoder{ctx, typ}
|
return &dynamicMapKeyEncoder{ctx, typ}
|
||||||
}
|
}
|
||||||
|
@ -163,10 +167,6 @@ func (decoder *mapDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) {
|
||||||
if c == '}' {
|
if c == '}' {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if c != '"' {
|
|
||||||
iter.ReportError("ReadMapCB", `expect " after }, but found `+string([]byte{c}))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
iter.unreadByte()
|
iter.unreadByte()
|
||||||
key := decoder.keyType.UnsafeNew()
|
key := decoder.keyType.UnsafeNew()
|
||||||
decoder.keyDecoder.Decode(key, iter)
|
decoder.keyDecoder.Decode(key, iter)
|
||||||
|
|
4
vendor/github.com/json-iterator/go/reflect_optional.go
generated
vendored
4
vendor/github.com/json-iterator/go/reflect_optional.go
generated
vendored
|
@ -2,7 +2,6 @@ package jsoniter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/modern-go/reflect2"
|
"github.com/modern-go/reflect2"
|
||||||
"reflect"
|
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -10,9 +9,6 @@ func decoderOfOptional(ctx *ctx, typ reflect2.Type) ValDecoder {
|
||||||
ptrType := typ.(*reflect2.UnsafePtrType)
|
ptrType := typ.(*reflect2.UnsafePtrType)
|
||||||
elemType := ptrType.Elem()
|
elemType := ptrType.Elem()
|
||||||
decoder := decoderOfType(ctx, elemType)
|
decoder := decoderOfType(ctx, elemType)
|
||||||
if ctx.prefix == "" && elemType.Kind() == reflect.Ptr {
|
|
||||||
return &dereferenceDecoder{elemType, decoder}
|
|
||||||
}
|
|
||||||
return &OptionalDecoder{elemType, decoder}
|
return &OptionalDecoder{elemType, decoder}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
27
vendor/github.com/json-iterator/go/reflect_struct_decoder.go
generated
vendored
27
vendor/github.com/json-iterator/go/reflect_struct_decoder.go
generated
vendored
|
@ -507,7 +507,7 @@ func (decoder *generalStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator)
|
||||||
for c = ','; c == ','; c = iter.nextToken() {
|
for c = ','; c == ','; c = iter.nextToken() {
|
||||||
decoder.decodeOneField(ptr, iter)
|
decoder.decodeOneField(ptr, iter)
|
||||||
}
|
}
|
||||||
if iter.Error != nil && iter.Error != io.EOF {
|
if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 {
|
||||||
iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error())
|
iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error())
|
||||||
}
|
}
|
||||||
if c != '}' {
|
if c != '}' {
|
||||||
|
@ -588,7 +588,7 @@ func (decoder *oneFieldStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if iter.Error != nil && iter.Error != io.EOF {
|
if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 {
|
||||||
iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error())
|
iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error())
|
||||||
}
|
}
|
||||||
iter.decrementDepth()
|
iter.decrementDepth()
|
||||||
|
@ -622,7 +622,7 @@ func (decoder *twoFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if iter.Error != nil && iter.Error != io.EOF {
|
if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 {
|
||||||
iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error())
|
iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error())
|
||||||
}
|
}
|
||||||
iter.decrementDepth()
|
iter.decrementDepth()
|
||||||
|
@ -660,7 +660,7 @@ func (decoder *threeFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterat
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if iter.Error != nil && iter.Error != io.EOF {
|
if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 {
|
||||||
iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error())
|
iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error())
|
||||||
}
|
}
|
||||||
iter.decrementDepth()
|
iter.decrementDepth()
|
||||||
|
@ -702,7 +702,7 @@ func (decoder *fourFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterato
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if iter.Error != nil && iter.Error != io.EOF {
|
if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 {
|
||||||
iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error())
|
iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error())
|
||||||
}
|
}
|
||||||
iter.decrementDepth()
|
iter.decrementDepth()
|
||||||
|
@ -748,7 +748,7 @@ func (decoder *fiveFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterato
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if iter.Error != nil && iter.Error != io.EOF {
|
if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 {
|
||||||
iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error())
|
iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error())
|
||||||
}
|
}
|
||||||
iter.decrementDepth()
|
iter.decrementDepth()
|
||||||
|
@ -798,7 +798,7 @@ func (decoder *sixFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if iter.Error != nil && iter.Error != io.EOF {
|
if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 {
|
||||||
iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error())
|
iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error())
|
||||||
}
|
}
|
||||||
iter.decrementDepth()
|
iter.decrementDepth()
|
||||||
|
@ -852,7 +852,7 @@ func (decoder *sevenFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterat
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if iter.Error != nil && iter.Error != io.EOF {
|
if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 {
|
||||||
iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error())
|
iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error())
|
||||||
}
|
}
|
||||||
iter.decrementDepth()
|
iter.decrementDepth()
|
||||||
|
@ -910,7 +910,7 @@ func (decoder *eightFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterat
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if iter.Error != nil && iter.Error != io.EOF {
|
if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 {
|
||||||
iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error())
|
iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error())
|
||||||
}
|
}
|
||||||
iter.decrementDepth()
|
iter.decrementDepth()
|
||||||
|
@ -972,7 +972,7 @@ func (decoder *nineFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterato
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if iter.Error != nil && iter.Error != io.EOF {
|
if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 {
|
||||||
iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error())
|
iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error())
|
||||||
}
|
}
|
||||||
iter.decrementDepth()
|
iter.decrementDepth()
|
||||||
|
@ -1038,7 +1038,7 @@ func (decoder *tenFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if iter.Error != nil && iter.Error != io.EOF {
|
if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 {
|
||||||
iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error())
|
iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error())
|
||||||
}
|
}
|
||||||
iter.decrementDepth()
|
iter.decrementDepth()
|
||||||
|
@ -1075,6 +1075,11 @@ type stringModeNumberDecoder struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (decoder *stringModeNumberDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) {
|
func (decoder *stringModeNumberDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) {
|
||||||
|
if iter.WhatIsNext() == NilValue {
|
||||||
|
decoder.elemDecoder.Decode(ptr, iter)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
c := iter.nextToken()
|
c := iter.nextToken()
|
||||||
if c != '"' {
|
if c != '"' {
|
||||||
iter.ReportError("stringModeNumberDecoder", `expect ", but found `+string([]byte{c}))
|
iter.ReportError("stringModeNumberDecoder", `expect ", but found `+string([]byte{c}))
|
||||||
|
|
5
vendor/github.com/json-iterator/go/stream.go
generated
vendored
5
vendor/github.com/json-iterator/go/stream.go
generated
vendored
|
@ -103,14 +103,14 @@ func (stream *Stream) Flush() error {
|
||||||
if stream.Error != nil {
|
if stream.Error != nil {
|
||||||
return stream.Error
|
return stream.Error
|
||||||
}
|
}
|
||||||
n, err := stream.out.Write(stream.buf)
|
_, err := stream.out.Write(stream.buf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if stream.Error == nil {
|
if stream.Error == nil {
|
||||||
stream.Error = err
|
stream.Error = err
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
stream.buf = stream.buf[n:]
|
stream.buf = stream.buf[:0]
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,7 +177,6 @@ func (stream *Stream) WriteEmptyObject() {
|
||||||
func (stream *Stream) WriteMore() {
|
func (stream *Stream) WriteMore() {
|
||||||
stream.writeByte(',')
|
stream.writeByte(',')
|
||||||
stream.writeIndention(0)
|
stream.writeIndention(0)
|
||||||
stream.Flush()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// WriteArrayStart write [ with possible indention
|
// WriteArrayStart write [ with possible indention
|
||||||
|
|
9
vendor/github.com/konsorten/go-windows-terminal-sequences/LICENSE
generated
vendored
9
vendor/github.com/konsorten/go-windows-terminal-sequences/LICENSE
generated
vendored
|
@ -1,9 +0,0 @@
|
||||||
(The MIT License)
|
|
||||||
|
|
||||||
Copyright (c) 2017 marvin + konsorten GmbH (open-source@konsorten.de)
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
42
vendor/github.com/konsorten/go-windows-terminal-sequences/README.md
generated
vendored
42
vendor/github.com/konsorten/go-windows-terminal-sequences/README.md
generated
vendored
|
@ -1,42 +0,0 @@
|
||||||
# Windows Terminal Sequences
|
|
||||||
|
|
||||||
This library allow for enabling Windows terminal color support for Go.
|
|
||||||
|
|
||||||
See [Console Virtual Terminal Sequences](https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences) for details.
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
```go
|
|
||||||
import (
|
|
||||||
"syscall"
|
|
||||||
|
|
||||||
sequences "github.com/konsorten/go-windows-terminal-sequences"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
sequences.EnableVirtualTerminalProcessing(syscall.Stdout, true)
|
|
||||||
}
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
## Authors
|
|
||||||
|
|
||||||
The tool is sponsored by the [marvin + konsorten GmbH](http://www.konsorten.de).
|
|
||||||
|
|
||||||
We thank all the authors who provided code to this library:
|
|
||||||
|
|
||||||
* Felix Kollmann
|
|
||||||
* Nicolas Perraut
|
|
||||||
* @dirty49374
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
(The MIT License)
|
|
||||||
|
|
||||||
Copyright (c) 2018 marvin + konsorten GmbH (open-source@konsorten.de)
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1
vendor/github.com/konsorten/go-windows-terminal-sequences/go.mod
generated
vendored
1
vendor/github.com/konsorten/go-windows-terminal-sequences/go.mod
generated
vendored
|
@ -1 +0,0 @@
|
||||||
module github.com/konsorten/go-windows-terminal-sequences
|
|
35
vendor/github.com/konsorten/go-windows-terminal-sequences/sequences.go
generated
vendored
35
vendor/github.com/konsorten/go-windows-terminal-sequences/sequences.go
generated
vendored
|
@ -1,35 +0,0 @@
|
||||||
// +build windows
|
|
||||||
|
|
||||||
package sequences
|
|
||||||
|
|
||||||
import (
|
|
||||||
"syscall"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
kernel32Dll *syscall.LazyDLL = syscall.NewLazyDLL("Kernel32.dll")
|
|
||||||
setConsoleMode *syscall.LazyProc = kernel32Dll.NewProc("SetConsoleMode")
|
|
||||||
)
|
|
||||||
|
|
||||||
func EnableVirtualTerminalProcessing(stream syscall.Handle, enable bool) error {
|
|
||||||
const ENABLE_VIRTUAL_TERMINAL_PROCESSING uint32 = 0x4
|
|
||||||
|
|
||||||
var mode uint32
|
|
||||||
err := syscall.GetConsoleMode(syscall.Stdout, &mode)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if enable {
|
|
||||||
mode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING
|
|
||||||
} else {
|
|
||||||
mode &^= ENABLE_VIRTUAL_TERMINAL_PROCESSING
|
|
||||||
}
|
|
||||||
|
|
||||||
ret, _, err := setConsoleMode.Call(uintptr(stream), uintptr(mode))
|
|
||||||
if ret == 0 {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue